Browse Source

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

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
bd59cb594c
  1. 50
      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. 190
      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

50
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.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup; 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.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit; 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.base.VanChartAttrLine;
import com.fr.plugin.chart.type.LineStyle; import com.fr.plugin.chart.type.LineStyle;
import com.fr.plugin.chart.type.LineType; 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 com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -30,8 +27,10 @@ import java.util.Arrays;
public class VanChartLineTypePane extends BasicPane { public class VanChartLineTypePane extends BasicPane {
private static final long serialVersionUID = -6581862503009962973L; 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 LineTypeComboBox lineTypeComboBox;//线型
private UISpinner lineWidthSpinner;//线宽 private UISpinner lineWidthSpinner;//线宽
@ -42,14 +41,14 @@ public class VanChartLineTypePane extends BasicPane {
private JPanel lineStylePane; private JPanel lineStylePane;
public VanChartLineTypePane() { public VanChartLineTypePane() {
//线型支持虚线 恢复用注释。下面1行删除。
lineWidth = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
JPanel typeAndWidthPane = createTypeAndWidthPane(); JPanel typeAndWidthPane = createTypeAndWidthPane();
createLineStyle(); 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 p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -67,8 +66,7 @@ public class VanChartLineTypePane extends BasicPane {
lineStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); lineStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
//线型支持虚线 恢复用注释。取消注释。 this.add(typeAndWidthPane, BorderLayout.NORTH);
//this.add(typeAndWidthPane, BorderLayout.NORTH);
this.add(lineStylePane, BorderLayout.CENTER); 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}); 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() { lineTypeComboBox.addActionListener(new ActionListener() {
@Override @Override
@ -117,12 +115,6 @@ public class VanChartLineTypePane extends BasicPane {
protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{ return new Component[][]{
//线型支持虚线 恢复用注释。下面5行删除。
new Component[]{null, null},
new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(lineWidth)
},
lineStyleComponent, lineStyleComponent,
nullValueBreakComponent nullValueBreakComponent
}; };
@ -141,16 +133,10 @@ public class VanChartLineTypePane extends BasicPane {
} }
public void checkLarge(boolean large) { public void checkLarge(boolean large) {
//线型支持虚线 恢复用注释。下面4行删除。
if (large) { if (large) {
lineWidth.setSelectedLineStyle(Constants.LINE_NONE); lineTypeComboBox.setSelectedItem(LineType.NONE);
} }
lineWidth.setEnabled(!large); lineTypeComboBox.setEnabled(!large);
//线型支持虚线 恢复用注释。取消注释。
// if (large) {
// lineTypeComboBox.setSelectedItem(LineType.NONE);
// }
// lineTypeComboBox.setEnabled(!large);
lineStyle.setEnabled(!large); lineStyle.setEnabled(!large);
} }
@ -162,11 +148,8 @@ public class VanChartLineTypePane extends BasicPane {
if (line == null) { if (line == null) {
line = initVanChartAttrLine(); line = initVanChartAttrLine();
} }
//线型支持虚线 恢复用注释。下面1行删除。 lineTypeComboBox.setSelectedItem(line.getLineType());
lineWidth.setSelectedLineStyle(line.getLineWidth()); lineWidthSpinner.setValue(line.getLineWidth());
//线型支持虚线 恢复用注释。取消注释。
// lineTypeComboBox.setSelectedItem(line.getLineType());
// lineWidthSpinner.setValue(line.getLineWidth());
lineStyle.setSelectedItem(line.getLineStyle()); lineStyle.setSelectedItem(line.getLineStyle());
nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1); nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1);
} }
@ -177,11 +160,8 @@ public class VanChartLineTypePane extends BasicPane {
public VanChartAttrLine update() { public VanChartAttrLine update() {
VanChartAttrLine line = new VanChartAttrLine(); VanChartAttrLine line = new VanChartAttrLine();
//线型支持虚线 恢复用注释。下面1行删除。 line.setLineType((LineType) lineTypeComboBox.getSelectedItem());
line.setLineWidth(lineWidth.getSelectedLineStyle()); line.setLineWidth(lineWidthSpinner.getValue());
//线型支持虚线 恢复用注释。取消注释。
// line.setLineType((LineType) lineTypeComboBox.getSelectedItem());
// line.setLineWidth(lineWidthSpinner.getValue());
line.setLineStyle(lineStyle.getSelectedItem()); line.setLineStyle(lineStyle.getSelectedItem());
line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0); line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0);
return line; 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; package com.fr.van.chart.designer.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import java.awt.Component; import java.awt.Component;
/** /**
@ -14,9 +11,6 @@ public class VanChartLineWidthPane extends VanChartLineTypePane {
@Override @Override
protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{ return new Component[][]{
//线型支持虚线 恢复用注释。下面2行删除。
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth},
nullValueBreakComponent 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.AttrLineStyle;
import com.fr.chart.base.LineStyleInfo; import com.fr.chart.base.LineStyleInfo;
import com.fr.design.dialog.BasicPane; 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.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; 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.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.base.TrendLineType; import com.fr.plugin.chart.base.TrendLineType;
import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.type.LineType; import com.fr.plugin.chart.type.LineType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -34,14 +32,15 @@ import java.awt.event.ActionListener;
public class VanChartTrendLinePane extends BasicPane{ public class VanChartTrendLinePane extends BasicPane{
private static final TrendLineType[] TYPES = new TrendLineType[] {TrendLineType.EXP, TrendLineType.LINE, TrendLineType.LOG, TrendLineType.POLY}; 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 UITextField trendLineName;
private ColorSelectBox trendLineColor; private ColorSelectBox trendLineColor;
private LineTypeComboBox trendLineStyle;//线型
//线型支持虚线 恢复用注释。下面1行删除。 private UISpinner lineWidthSpinner;//线宽
private LineComboBox trendLineStyle;//线型
//线型支持虚线 恢复用注释。取消注释。
// private LineTypeComboBox trendLineStyle;//线型
// private UISpinner lineWidthSpinner;//线宽
private UIComboBox trendLineType;//趋势线函数类型 private UIComboBox trendLineType;//趋势线函数类型
private UISpinner prePeriod; private UISpinner prePeriod;
@ -58,15 +57,11 @@ public class VanChartTrendLinePane extends BasicPane{
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = {p, p, p, p, p, p};
double[] col = {f, e}; double[] col = {f, e};
trendLineName = new UITextField(); trendLineName = new UITextField();
trendLineColor = new ColorSelectBox(100); trendLineColor = new ColorSelectBox(PREFERRED_WIDTH);
//线型支持虚线 恢复用注释。下面1行删除。 trendLineStyle = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
trendLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE); lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
//线型支持虚线 恢复用注释。取消注释。
// trendLineStyle = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
// lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2);
trendLineType = new UIComboBox(TYPES); trendLineType = new UIComboBox(TYPES);
prePeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0); prePeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
afterPeriod = 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")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Period"));
label.setVerticalAlignment(SwingConstants.TOP); label.setVerticalAlignment(SwingConstants.TOP);
//线型支持虚线 恢复用注释。开始删除。
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName},
new Component[]{ new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle) 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_Color")), trendLineColor},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType},
new Component[]{label, periodPane} new Component[]{label, periodPane}
}; };
//线型支持虚线 恢复用注释。结束删除。
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p,p,p}, col);
//线型支持虚线 恢复用注释。取消注释。 trendLineHidePane = TableLayout4VanChartHelper.createGapTableLayoutPane(componentsMayHide, new double[]{p,p,p,p}, col);
// 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);
trendLineStyle.addActionListener(new ActionListener() { trendLineStyle.addActionListener(new ActionListener() {
@Override @Override
@ -129,8 +108,7 @@ public class VanChartTrendLinePane extends BasicPane{
checkHidePaneVisible(); checkHidePaneVisible();
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
//线型支持虚线 恢复用注释。取消注释。 this.add(trendLineHidePane, BorderLayout.SOUTH);
//this.add(trendLineHidePane, BorderLayout.SOUTH);
} }
protected String title4PopupWindow(){ protected String title4PopupWindow(){
@ -142,12 +120,14 @@ public class VanChartTrendLinePane extends BasicPane{
if(trendLine != null){ if(trendLine != null){
trendLineName.setText(trendLine.getTrendLineName()); trendLineName.setText(trendLine.getTrendLineName());
LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo(); LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo();
AttrLineStyle attrLineStyle = lineStyleInfo.getAttrLineStyle();
if (attrLineStyle != null) {
trendLineStyle.setSelectedItem(attrLineStyle.getLineType());
lineWidthSpinner.setValue(attrLineStyle.getLineWidth());
}
trendLineColor.setSelectObject(lineStyleInfo.getAttrLineColor().getSeriesColor()); 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()); trendLineType.setSelectedItem(trendLine.getTrendLineType());
prePeriod.setValue(trendLine.getPrePeriod()); prePeriod.setValue(trendLine.getPrePeriod());
afterPeriod.setValue(trendLine.getAfterPeriod()); afterPeriod.setValue(trendLine.getAfterPeriod());
@ -159,11 +139,13 @@ public class VanChartTrendLinePane extends BasicPane{
trendLine.setTrendLineName(trendLineName.getText()); trendLine.setTrendLineName(trendLineName.getText());
LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo(); LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo();
//线型支持虚线 恢复用注释。下面1行删除。 AttrLineStyle attrLineStyle = lineStyleInfo.getAttrLineStyle();
lineStyleInfo.setAttrLineStyle(new AttrLineStyle(trendLineStyle.getSelectedLineStyle()));
//线型支持虚线 恢复用注释。取消注释。 if (attrLineStyle != null) {
// lineStyleInfo.getAttrLineStyle().setLineWidth(lineWidthSpinner.getValue()); attrLineStyle.setLineWidth(lineWidthSpinner.getValue());
// lineStyleInfo.getAttrLineStyle().setLineType((LineType) trendLineStyle.getSelectedItem()); attrLineStyle.setLineType((LineType) trendLineStyle.getSelectedItem());
}
lineStyleInfo.setAttrLineColor(new AttrColor(trendLineColor.getSelectObject())); lineStyleInfo.setAttrLineColor(new AttrColor(trendLineColor.getSelectObject()));
trendLine.setTrendLineType((TrendLineType) trendLineType.getSelectedItem()); 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.BaseFormula;
import com.fr.base.Utils; 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.beans.BasicBeanPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup; 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.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; 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.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -18,9 +21,10 @@ import com.fr.general.FRFont;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; 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.Constants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JPanel; 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 VALUE_WD = 100;
private static final int TEXT_WD = 200; private static final int TEXT_WD = 200;
private static final long serialVersionUID = -1208941770684286439L; 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; private UIButtonGroup alertAxis;
protected TinyFormulaPane alertValue; protected TinyFormulaPane alertValue;
//线型支持虚线 恢复用注释。下面1行删除。 protected LineTypeComboBox alertLineStyle;//线型
protected LineComboBox alertLineStyle; private UISpinner lineWidthSpinner;//线宽
//线型支持虚线 恢复用注释。取消注释。
// protected LineTypeComboBox alertLineStyle;//线型
// private UISpinner lineWidthSpinner;//线宽
protected ColorSelectBox alertLineColor; protected ColorSelectBox alertLineColor;
private UIButtonGroup alertTextPosition; private UIButtonGroup alertTextPosition;
@ -56,23 +63,20 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private VanChartAlertValue chartAlertValue; private VanChartAlertValue chartAlertValue;
public VanChartAlertValuePane(){ public VanChartAlertValuePane() {
initComponents(); initComponents();
} }
private void initComponents(){ private void initComponents() {
alertValue = new TinyFormulaPane(); alertValue = new TinyFormulaPane();
//設置大小,防止文本過長導致界面“變形” //設置大小,防止文本過長導致界面“變形”
alertValue.setPreferredSize(new Dimension(VALUE_WD, HT)); alertValue.setPreferredSize(new Dimension(VALUE_WD, HT));
//线型支持虚线 恢复用注释。下面1行删除。 alertLineStyle = new LineTypeComboBox(new LineType[]{LineType.NORMAL, LineType.DASH});
alertLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE); lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE);
//线型支持虚线 恢复用注释。取消注释。 alertLineColor = new ColorSelectBox(PREFERRED_WIDTH);
// alertLineStyle = new LineTypeComboBox(new LineType[]{LineType.NORMAL, LineType.DASH}); alertTextPosition = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")});
// 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")});
alertText = new TinyFormulaPane(); alertText = new TinyFormulaPane();
//設置大小,防止文本過長導致界面“變形” //設置大小,防止文本過長導致界面“變形”
alertText.setPreferredSize(new Dimension(TEXT_WD, HT)); 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.removeAll();
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
//警戒线设置 //警戒线设置
JPanel top = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel top = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(top); 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()); top.add(createTopPane());
//提示文字 //提示文字
JPanel bottom = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel bottom = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(bottom); 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()); bottom.add(createBottomPane());
} }
protected JPanel createTopPane() protected JPanel createTopPane() {
{
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {p,p}; double[] columnSize = {p, p};
double[] rowSize = {p,p,p,p,p}; double[] rowSize = {p, p, p, p, p};
Component[][] components = getTopPaneComponents(); Component[][] components = getTopPaneComponents();
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -110,26 +113,25 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
protected Component[][] getTopPaneComponents() { protected Component[][] getTopPaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),alertAxis}, new Component[]{new UILabel(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(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(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), alertLineStyle},
//线型支持虚线 恢复用注释。取消注释。 new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), lineWidthSpinner},
//new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Width")), lineWidthSpinner}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), alertLineColor},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),alertLineColor},
}; };
} }
private JPanel createBottomPane(){ private JPanel createBottomPane() {
alertTextPosition.setSelectedIndex(0); alertTextPosition.setSelectedIndex(0);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {p,p}; double[] columnSize = {p, p};
double[] rowSize = {p,p,p,p,p}; double[] rowSize = {p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),alertTextPosition}, new Component[]{new UILabel(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(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(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(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_Color")), fontColor},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -137,20 +139,20 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private void checkPositionPane() { private void checkPositionPane() {
boolean selectXAxis = VanChartAttrHelper.isXAxis(alertAxis.getSelectedItem().toString()); boolean selectXAxis = VanChartAttrHelper.isXAxis(alertAxis.getSelectedItem().toString());
if(selectXAxis){ 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")}); alertTextPosition = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")});
} else { } 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(); doLayoutPane();
} }
protected String title4PopupWindow(){ protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line"); return Toolkit.i18nText("Fine-Design_Chart_Alert_Line");
} }
public void populateBean(VanChartAlertValue chartAlertValue){ public void populateBean(VanChartAlertValue chartAlertValue) {
this.chartAlertValue =chartAlertValue; this.chartAlertValue = chartAlertValue;
alertAxis = new UIButtonGroup(chartAlertValue.getAxisNamesArray(), chartAlertValue.getAxisNamesArray()); alertAxis = new UIButtonGroup(chartAlertValue.getAxisNamesArray(), chartAlertValue.getAxisNamesArray());
alertAxis.setSelectedItem(chartAlertValue.getAxisName()); alertAxis.setSelectedItem(chartAlertValue.getAxisName());
alertAxis.addChangeListener(new ChangeListener() { alertAxis.addChangeListener(new ChangeListener() {
@ -163,14 +165,20 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
checkPositionPane(); checkPositionPane();
alertValue.populateBean(Utils.objectToString(chartAlertValue.getAlertValueFormula())); alertValue.populateBean(Utils.objectToString(chartAlertValue.getAlertValueFormula()));
//线型支持虚线 恢复用注释。下面1行删除。
alertLineStyle.setSelectedLineStyle(chartAlertValue.getLineStyle().getLineStyle()); AttrColor attrColor = chartAlertValue.getLineColor();
//线型支持虚线 恢复用注释。取消注释。 AttrLineStyle attrLineStyle = chartAlertValue.getLineStyle();
// alertLineStyle.setSelectedItem(chartAlertValue.getLineStyle().getLineType());
// lineWidthSpinner.setValue(chartAlertValue.getLineStyle().getLineWidth()); if (attrColor != null) {
alertLineColor.setSelectObject(chartAlertValue.getLineColor().getSeriesColor()); alertLineColor.setSelectObject(attrColor.getSeriesColor());
}
if(VanChartAttrHelper.isXAxis(chartAlertValue.getAxisName())){
if (attrLineStyle != null) {
alertLineStyle.setSelectedItem(attrLineStyle.getLineType());
lineWidthSpinner.setValue(attrLineStyle.getLineWidth());
}
if (VanChartAttrHelper.isXAxis(chartAlertValue.getAxisName())) {
alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.BOTTOM ? 1 : 0); alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.BOTTOM ? 1 : 0);
} else { } else {
alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.LEFT ? 0 : 1); alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.LEFT ? 0 : 1);
@ -186,16 +194,22 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
fontColor.setSelectObject(chartAlertValue.getAlertFont().getForeground()); fontColor.setSelectObject(chartAlertValue.getAlertFont().getForeground());
} }
public VanChartAlertValue updateBean(){ public VanChartAlertValue updateBean() {
chartAlertValue.setAxisName(alertAxis.getSelectedItem().toString()); chartAlertValue.setAxisName(alertAxis.getSelectedItem().toString());
chartAlertValue.setAlertValueFormula(BaseFormula.createFormulaBuilder().build(alertValue.updateBean())); chartAlertValue.setAlertValueFormula(BaseFormula.createFormulaBuilder().build(alertValue.updateBean()));
chartAlertValue.getLineColor().setSeriesColor(alertLineColor.getSelectObject());
//线型支持虚线 恢复用注释。下面1行删除。 AttrColor attrColor = chartAlertValue.getLineColor();
chartAlertValue.getLineStyle().setLineStyle(alertLineStyle.getSelectedLineStyle()); AttrLineStyle attrLineStyle = chartAlertValue.getLineStyle();
//线型支持虚线 恢复用注释。取消注释。
// chartAlertValue.getLineStyle().setLineType((LineType) alertLineStyle.getSelectedItem()); if (attrColor != null) {
// chartAlertValue.getLineStyle().setLineWidth(lineWidthSpinner.getValue()); attrColor.setSeriesColor(alertLineColor.getSelectObject());
}
if (attrLineStyle != null) {
attrLineStyle.setLineType((LineType) alertLineStyle.getSelectedItem());
attrLineStyle.setLineWidth(lineWidthSpinner.getValue());
}
String contentString = alertText.updateBean(); String contentString = alertText.updateBean();
Object contentObj; Object contentObj;
@ -210,7 +224,7 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
int size = Utils.objectToNumber(fontSize.getSelectedItem(), true).intValue(); int size = Utils.objectToNumber(fontSize.getSelectedItem(), true).intValue();
Color color = fontColor.getSelectObject(); Color color = fontColor.getSelectObject();
chartAlertValue.setAlertFont(FRFont.getInstance(name, Font.PLAIN, size, color)); 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); chartAlertValue.setAlertPosition(alertTextPosition.getSelectedIndex() == 0 ? Constants.TOP : Constants.BOTTOM);
} else { } else {
chartAlertValue.setAlertPosition(alertTextPosition.getSelectedIndex() == 0 ? Constants.LEFT : Constants.RIGHT); chartAlertValue.setAlertPosition(alertTextPosition.getSelectedIndex() == 0 ? Constants.LEFT : Constants.RIGHT);

190
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.design.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper; 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.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.type.LineType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -20,7 +23,6 @@ import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Arrays;
/** /**
* 样式-背景-绘图区背景-坐标轴图表特有间隔背景网格线警戒线 * 样式-背景-绘图区背景-坐标轴图表特有间隔背景网格线警戒线
@ -28,6 +30,8 @@ import java.util.Arrays;
public class VanChartAxisAreaPane extends BasicBeanPane<Plot> { public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private static final long serialVersionUID = -1880497996650835504L; private static final long serialVersionUID = -1880497996650835504L;
private static final int PREFERRED_WIDTH = 100;
protected ColorSelectBox horizontalGridLine; protected ColorSelectBox horizontalGridLine;
protected ColorSelectBox verticalGridLine; protected ColorSelectBox verticalGridLine;
@ -40,22 +44,20 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private ColorSelectBox verticalColorBackground; private ColorSelectBox verticalColorBackground;
protected BackgroundListControlPane customIntervalBackground; protected BackgroundListControlPane customIntervalBackground;
//线型支持虚线 恢复用注释。取消注释。 private LineTypeComboBox horizonLineType;//横向线型
// private LineTypeComboBox horizonLineType;//横向线型 private LineTypeComboBox verticalLineType;//纵向线型
// private LineTypeComboBox verticalLineType;//纵向线型 private JPanel horizontalColorPane;
// private JPanel horizontalColorPane; private JPanel verticalColorPane;
// private JPanel verticalColorPane;
public VanChartAxisAreaPane() { public VanChartAxisAreaPane() {
initComponents(); initComponents();
} }
protected void initComponents() { protected void initComponents() {
horizontalGridLine = new ColorSelectBox(100); horizontalGridLine = new ColorSelectBox(PREFERRED_WIDTH);
verticalGridLine = new ColorSelectBox(100); verticalGridLine = new ColorSelectBox(PREFERRED_WIDTH);
//线型支持虚线 恢复用注释。取消注释。 horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
// horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH}); verticalLineType = 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 p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -74,78 +76,58 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }
//线型支持虚线 恢复用注释。删除下面方法。
protected JPanel createGridLinePane() { protected JPanel createGridLinePane() {
horizontalGridLine = new ColorSelectBox(100);
verticalGridLine = new ColorSelectBox(100); Component[][] upComponent = new Component[][]{
Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal")), horizontalGridLine}, new Component[]{null, horizontalGridLine}
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")), verticalGridLine},
}; };
double p = TableLayout.PREFERRED; horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent);
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; Component[][] downComponent = new Component[][]{
double[] row = new double[components.length]; new Component[]{null, null},
Arrays.fill(row, p); new Component[]{null, verticalGridLine}
double[] col = {f, e}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
} 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));
// protected JPanel createGridLinePane() { panel.add(horizontal, BorderLayout.NORTH);
// panel.add(vertical, BorderLayout.CENTER);
// Component[][] upComponent = new Component[][]{
// new Component[]{null, null}, return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
// 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);
// }
protected JPanel createAlertLinePane() { protected JPanel createAlertLinePane() {
alertLine = getAlertLinePane(); alertLine = getAlertLinePane();
@ -227,13 +209,19 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
} }
private void populateGridLine(VanChartRectanglePlot rectanglePlot) { private void populateGridLine(VanChartRectanglePlot rectanglePlot) {
horizontalGridLine.setSelectObject(rectanglePlot.getDefaultYAxis().getMainGridColor()); VanChartAxis defaultXAxis = rectanglePlot.getDefaultXAxis();
verticalGridLine.setSelectObject(rectanglePlot.getDefaultXAxis().getMainGridColor()); VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
//线型支持虚线 恢复用注释。取消注释。
// horizonLineType.setSelectedItem(rectanglePlot.getDefaultYAxis().getGridLineType());
// verticalLineType.setSelectedItem(rectanglePlot.getDefaultXAxis().getGridLineType());
}
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) { public void updateBean(Plot plot) {
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot;
@ -254,11 +242,18 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
} }
private void updateGirdLine(VanChartRectanglePlot rectanglePlot) { private void updateGirdLine(VanChartRectanglePlot rectanglePlot) {
rectanglePlot.getDefaultYAxis().setMainGridColor(horizontalGridLine.getSelectObject()); VanChartAxis defaultXAxis = rectanglePlot.getDefaultXAxis();
rectanglePlot.getDefaultXAxis().setMainGridColor(verticalGridLine.getSelectObject()); VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
//线型支持虚线 恢复用注释。取消注释。
// rectanglePlot.getDefaultYAxis().setGridLineType((LineType)horizonLineType.getSelectedItem()); if (defaultXAxis != null) {
// rectanglePlot.getDefaultXAxis().setGridLineType((LineType)verticalLineType.getSelectedItem()); 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() { private void checkColorBoxVisible() {
//线型支持虚线 恢复用注释。取消注释。 if (horizontalColorPane != null && horizonLineType != null) {
// if (horizontalColorPane != null && horizonLineType != null){ horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE);
// horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE); }
// }
// if (verticalColorPane != null && verticalLineType != null) {
// if (verticalColorPane != null && verticalLineType != null){ verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE);
// 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; package com.fr.van.chart.scatter.component;
import com.fr.design.gui.ibutton.UIButtonGroup; 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.base.VanChartAttrLine;
import com.fr.plugin.chart.type.LineStyle; 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 com.fr.van.chart.designer.component.VanChartLineTypePane;
import java.awt.Component; import java.awt.Component;
@ -17,17 +16,16 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane {
@Override @Override
protected void createLineStyle() { protected void createLineStyle() {
String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Normal_Line"), String[] textArray = new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; Toolkit.i18nText("Fine-Design_Chart_Normal_Line"),
lineStyle = new UIButtonGroup<LineStyle>(textArray, new LineStyle[]{LineStyle.NORMAL, LineStyle.CURVE}); Toolkit.i18nText("Fine-Design_Chart_CurveLine")};
lineStyle = new UIButtonGroup<>(textArray, new LineStyle[]{LineStyle.NORMAL, LineStyle.CURVE});
} }
@Override @Override
protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
return new Component[][]{ return new Component[][]{
//线型支持虚线 恢复用注释。下面2行删除。
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth},
lineStyleComponent lineStyleComponent
}; };
} }
@ -36,10 +34,7 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane {
protected VanChartAttrLine initVanChartAttrLine() { protected VanChartAttrLine initVanChartAttrLine() {
VanChartAttrLine attrLine = new VanChartAttrLine(); VanChartAttrLine attrLine = new VanChartAttrLine();
//默认为无线型,且默認空值不斷開 //默认为无线型,且默認空值不斷開
//线型支持虚线 恢复用注释。下面1行删除。 attrLine.setLineType(LineType.NONE);
attrLine.setLineWidth(Constants.LINE_NONE);
//线型支持虚线 恢复用注释。取消注释。
//attrLine.setLineType(LineType.NONE);
attrLine.setNullValueBreak(false); attrLine.setNullValueBreak(false);
return attrLine; return attrLine;
} }

Loading…
Cancel
Save