|
|
@ -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; |
|
|
@ -66,13 +73,10 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> { |
|
|
|
//設置大小,防止文本過長導致界面“變形”
|
|
|
|
//設置大小,防止文本過長導致界面“變形”
|
|
|
|
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)); |
|
|
@ -89,17 +93,16 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> { |
|
|
|
//警戒线设置
|
|
|
|
//警戒线设置
|
|
|
|
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}; |
|
|
@ -110,12 +113,11 @@ 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}, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -125,11 +127,11 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> { |
|
|
|
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); |
|
|
@ -138,15 +140,15 @@ 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) { |
|
|
@ -163,12 +165,18 @@ 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 (attrLineStyle != null) { |
|
|
|
|
|
|
|
alertLineStyle.setSelectedItem(attrLineStyle.getLineType()); |
|
|
|
|
|
|
|
lineWidthSpinner.setValue(attrLineStyle.getLineWidth()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (VanChartAttrHelper.isXAxis(chartAlertValue.getAxisName())) { |
|
|
|
if (VanChartAttrHelper.isXAxis(chartAlertValue.getAxisName())) { |
|
|
|
alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.BOTTOM ? 1 : 0); |
|
|
|
alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.BOTTOM ? 1 : 0); |
|
|
@ -190,12 +198,18 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> { |
|
|
|
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; |
|
|
|