Browse Source

CHART-4248 refactor:分类-值仪表盘的数据面板

persist/11.0
Wim.Zhai 5 years ago
parent
commit
310ff924e1
  1. 82
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeCellDataFieldsPane.java
  2. 84
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeDataSetFieldsPane.java

82
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<GaugeColumnFieldCollection> {
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());
}
}

84
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<GaugeColumnFieldCollection> {
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());
}
}
Loading…
Cancel
Save