Browse Source

CHART-3667 代码回退,线型支持虚线

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
bd59cb594c
  1. 52
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java
  2. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java
  3. 88
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java
  4. 134
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java
  5. 186
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java
  6. 21
      designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java

52
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java

@ -2,7 +2,6 @@ package com.fr.van.chart.designer.component;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
@ -13,8 +12,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.type.LineStyle;
import com.fr.plugin.chart.type.LineType;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
@ -30,8 +27,10 @@ import java.util.Arrays;
public class VanChartLineTypePane extends BasicPane {
private static final long serialVersionUID = -6581862503009962973L;
//线型支持虚线 恢复用注释。下面1行删除。
protected LineComboBox lineWidth;//线型
private static final double LINE_WIDTH_MIN_VALUE = 0.5;
private static final double LINE_WIDTH_DIERTA_VALUE = 0.5;
private static final double LINE_WIDTH_DEFAULT_VALUE = 2;
private LineTypeComboBox lineTypeComboBox;//线型
private UISpinner lineWidthSpinner;//线宽
@ -42,14 +41,14 @@ public class VanChartLineTypePane extends BasicPane {
private JPanel lineStylePane;
public VanChartLineTypePane() {
//线型支持虚线 恢复用注释。下面1行删除。
lineWidth = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
JPanel typeAndWidthPane = createTypeAndWidthPane();
createLineStyle();
nullValueBreak = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")});
nullValueBreak = new UIButtonGroup(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Open"),
Toolkit.i18nText("Fine-Design_Chart_Close")});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -67,8 +66,7 @@ public class VanChartLineTypePane extends BasicPane {
lineStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout(0, 6));
//线型支持虚线 恢复用注释。取消注释。
//this.add(typeAndWidthPane, BorderLayout.NORTH);
this.add(typeAndWidthPane, BorderLayout.NORTH);
this.add(lineStylePane, BorderLayout.CENTER);
}
@ -76,7 +74,7 @@ public class VanChartLineTypePane extends BasicPane {
lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2);
lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
lineTypeComboBox.addActionListener(new ActionListener() {
@Override
@ -117,12 +115,6 @@ public class VanChartLineTypePane extends BasicPane {
protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{
//线型支持虚线 恢复用注释。下面5行删除。
new Component[]{null, null},
new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(lineWidth)
},
lineStyleComponent,
nullValueBreakComponent
};
@ -141,16 +133,10 @@ public class VanChartLineTypePane extends BasicPane {
}
public void checkLarge(boolean large) {
//线型支持虚线 恢复用注释。下面4行删除。
if (large) {
lineWidth.setSelectedLineStyle(Constants.LINE_NONE);
}
lineWidth.setEnabled(!large);
//线型支持虚线 恢复用注释。取消注释。
// if (large) {
// lineTypeComboBox.setSelectedItem(LineType.NONE);
// }
// lineTypeComboBox.setEnabled(!large);
lineTypeComboBox.setSelectedItem(LineType.NONE);
}
lineTypeComboBox.setEnabled(!large);
lineStyle.setEnabled(!large);
}
@ -162,11 +148,8 @@ public class VanChartLineTypePane extends BasicPane {
if (line == null) {
line = initVanChartAttrLine();
}
//线型支持虚线 恢复用注释。下面1行删除。
lineWidth.setSelectedLineStyle(line.getLineWidth());
//线型支持虚线 恢复用注释。取消注释。
// lineTypeComboBox.setSelectedItem(line.getLineType());
// lineWidthSpinner.setValue(line.getLineWidth());
lineTypeComboBox.setSelectedItem(line.getLineType());
lineWidthSpinner.setValue(line.getLineWidth());
lineStyle.setSelectedItem(line.getLineStyle());
nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1);
}
@ -177,11 +160,8 @@ public class VanChartLineTypePane extends BasicPane {
public VanChartAttrLine update() {
VanChartAttrLine line = new VanChartAttrLine();
//线型支持虚线 恢复用注释。下面1行删除。
line.setLineWidth(lineWidth.getSelectedLineStyle());
//线型支持虚线 恢复用注释。取消注释。
// line.setLineType((LineType) lineTypeComboBox.getSelectedItem());
// line.setLineWidth(lineWidthSpinner.getValue());
line.setLineType((LineType) lineTypeComboBox.getSelectedItem());
line.setLineWidth(lineWidthSpinner.getValue());
line.setLineStyle(lineStyle.getSelectedItem());
line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0);
return line;

6
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java

@ -1,8 +1,5 @@
package com.fr.van.chart.designer.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import java.awt.Component;
/**
@ -14,9 +11,6 @@ public class VanChartLineWidthPane extends VanChartLineTypePane {
@Override
protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{
//线型支持虚线 恢复用注释。下面2行删除。
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth},
nullValueBreakComponent
};
}

88
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java

@ -4,7 +4,6 @@ import com.fr.chart.base.AttrColor;
import com.fr.chart.base.AttrLineStyle;
import com.fr.chart.base.LineStyleInfo;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
@ -17,7 +16,6 @@ import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.base.TrendLineType;
import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.type.LineType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -34,14 +32,15 @@ import java.awt.event.ActionListener;
public class VanChartTrendLinePane extends BasicPane{
private static final TrendLineType[] TYPES = new TrendLineType[] {TrendLineType.EXP, TrendLineType.LINE, TrendLineType.LOG, TrendLineType.POLY};
private static final int PREFERRED_WIDTH = 100;
private static final double LINE_WIDTH_MIN_VALUE = 0.5;
private static final double LINE_WIDTH_DIERTA_VALUE = 0.5;
private static final double LINE_WIDTH_DEFAULT_VALUE = 2;
private UITextField trendLineName;
private ColorSelectBox trendLineColor;
//线型支持虚线 恢复用注释。下面1行删除。
private LineComboBox trendLineStyle;//线型
//线型支持虚线 恢复用注释。取消注释。
// private LineTypeComboBox trendLineStyle;//线型
// private UISpinner lineWidthSpinner;//线宽
private LineTypeComboBox trendLineStyle;//线型
private UISpinner lineWidthSpinner;//线宽
private UIComboBox trendLineType;//趋势线函数类型
private UISpinner prePeriod;
@ -58,15 +57,11 @@ public class VanChartTrendLinePane extends BasicPane{
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = {p, p, p, p, p, p};
double[] col = {f, e};
trendLineName = new UITextField();
trendLineColor = new ColorSelectBox(100);
//线型支持虚线 恢复用注释。下面1行删除。
trendLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE);
//线型支持虚线 恢复用注释。取消注释。
// trendLineStyle = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
// lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2);
trendLineColor = new ColorSelectBox(PREFERRED_WIDTH);
trendLineStyle = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
trendLineType = new UIComboBox(TYPES);
prePeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
afterPeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
@ -82,42 +77,26 @@ public class VanChartTrendLinePane extends BasicPane{
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Period"));
label.setVerticalAlignment(SwingConstants.TOP);
//线型支持虚线 恢复用注释。开始删除。
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName},
new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle)
},
}
};
Component[][] componentsMayHide = new Component[][]{
new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")),
UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), trendLineColor},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType},
new Component[]{label, periodPane}
};
//线型支持虚线 恢复用注释。结束删除。
//线型支持虚线 恢复用注释。取消注释。
// Component[][] components = new Component[][]{
// new Component[]{null, null},
// new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName},
// new Component[]{
// FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
// UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle)
// }
// };
//
// Component[][] componentsMayHide = new Component[][]{
// new Component[]{
// FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")),
// UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)},
// new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), trendLineColor},
// new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType},
// new Component[]{label, periodPane}
// };
// trendLineHidePane = TableLayout4VanChartHelper.createGapTableLayoutPane(componentsMayHide, row, col);
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p,p,p}, col);
trendLineHidePane = TableLayout4VanChartHelper.createGapTableLayoutPane(componentsMayHide, new double[]{p,p,p,p}, col);
trendLineStyle.addActionListener(new ActionListener() {
@Override
@ -129,8 +108,7 @@ public class VanChartTrendLinePane extends BasicPane{
checkHidePaneVisible();
this.add(panel, BorderLayout.CENTER);
//线型支持虚线 恢复用注释。取消注释。
//this.add(trendLineHidePane, BorderLayout.SOUTH);
this.add(trendLineHidePane, BorderLayout.SOUTH);
}
protected String title4PopupWindow(){
@ -142,12 +120,14 @@ public class VanChartTrendLinePane extends BasicPane{
if(trendLine != null){
trendLineName.setText(trendLine.getTrendLineName());
LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo();
AttrLineStyle attrLineStyle = lineStyleInfo.getAttrLineStyle();
if (attrLineStyle != null) {
trendLineStyle.setSelectedItem(attrLineStyle.getLineType());
lineWidthSpinner.setValue(attrLineStyle.getLineWidth());
}
trendLineColor.setSelectObject(lineStyleInfo.getAttrLineColor().getSeriesColor());
//线型支持虚线 恢复用注释。下面1行删除。
trendLineStyle.setSelectedLineStyle(lineStyleInfo.getAttrLineStyle().getLineStyle());
//线型支持虚线 恢复用注释。取消注释。
// trendLineStyle.setSelectedItem(lineStyleInfo.getAttrLineStyle().getLineType());
// lineWidthSpinner.setValue(lineStyleInfo.getAttrLineStyle().getLineWidth());
trendLineType.setSelectedItem(trendLine.getTrendLineType());
prePeriod.setValue(trendLine.getPrePeriod());
afterPeriod.setValue(trendLine.getAfterPeriod());
@ -159,11 +139,13 @@ public class VanChartTrendLinePane extends BasicPane{
trendLine.setTrendLineName(trendLineName.getText());
LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo();
//线型支持虚线 恢复用注释。下面1行删除。
lineStyleInfo.setAttrLineStyle(new AttrLineStyle(trendLineStyle.getSelectedLineStyle()));
//线型支持虚线 恢复用注释。取消注释。
// lineStyleInfo.getAttrLineStyle().setLineWidth(lineWidthSpinner.getValue());
// lineStyleInfo.getAttrLineStyle().setLineType((LineType) trendLineStyle.getSelectedItem());
AttrLineStyle attrLineStyle = lineStyleInfo.getAttrLineStyle();
if (attrLineStyle != null) {
attrLineStyle.setLineWidth(lineWidthSpinner.getValue());
attrLineStyle.setLineType((LineType) trendLineStyle.getSelectedItem());
}
lineStyleInfo.setAttrLineColor(new AttrColor(trendLineColor.getSelectObject()));
trendLine.setTrendLineType((TrendLineType) trendLineType.getSelectedItem());

134
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java

@ -2,12 +2,15 @@ package com.fr.van.chart.designer.style.background;
import com.fr.base.BaseFormula;
import com.fr.base.Utils;
import com.fr.chart.base.AttrColor;
import com.fr.chart.base.AttrLineStyle;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
@ -18,9 +21,10 @@ import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.type.LineType;
import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
@ -39,13 +43,16 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private static final int VALUE_WD = 100;
private static final int TEXT_WD = 200;
private static final long serialVersionUID = -1208941770684286439L;
private static final int PREFERRED_WIDTH = 100;
private static final double LINE_WIDTH_MIN_VALUE = 0.5;
private static final double LINE_WIDTH_DIERTA_VALUE = 0.5;
private static final double LINE_WIDTH_DEFAULT_VALUE = 2;
private UIButtonGroup alertAxis;
protected TinyFormulaPane alertValue;
//线型支持虚线 恢复用注释。下面1行删除。
protected LineComboBox alertLineStyle;
//线型支持虚线 恢复用注释。取消注释。
// protected LineTypeComboBox alertLineStyle;//线型
// private UISpinner lineWidthSpinner;//线宽
protected LineTypeComboBox alertLineStyle;//线型
private UISpinner lineWidthSpinner;//线宽
protected ColorSelectBox alertLineColor;
private UIButtonGroup alertTextPosition;
@ -56,23 +63,20 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private VanChartAlertValue chartAlertValue;
public VanChartAlertValuePane(){
public VanChartAlertValuePane() {
initComponents();
}
private void initComponents(){
private void initComponents() {
alertValue = new TinyFormulaPane();
//設置大小,防止文本過長導致界面“變形”
alertValue.setPreferredSize(new Dimension(VALUE_WD, HT));
//线型支持虚线 恢复用注释。下面1行删除。
alertLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE);
//线型支持虚线 恢复用注释。取消注释。
// alertLineStyle = new LineTypeComboBox(new LineType[]{LineType.NORMAL, LineType.DASH});
// lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2);
alertLineColor = new ColorSelectBox(100);
alertTextPosition = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Top"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")});
alertLineStyle = new LineTypeComboBox(new LineType[]{LineType.NORMAL, LineType.DASH});
lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
alertLineColor = new ColorSelectBox(PREFERRED_WIDTH);
alertTextPosition = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")});
alertText = new TinyFormulaPane();
//設置大小,防止文本過長導致界面“變形”
alertText.setPreferredSize(new Dimension(TEXT_WD, HT));
@ -83,26 +87,25 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
}
private void doLayoutPane(){
private void doLayoutPane() {
this.removeAll();
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
//警戒线设置
JPanel top = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(top);
top.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Set") + ":", null));
top.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Chart_Alert_Set") + ":", null));
top.add(createTopPane());
//提示文字
JPanel bottom = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(bottom);
bottom.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Text") + ":", null));
bottom.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Chart_Alert_Text") + ":", null));
bottom.add(createBottomPane());
}
protected JPanel createTopPane()
{
protected JPanel createTopPane() {
double p = TableLayout.PREFERRED;
double[] columnSize = {p,p};
double[] rowSize = {p,p,p,p,p};
double[] columnSize = {p, p};
double[] rowSize = {p, p, p, p, p};
Component[][] components = getTopPaneComponents();
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -110,26 +113,25 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
protected Component[][] getTopPaneComponents() {
return new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),alertAxis},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")),alertValue},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),alertLineStyle},
//线型支持虚线 恢复用注释。取消注释。
//new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Width")), lineWidthSpinner},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),alertLineColor},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), alertAxis},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Value")), alertValue},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), alertLineStyle},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), lineWidthSpinner},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), alertLineColor},
};
}
private JPanel createBottomPane(){
private JPanel createBottomPane() {
alertTextPosition.setSelectedIndex(0);
double p = TableLayout.PREFERRED;
double[] columnSize = {p,p};
double[] rowSize = {p,p,p,p,p};
double[] columnSize = {p, p};
double[] rowSize = {p, p, p, p, p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),alertTextPosition},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")),alertText},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font")),fontName},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Size")),fontSize},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),fontColor},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), alertTextPosition},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Content")), alertText},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Form_Font")), fontName},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Form_FRFont_Size")), fontSize},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), fontColor},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -137,20 +139,20 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private void checkPositionPane() {
boolean selectXAxis = VanChartAttrHelper.isXAxis(alertAxis.getSelectedItem().toString());
if(selectXAxis){
alertTextPosition = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Top"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")});
if (selectXAxis) {
alertTextPosition = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")});
} else {
alertTextPosition = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Left"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Right")});
alertTextPosition = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Alert_Left"), Toolkit.i18nText("Fine-Design_Chart_Alert_Right")});
}
doLayoutPane();
}
protected String title4PopupWindow(){
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line");
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Alert_Line");
}
public void populateBean(VanChartAlertValue chartAlertValue){
this.chartAlertValue =chartAlertValue;
public void populateBean(VanChartAlertValue chartAlertValue) {
this.chartAlertValue = chartAlertValue;
alertAxis = new UIButtonGroup(chartAlertValue.getAxisNamesArray(), chartAlertValue.getAxisNamesArray());
alertAxis.setSelectedItem(chartAlertValue.getAxisName());
alertAxis.addChangeListener(new ChangeListener() {
@ -163,14 +165,20 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
checkPositionPane();
alertValue.populateBean(Utils.objectToString(chartAlertValue.getAlertValueFormula()));
//线型支持虚线 恢复用注释。下面1行删除。
alertLineStyle.setSelectedLineStyle(chartAlertValue.getLineStyle().getLineStyle());
//线型支持虚线 恢复用注释。取消注释。
// alertLineStyle.setSelectedItem(chartAlertValue.getLineStyle().getLineType());
// lineWidthSpinner.setValue(chartAlertValue.getLineStyle().getLineWidth());
alertLineColor.setSelectObject(chartAlertValue.getLineColor().getSeriesColor());
if(VanChartAttrHelper.isXAxis(chartAlertValue.getAxisName())){
AttrColor attrColor = chartAlertValue.getLineColor();
AttrLineStyle attrLineStyle = chartAlertValue.getLineStyle();
if (attrColor != null) {
alertLineColor.setSelectObject(attrColor.getSeriesColor());
}
if (attrLineStyle != null) {
alertLineStyle.setSelectedItem(attrLineStyle.getLineType());
lineWidthSpinner.setValue(attrLineStyle.getLineWidth());
}
if (VanChartAttrHelper.isXAxis(chartAlertValue.getAxisName())) {
alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.BOTTOM ? 1 : 0);
} else {
alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.LEFT ? 0 : 1);
@ -186,16 +194,22 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
fontColor.setSelectObject(chartAlertValue.getAlertFont().getForeground());
}
public VanChartAlertValue updateBean(){
public VanChartAlertValue updateBean() {
chartAlertValue.setAxisName(alertAxis.getSelectedItem().toString());
chartAlertValue.setAlertValueFormula(BaseFormula.createFormulaBuilder().build(alertValue.updateBean()));
chartAlertValue.getLineColor().setSeriesColor(alertLineColor.getSelectObject());
//线型支持虚线 恢复用注释。下面1行删除。
chartAlertValue.getLineStyle().setLineStyle(alertLineStyle.getSelectedLineStyle());
//线型支持虚线 恢复用注释。取消注释。
// chartAlertValue.getLineStyle().setLineType((LineType) alertLineStyle.getSelectedItem());
// chartAlertValue.getLineStyle().setLineWidth(lineWidthSpinner.getValue());
AttrColor attrColor = chartAlertValue.getLineColor();
AttrLineStyle attrLineStyle = chartAlertValue.getLineStyle();
if (attrColor != null) {
attrColor.setSeriesColor(alertLineColor.getSelectObject());
}
if (attrLineStyle != null) {
attrLineStyle.setLineType((LineType) alertLineStyle.getSelectedItem());
attrLineStyle.setLineWidth(lineWidthSpinner.getValue());
}
String contentString = alertText.updateBean();
Object contentObj;
@ -210,7 +224,7 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
int size = Utils.objectToNumber(fontSize.getSelectedItem(), true).intValue();
Color color = fontColor.getSelectObject();
chartAlertValue.setAlertFont(FRFont.getInstance(name, Font.PLAIN, size, color));
if(VanChartAttrHelper.isXAxis(Utils.objectToString(alertAxis.getSelectedItem()))){
if (VanChartAttrHelper.isXAxis(Utils.objectToString(alertAxis.getSelectedItem()))) {
chartAlertValue.setAlertPosition(alertTextPosition.getSelectedIndex() == 0 ? Constants.TOP : Constants.BOTTOM);
} else {
chartAlertValue.setAlertPosition(alertTextPosition.getSelectedIndex() == 0 ? Constants.LEFT : Constants.RIGHT);

186
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java

@ -10,8 +10,11 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.type.LineType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -20,7 +23,6 @@ import java.awt.CardLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
/**
* 样式-背景-绘图区背景-坐标轴图表特有间隔背景网格线警戒线
@ -28,6 +30,8 @@ import java.util.Arrays;
public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private static final long serialVersionUID = -1880497996650835504L;
private static final int PREFERRED_WIDTH = 100;
protected ColorSelectBox horizontalGridLine;
protected ColorSelectBox verticalGridLine;
@ -40,22 +44,20 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private ColorSelectBox verticalColorBackground;
protected BackgroundListControlPane customIntervalBackground;
//线型支持虚线 恢复用注释。取消注释。
// private LineTypeComboBox horizonLineType;//横向线型
// private LineTypeComboBox verticalLineType;//纵向线型
// private JPanel horizontalColorPane;
// private JPanel verticalColorPane;
private LineTypeComboBox horizonLineType;//横向线型
private LineTypeComboBox verticalLineType;//纵向线型
private JPanel horizontalColorPane;
private JPanel verticalColorPane;
public VanChartAxisAreaPane() {
initComponents();
}
protected void initComponents() {
horizontalGridLine = new ColorSelectBox(100);
verticalGridLine = new ColorSelectBox(100);
//线型支持虚线 恢复用注释。取消注释。
// horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
// verticalLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
horizontalGridLine = new ColorSelectBox(PREFERRED_WIDTH);
verticalGridLine = new ColorSelectBox(PREFERRED_WIDTH);
horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
verticalLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -74,78 +76,58 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
this.add(panel, BorderLayout.CENTER);
}
//线型支持虚线 恢复用注释。删除下面方法。
protected JPanel createGridLinePane() {
horizontalGridLine = new ColorSelectBox(100);
verticalGridLine = new ColorSelectBox(100);
Component[][] components = new Component[][]{
Component[][] upComponent = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal")), horizontalGridLine},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")), verticalGridLine},
new Component[]{null, horizontalGridLine}
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = new double[components.length];
Arrays.fill(row, p);
double[] col = {f, e};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent);
Component[][] downComponent = new Component[][]{
new Component[]{null, null},
new Component[]{null, verticalGridLine}
};
verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent);
horizonLineType.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (horizontalGridLine == null || horizonLineType == null) {
return;
}
horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE);
}
});
verticalLineType.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (verticalGridLine == null || verticalLineType == null) {
return;
}
verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE);
}
});
checkColorBoxVisible();
JPanel horizonLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), horizonLineType);
JPanel horizontal = new JPanel(new BorderLayout());
horizontal.add(horizonLineTypePane, BorderLayout.NORTH);
horizontal.add(horizontalColorPane, BorderLayout.CENTER);
//线型支持虚线 恢复用注释。取消注释。
// protected JPanel createGridLinePane() {
//
// Component[][] upComponent = new Component[][]{
// new Component[]{null, null},
// new Component[]{null, horizontalGridLine}
// };
// horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent);
//
// Component[][] downComponent = new Component[][]{
// new Component[]{null,null},
// new Component[]{null, verticalGridLine}
// };
// verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent);
//
// horizonLineType.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// if (horizontalGridLine == null || horizonLineType == null){
// return;
// }
// horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE);
// }
// });
//
// verticalLineType.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// if (verticalGridLine == null || verticalLineType == null){
// return;
// }
// verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE);
// }
// });
//
// checkColorBoxVisible();
//
// JPanel horizonLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), horizonLineType);
// JPanel horizontal = new JPanel(new BorderLayout());
// horizontal.add(horizonLineTypePane, BorderLayout.NORTH);
// horizontal.add(horizontalColorPane, BorderLayout.CENTER);
//
// JPanel verticalLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), verticalLineType);
// JPanel vertical = new JPanel(new BorderLayout());
// vertical.add(verticalLineTypePane, BorderLayout.NORTH);
// vertical.add(verticalColorPane, BorderLayout.CENTER);
//
// JPanel panel = new JPanel(new BorderLayout(0, 4));
// panel.add(horizontal, BorderLayout.NORTH);
// panel.add(vertical, BorderLayout.CENTER);
//
// return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
// }
JPanel verticalLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), verticalLineType);
JPanel vertical = new JPanel(new BorderLayout());
vertical.add(verticalLineTypePane, BorderLayout.NORTH);
vertical.add(verticalColorPane, BorderLayout.CENTER);
JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(horizontal, BorderLayout.NORTH);
panel.add(vertical, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
}
protected JPanel createAlertLinePane() {
alertLine = getAlertLinePane();
@ -227,13 +209,19 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
}
private void populateGridLine(VanChartRectanglePlot rectanglePlot) {
horizontalGridLine.setSelectObject(rectanglePlot.getDefaultYAxis().getMainGridColor());
verticalGridLine.setSelectObject(rectanglePlot.getDefaultXAxis().getMainGridColor());
//线型支持虚线 恢复用注释。取消注释。
// horizonLineType.setSelectedItem(rectanglePlot.getDefaultYAxis().getGridLineType());
// verticalLineType.setSelectedItem(rectanglePlot.getDefaultXAxis().getGridLineType());
VanChartAxis defaultXAxis = rectanglePlot.getDefaultXAxis();
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
if (defaultXAxis != null) {
verticalGridLine.setSelectObject(defaultXAxis.getMainGridColor());
verticalLineType.setSelectedItem(defaultXAxis.getGridLineType());
}
if (defaultYAxis != null) {
horizontalGridLine.setSelectObject(defaultYAxis.getMainGridColor());
horizonLineType.setSelectedItem(defaultYAxis.getGridLineType());
}
}
public void updateBean(Plot plot) {
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot;
@ -254,11 +242,18 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
}
private void updateGirdLine(VanChartRectanglePlot rectanglePlot) {
rectanglePlot.getDefaultYAxis().setMainGridColor(horizontalGridLine.getSelectObject());
rectanglePlot.getDefaultXAxis().setMainGridColor(verticalGridLine.getSelectObject());
//线型支持虚线 恢复用注释。取消注释。
// rectanglePlot.getDefaultYAxis().setGridLineType((LineType)horizonLineType.getSelectedItem());
// rectanglePlot.getDefaultXAxis().setGridLineType((LineType)verticalLineType.getSelectedItem());
VanChartAxis defaultXAxis = rectanglePlot.getDefaultXAxis();
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
if (defaultXAxis != null) {
defaultXAxis.setMainGridColor(verticalGridLine.getSelectObject());
defaultXAxis.setGridLineType((LineType) verticalLineType.getSelectedItem());
}
if (defaultYAxis != null) {
defaultYAxis.setMainGridColor(horizontalGridLine.getSelectObject());
defaultYAxis.setGridLineType((LineType) horizonLineType.getSelectedItem());
}
}
/**
@ -278,13 +273,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
}
private void checkColorBoxVisible() {
//线型支持虚线 恢复用注释。取消注释。
// if (horizontalColorPane != null && horizonLineType != null){
// horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE);
// }
//
// if (verticalColorPane != null && verticalLineType != null){
// verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE);
// }
if (horizontalColorPane != null && horizonLineType != null) {
horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE);
}
if (verticalColorPane != null && verticalLineType != null) {
verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE);
}
}
}

21
designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java

@ -1,11 +1,10 @@
package com.fr.van.chart.scatter.component;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.type.LineStyle;
import com.fr.stable.Constants;
import com.fr.plugin.chart.type.LineType;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.component.VanChartLineTypePane;
import java.awt.Component;
@ -17,17 +16,16 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane {
@Override
protected void createLineStyle() {
String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Normal_Line"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")};
lineStyle = new UIButtonGroup<LineStyle>(textArray, new LineStyle[]{LineStyle.NORMAL, LineStyle.CURVE});
String[] textArray = new String[]{
Toolkit.i18nText("Fine-Design_Chart_Normal_Line"),
Toolkit.i18nText("Fine-Design_Chart_CurveLine")};
lineStyle = new UIButtonGroup<>(textArray, new LineStyle[]{LineStyle.NORMAL, LineStyle.CURVE});
}
@Override
protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{
//线型支持虚线 恢复用注释。下面2行删除。
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth},
lineStyleComponent
};
}
@ -36,10 +34,7 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane {
protected VanChartAttrLine initVanChartAttrLine() {
VanChartAttrLine attrLine = new VanChartAttrLine();
//默认为无线型,且默認空值不斷開
//线型支持虚线 恢复用注释。下面1行删除。
attrLine.setLineWidth(Constants.LINE_NONE);
//线型支持虚线 恢复用注释。取消注释。
//attrLine.setLineType(LineType.NONE);
attrLine.setLineType(LineType.NONE);
attrLine.setNullValueBreak(false);
return attrLine;
}

Loading…
Cancel
Save