From 310ff924e13a09eea893e2ef63640396df771a2e Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 7 Nov 2019 22:08:01 +0800 Subject: [PATCH] =?UTF-8?q?CHART-4248=20refactor:=E5=88=86=E7=B1=BB-?= =?UTF-8?q?=E5=80=BC=E4=BB=AA=E8=A1=A8=E7=9B=98=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fields/diff/GaugeCellDataFieldsPane.java | 82 ++++++++++++++++++ .../fields/diff/GaugeDataSetFieldsPane.java | 84 +++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeCellDataFieldsPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeDataSetFieldsPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeCellDataFieldsPane.java new file mode 100644 index 000000000..5df78ff2b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeCellDataFieldsPane.java @@ -0,0 +1,82 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/11/07. + */ +public class GaugeCellDataFieldsPane extends AbstractCellDataFieldsPane { + + private TinyFormulaPane category; + private TinyFormulaPane value; + private AbstractSingleFilterPane filterPane; + + @Override + protected void initComponents() { + category = new TinyFormulaPane(); + value = new TinyFormulaPane(); + + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Category"); + } + }; + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(createCenterPane(), BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + } + + @Override + protected JPanel createSouthPane() { + return filterPane; + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"), + Toolkit.i18nText("Fine-Design_Chart_Pointer_Value") + }; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[]{ + category, value + }; + } + + @Override + public GaugeColumnFieldCollection updateBean() { + GaugeColumnFieldCollection gauge = new GaugeColumnFieldCollection(); + updateField(category, gauge.getCategory()); + updateField(value, gauge.getValue()); + filterPane.updateBean(gauge.getCategory().getFilterProperties()); + return gauge; + } + + @Override + public void populateBean(GaugeColumnFieldCollection ob) { + populateField(category, ob.getCategory()); + populateField(value, ob.getValue()); + filterPane.populateBean(ob.getCategory().getFilterProperties()); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeDataSetFieldsPane.java new file mode 100644 index 000000000..9c09cc63c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeDataSetFieldsPane.java @@ -0,0 +1,84 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/11/07. + */ +public class GaugeDataSetFieldsPane extends AbstractDataSetFieldsPane { + + private UIComboBox category; + private UIComboBox value; + + private AbstractSingleFilterPane filterPane; + + + @Override + protected void initComponents() { + category = new UIComboBox(); + value = new UIComboBox(); + + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Category"); + } + }; + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"), + Toolkit.i18nText("Fine-Design_Chart_Pointer_Value") + }; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[]{ + category, value + }; + } + + @Override + public GaugeColumnFieldCollection updateBean() { + GaugeColumnFieldCollection gauge = new GaugeColumnFieldCollection(); + updateField(category, gauge.getCategory()); + updateField(value, gauge.getValue()); + filterPane.updateBean(gauge.getCategory().getFilterProperties()); + return gauge; + } + + @Override + public void populateBean(GaugeColumnFieldCollection ob) { + populateField(category, ob.getCategory()); + populateField(value, ob.getValue()); + filterPane.populateBean(ob.getCategory().getFilterProperties()); + } + + +}