Browse Source

Pull request #1965: CHART-14744 箱型图单元格数据集

Merge in DESIGN/design from ~QINGHUI.LIU/design:release/10.0 to release/10.0

* commit '879cf2f2fdccab27ae1db0dc876114fb26375ba5':
  CHART-14744 结果数据使用可编辑标签
  回退代码
  解决冲突
  CHART-14744 箱型图单元格数据集
feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
55fb28553d
  1. 41
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java
  2. 4
      designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java
  3. 11
      designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportDataContentPane.java
  4. 4
      designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportResultDataSeriesPane.java
  5. 137
      designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java
  6. 38
      designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDetailedDataSeriesPane.java
  7. 168
      designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java
  8. 58
      designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxReportDefinitionHelper.java
  9. 71
      designer-chart/src/main/java/com/fr/van/chart/box/data/report/TinyFormulaWithEditLabel.java
  10. 19
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java
  11. 155
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java
  12. 86
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java

41
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java

@ -8,6 +8,7 @@ import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.stable.StringUtils;
@ -26,35 +27,35 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
protected TinyFormulaPane categoryName;
protected ChartDataFilterPane filterPane;
public CategoryPlotReportDataContentPane(){
}
public CategoryPlotReportDataContentPane(ChartDataPane parent) {
initEveryPane();
categoryName = initCategoryBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
categoryName = initCategoryBox(Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
categoryName.setPreferredSize(new Dimension(236,30));
categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,20));
this.add(categoryName, "0,0,1,0");
filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane);
panel.setBorder(getSidesBorder());
filterPane.setBorder(getFilterPaneBorder());
this.add(panel, "0,6,1,4"); }
protected TinyFormulaPane initCategoryBox(final String leftLabel) {
TinyFormulaPane categoryName = new TinyFormulaPane() {
@Override
protected void initLayout() {
this.setLayout(new BorderLayout(4, 0));
if(StringUtils.isNotEmpty(leftLabel)) {
UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
label1.setPreferredSize(new Dimension(75, 20));
this.add(label1, BorderLayout.WEST);
}
formulaTextField.setPreferredSize(new Dimension(100, 20));
this.add(formulaTextField, BorderLayout.CENTER);
this.add(formulaTextFieldButton, BorderLayout.EAST);
@ -83,15 +84,15 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
checkBoxUse();
}
});
return categoryName;
}
@Override
protected String[] columnNames() {
return new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value")
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Value")
};
}
@ -99,6 +100,10 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
checkBoxUse();
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(definition);
}
public void populateDefinition(TopDefinitionProvider definition) {
if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
if (reportDefinition.getCategoryName() != null) {
@ -109,20 +114,25 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
populateList(list);
}
}
seriesPane.doLayout();
}
filterPane.populateBean(collection);
filterPane.populateDefinition(definition, true);
}
public void updateBean(ChartCollection collection) {
collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition());
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
updateDefinition(definition);
}
public void updateDefinition(TopDefinitionProvider definition) {
if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
reportDefinition.setCategoryName(canBeFormula(categoryName.getUITextField().getText()));
List list = updateList();
@ -135,6 +145,7 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
reportDefinition.add(sd);
}
}
filterPane.updateBean(collection);
filterPane.updateDefinition(definition);
}
}

4
designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java

@ -13,7 +13,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.van.chart.box.data.BoxPlotReportDataContentPane;
import com.fr.van.chart.box.data.report.BoxPlotReportDataContentPane;
import com.fr.van.chart.box.data.table.BoxPlotTableDataContentPane;
import com.fr.van.chart.designer.other.VanChartInteractivePane;
import com.fr.van.chart.designer.other.VanChartOtherPane;
@ -50,7 +50,7 @@ public class BoxIndependentVanChartInterface extends AbstractIndependentVanChart
}
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
return new BoxPlotReportDataContentPane(parent);
return new BoxPlotReportDataContentPane(plot, parent);
}
public AbstractChartTypePane getPlotTypePane() {

11
designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportDataContentPane.java

@ -1,11 +0,0 @@
package com.fr.van.chart.box.data;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane;
public class BoxPlotReportDataContentPane extends CategoryPlotReportDataContentPane {
public BoxPlotReportDataContentPane(ChartDataPane parent) {
super(parent);
}
}

4
designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportResultDataSeriesPane.java

@ -1,4 +0,0 @@
package com.fr.van.chart.box.data;
public class BoxPlotReportResultDataSeriesPane {
}

137
designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java

@ -0,0 +1,137 @@
package com.fr.van.chart.box.data.report;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.plugin.chart.box.data.VanBoxReportDefinition;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane {
private UIButtonGroup dataType;
private BoxPlotReportDetailedDataSeriesPane detailedDataSeriesPane;
private BoxPlotReportResultDataSeriesPane resultDataSeriesPane;
private Plot initplot;
public BoxPlotReportDataContentPane(Plot plot, ChartDataPane parent) {
this.initplot = plot;
this.setLayout(new BorderLayout());
this.add(createDataTypePane(), BorderLayout.NORTH);
this.add(createSeriesPane(parent), BorderLayout.CENTER);
initDataTypeListener();
}
private JPanel createDataTypePane() {
JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
String[] names = new String[]{
Toolkit.i18nText("Fine-Design_Chart_Detailed_Data"),
Toolkit.i18nText("Fine-Design_Chart_Result_Data")
};
dataType = new UIButtonGroup(names);
dataType.setPreferredSize(new Dimension(100, 20));
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null}));
pane.setPreferredSize(new Dimension(246, 30));
pane.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15));
return pane;
}
private JPanel createSeriesPane(ChartDataPane parent) {
detailedDataSeriesPane = new BoxPlotReportDetailedDataSeriesPane(parent);
resultDataSeriesPane = new BoxPlotReportResultDataSeriesPane();
JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.add(resultDataSeriesPane, BorderLayout.NORTH);
pane.add(detailedDataSeriesPane, BorderLayout.CENTER);
return pane;
}
private void initDataTypeListener() {
dataType.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkDataPaneVisible();
}
});
}
private void checkDataPaneVisible() {
if (detailedDataSeriesPane != null) {
detailedDataSeriesPane.setVisible(dataType.getSelectedIndex() == 0);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.setVisible(dataType.getSelectedIndex() == 1);
}
}
public void updateBean(ChartCollection collection) {
collection.getSelectedChart().setFilterDefinition(new VanBoxReportDefinition());
VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(collection);
if (report != null) {
boolean isDetailed = dataType.getSelectedIndex() == 0;
report.setDetailed(isDetailed);
((VanChartBoxPlot) initplot).setDetailed(isDetailed);
}
if (detailedDataSeriesPane != null) {
detailedDataSeriesPane.updateBean(collection);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.updateBean(collection);
}
}
public void populateBean(ChartCollection collection) {
VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(collection);
if (report == null) {
dataType.setSelectedIndex(0);
checkDataPaneVisible();
return;
}
if (dataType != null) {
dataType.setSelectedIndex(BoxReportDefinitionHelper.isDetailedReportDataType(collection) ? 0 : 1);
}
if (detailedDataSeriesPane != null) {
detailedDataSeriesPane.populateBean(collection);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.populateBean(collection);
}
checkDataPaneVisible();
}
protected String[] columnNames() {
return new String[0];
}
}

38
designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDetailedDataSeriesPane.java

@ -0,0 +1,38 @@
package com.fr.van.chart.box.data.report;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane;
import com.fr.plugin.chart.box.data.VanBoxReportDefinition;
import com.fr.plugin.chart.box.data.VanBoxReportDetailedDefinition;
public class BoxPlotReportDetailedDataSeriesPane extends CategoryPlotReportDataContentPane {
public BoxPlotReportDetailedDataSeriesPane(ChartDataPane parent) {
super(parent);
}
public void populateBean(ChartCollection ob) {
VanBoxReportDetailedDefinition definition = BoxReportDefinitionHelper.getBoxReportDetailedDefinition(ob);
if (definition == null) {
return;
}
this.populateDefinition(definition);
}
public void updateBean(ChartCollection ob) {
VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(ob);
if (report == null) {
return;
}
VanBoxReportDetailedDefinition detailedDefinition = new VanBoxReportDetailedDefinition();
this.updateDefinition(detailedDefinition);
report.setDetailedDefinition(detailedDefinition);
}
}

168
designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java

@ -0,0 +1,168 @@
package com.fr.van.chart.box.data.report;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.plugin.chart.box.data.VanBoxReportDefinition;
import com.fr.plugin.chart.box.data.VanBoxReportResultDefinition;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
public class BoxPlotReportResultDataSeriesPane extends AbstractReportDataContentPane {
private TinyFormulaPane category;
private TinyFormulaPane seriesName;
private TinyFormulaWithEditLabel max;
private TinyFormulaWithEditLabel q3;
private TinyFormulaWithEditLabel median;
private TinyFormulaWithEditLabel q1;
private TinyFormulaWithEditLabel min;
public BoxPlotReportResultDataSeriesPane() {
this.setLayout(new BorderLayout());
initContentComponents();
JPanel panel = createContentPane();
panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(panel, BorderLayout.CENTER);
}
private void initContentComponents() {
category = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Category"));
seriesName = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
max = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max"));
q3 = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3"));
median = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median"));
q1 = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1"));
min = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min"));
}
private JPanel createContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] row = {p, p, p, p, p, p, p};
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{category},
new Component[]{seriesName},
new Component[]{max},
new Component[]{q3},
new Component[]{median},
new Component[]{q1},
new Component[]{min}
};
return TableLayoutHelper.createTableLayoutPane(components, row, col);
}
private TinyFormulaPane createTinyFormulaPaneWithTitle(final String title) {
return new TinyFormulaPane() {
protected void initLayout() {
this.setLayout(new BorderLayout(4, 0));
UILabel label = new UILabel(title);
label.setPreferredSize(new Dimension(75, 20));
this.add(label, BorderLayout.WEST);
formulaTextField.setPreferredSize(new Dimension(100, 20));
this.add(formulaTextField, BorderLayout.CENTER);
this.add(formulaTextFieldButton, BorderLayout.EAST);
}
};
}
private TinyFormulaWithEditLabel createTinyFormulaWithEditLabel(String title) {
return new TinyFormulaWithEditLabel(title) {
protected void clearAllBackground() {
clearAllLabelBackground();
}
};
}
private void clearAllLabelBackground() {
TinyFormulaWithEditLabel[] editLabels = new TinyFormulaWithEditLabel[]{max, q3, median, q1, min};
for (TinyFormulaWithEditLabel label : editLabels) {
if (label != null) {
label.clearBackGround();
}
}
}
public void populateBean(ChartCollection ob) {
VanBoxReportResultDefinition detailedDefinition = BoxReportDefinitionHelper.getBoxReportResultDefinition(ob);
if (detailedDefinition == null) {
return;
}
populateFormulaPane(category, detailedDefinition.getCategoryName());
populateFormulaPane(seriesName, detailedDefinition.getSeriesName());
max.setHeaderName(detailedDefinition.getMaxLabel());
q3.setHeaderName(detailedDefinition.getQ3Label());
median.setHeaderName(detailedDefinition.getMedianLabel());
q1.setHeaderName(detailedDefinition.getQ1Label());
min.setHeaderName(detailedDefinition.getMinLabel());
max.populateFormula(detailedDefinition.getMax());
q3.populateFormula(detailedDefinition.getQ3());
median.populateFormula(detailedDefinition.getMedian());
q1.populateFormula(detailedDefinition.getQ1());
min.populateFormula(detailedDefinition.getMin());
}
private void populateFormulaPane(TinyFormulaPane pane, Object ob) {
if (ob != null) {
pane.populateBean(ob.toString());
}
}
public void updateBean(ChartCollection ob) {
VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(ob);
if (report == null) {
return;
}
VanBoxReportResultDefinition resultDefinition = new VanBoxReportResultDefinition();
resultDefinition.setCategoryName(canBeFormula(category.getUITextField().getText()));
resultDefinition.setSeriesName(canBeFormula(seriesName.getUITextField().getText()));
resultDefinition.setMaxLabel(max.getHeaderName());
resultDefinition.setQ3Label(q3.getHeaderName());
resultDefinition.setMedianLabel(median.getHeaderName());
resultDefinition.setQ1Label(q1.getHeaderName());
resultDefinition.setMinLabel(min.getHeaderName());
resultDefinition.setMax(canBeFormula(max.updateFormula()));
resultDefinition.setQ3(canBeFormula(q3.updateFormula()));
resultDefinition.setMedian(canBeFormula(median.updateFormula()));
resultDefinition.setQ1(canBeFormula(q1.updateFormula()));
resultDefinition.setMin(canBeFormula(min.updateFormula()));
report.setResultDefinition(resultDefinition);
}
protected String[] columnNames() {
return new String[0];
}
}

58
designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxReportDefinitionHelper.java

@ -0,0 +1,58 @@
package com.fr.van.chart.box.data.report;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.plugin.chart.box.data.VanBoxReportDefinition;
import com.fr.plugin.chart.box.data.VanBoxReportDetailedDefinition;
import com.fr.plugin.chart.box.data.VanBoxReportResultDefinition;
public class BoxReportDefinitionHelper {
public static VanBoxReportDefinition getBoxReportDefinition(ChartCollection collection) {
if (collection != null) {
Chart chart = collection.getSelectedChart();
if (chart != null) {
TopDefinitionProvider definitionProvider = chart.getFilterDefinition();
if (definitionProvider instanceof VanBoxReportDefinition) {
return (VanBoxReportDefinition) definitionProvider;
}
}
}
return null;
}
public static VanBoxReportResultDefinition getBoxReportResultDefinition(ChartCollection collection) {
VanBoxReportDefinition report = getBoxReportDefinition(collection);
if (report != null) {
return report.getResultDefinition();
}
return null;
}
public static VanBoxReportDetailedDefinition getBoxReportDetailedDefinition(ChartCollection collection) {
VanBoxReportDefinition report = getBoxReportDefinition(collection);
if (report != null) {
return report.getDetailedDefinition();
}
return null;
}
public static boolean isDetailedReportDataType(ChartCollection collection) {
VanBoxReportDefinition report = getBoxReportDefinition(collection);
if (report != null) {
return report.isDetailed();
}
return true;
}
}

71
designer-chart/src/main/java/com/fr/van/chart/box/data/report/TinyFormulaWithEditLabel.java

@ -0,0 +1,71 @@
package com.fr.van.chart.box.data.report;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.mainframe.chart.gui.UIEditLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
public abstract class TinyFormulaWithEditLabel extends JPanel implements UIObserver {
private UIEditLabel editLabel;
private TinyFormulaPane tinyFormulaPane;
protected UIObserverListener listener;
public TinyFormulaWithEditLabel(String text) {
editLabel = new UIEditLabel(text, SwingConstants.LEFT) {
protected void doAfterMousePress() {
clearAllBackground();
}
protected boolean appendOriginalLabel() {
return false;
}
};
editLabel.setPreferredSize(new Dimension(75, 20));
tinyFormulaPane = new TinyFormulaPane();
this.setLayout(new BorderLayout(4, 0));
this.add(editLabel, BorderLayout.WEST);
this.add(tinyFormulaPane, BorderLayout.CENTER);
}
protected abstract void clearAllBackground();
public void clearBackGround() {
editLabel.resetNomalrBackground();
}
public boolean shouldResponseChangeListener() {
return true;
}
public void registerChangeListener(UIObserverListener listener) {
this.listener = listener;
editLabel.registerChangeListener(listener);
}
public void populateFormula(Object ob) {
if (ob != null) {
tinyFormulaPane.populateBean(ob.toString());
}
}
public Object updateFormula() {
return tinyFormulaPane.getUITextField().getText();
}
public String getHeaderName() {
return editLabel.getText();
}
public void setHeaderName(String text) {
editLabel.setText(text);
}
}

19
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java

@ -146,8 +146,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
}
public void updateBean(ChartCollection collection) {
checkChartCollection(collection);
collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition());
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection);
if (table != null) {
@ -168,7 +167,13 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
}
public void populateBean(ChartCollection collection) {
checkChartCollection(collection);
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection);
if (table == null) {
dataType.setSelectedIndex(0);
checkDataPaneVisible();
return;
}
if (dataType != null) {
dataType.setSelectedIndex(BoxTableDefinitionHelper.isDetailedTableDataType(collection) ? 0 : 1);
@ -186,14 +191,6 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
checkDataPaneVisible();
}
private void checkChartCollection(ChartCollection collection) {
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection);
if (table == null) {
collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition());
}
}
private void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) {
NormalTableDataDefinition detailedDefinition = BoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);

155
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java

@ -6,12 +6,12 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -24,11 +24,15 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
private UIComboBox category;
private UIComboBox seriesName;
private UIComboBox max;
private UIComboBox q3;
private UIComboBox median;
private UIComboBox q1;
private UIComboBox min;
private JPanel categoryPane;
private JPanel seriesNamePane;
private UIComboBoxWithEditLabel max;
private UIComboBoxWithEditLabel q3;
private UIComboBoxWithEditLabel median;
private UIComboBoxWithEditLabel q1;
private UIComboBoxWithEditLabel min;
public BoxPlotTableResultDataSeriesPane() {
@ -41,23 +45,49 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
}
private void initComboxSize() {
Dimension preferredSize = new Dimension(100, 20);
category = new UIComboBox();
seriesName = new UIComboBox();
max = new UIComboBox();
q3 = new UIComboBox();
median = new UIComboBox();
q1 = new UIComboBox();
min = new UIComboBox();
category.setPreferredSize(preferredSize);
seriesName.setPreferredSize(preferredSize);
max.setPreferredSize(preferredSize);
q3.setPreferredSize(preferredSize);
median.setPreferredSize(preferredSize);
q1.setPreferredSize(preferredSize);
min.setPreferredSize(preferredSize);
categoryPane = createUIComboBoxPane(category, Toolkit.i18nText("Fine-Design_Chart_Category"));
seriesNamePane = createUIComboBoxPane(seriesName, Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
max = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max"));
q3 = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3"));
median = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median"));
q1 = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1"));
min = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min"));
}
private JPanel createUIComboBoxPane(UIComboBox comboBox, String title) {
UILabel label = new UILabel(title);
label.setPreferredSize(new Dimension(75, 20));
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout(4, 0));
panel.add(label, BorderLayout.WEST);
panel.add(comboBox, BorderLayout.CENTER);
return panel;
}
private UIComboBoxWithEditLabel createUIComboBoxWithEditLabel(String title) {
return new UIComboBoxWithEditLabel(title) {
protected void clearAllBackground() {
clearAllLabelBackground();
}
};
}
private void clearAllLabelBackground() {
UIComboBoxWithEditLabel[] editLabels = new UIComboBoxWithEditLabel[]{max, q3, median, q1, min};
for (UIComboBoxWithEditLabel label : editLabels) {
if (label != null) {
label.clearBackGround();
}
}
}
private void addItemListener() {
@ -73,24 +103,23 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
private JPanel createDataSeriesPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] column = {f, COMPONENT_WIDTH};
double[] row = {p, p, p, p, p, p, p};
Component[][] components_north = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category")), category},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name")), seriesName},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")), max},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")), q3},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median")), median},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")), q1},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min")), min},
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{categoryPane},
new Component[]{seriesNamePane},
new Component[]{max},
new Component[]{q3},
new Component[]{median},
new Component[]{q1},
new Component[]{min}
};
JPanel center = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north, row, column);
center.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15));
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
return center;
return panel;
}
public void checkBoxUse(boolean hasUse) {
@ -99,21 +128,23 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(category, list);
refreshBoxItems(seriesName, list);
refreshBoxItems(max, list);
refreshBoxItems(q3, list);
refreshBoxItems(median, list);
refreshBoxItems(q1, list);
refreshBoxItems(min, list);
refreshBoxItems(max.getComboBox(), list);
refreshBoxItems(q3.getComboBox(), list);
refreshBoxItems(median.getComboBox(), list);
refreshBoxItems(q1.getComboBox(), list);
refreshBoxItems(min.getComboBox(), list);
}
public void clearAllBoxList() {
clearBoxItems(category);
clearBoxItems(seriesName);
clearBoxItems(max);
clearBoxItems(q3);
clearBoxItems(median);
clearBoxItems(q1);
clearBoxItems(min);
clearBoxItems(max.getComboBox());
clearBoxItems(q3.getComboBox());
clearBoxItems(median.getComboBox());
clearBoxItems(q1.getComboBox());
clearBoxItems(min.getComboBox());
}
public void populateBean(ChartCollection collection) {
@ -127,11 +158,18 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
combineCustomEditValue(category, definition.getCategoryName());
combineCustomEditValue(seriesName, definition.getSeriesName());
combineCustomEditValue(max, definition.getMax());
combineCustomEditValue(q3, definition.getQ3());
combineCustomEditValue(median, definition.getMedian());
combineCustomEditValue(q1, definition.getQ1());
combineCustomEditValue(min, definition.getMin());
max.populateComboBox(definition.getMax());
q3.populateComboBox(definition.getQ3());
median.populateComboBox(definition.getMedian());
q1.populateComboBox(definition.getQ1());
min.populateComboBox(definition.getMin());
max.setHeaderName(definition.getMaxLabel());
q3.setHeaderName(definition.getQ3Label());
median.setHeaderName(definition.getMedianLabel());
q1.setHeaderName(definition.getQ1Label());
min.setHeaderName(definition.getMinLabel());
}
public void updateBean(ChartCollection collection) {
@ -141,11 +179,12 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
Object resultCategory = category.getSelectedItem();
Object resultSeries = seriesName.getSelectedItem();
Object resultMax = max.getSelectedItem();
Object resultQ3 = q3.getSelectedItem();
Object resultMedian = median.getSelectedItem();
Object resultQ1 = q1.getSelectedItem();
Object resultMin = min.getSelectedItem();
Object resultMax = max.updateComboBox();
Object resultQ3 = q3.updateComboBox();
Object resultMedian = median.updateComboBox();
Object resultQ1 = q1.updateComboBox();
Object resultMin = min.updateComboBox();
if (resultCategory == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultCategory)) {
definition.setCategoryName(StringUtils.EMPTY);
@ -173,6 +212,12 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
definition.setMin(resultMin.toString());
}
definition.setMaxLabel(max.getHeaderName());
definition.setQ3Label(q3.getHeaderName());
definition.setMedianLabel(median.getHeaderName());
definition.setQ1Label(q1.getHeaderName());
definition.setMinLabel(min.getHeaderName());
table.setResultDefinition(definition);
}
}

86
designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java

@ -0,0 +1,86 @@
package com.fr.van.chart.box.data.table;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.mainframe.chart.gui.UIEditLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ItemListener;
public abstract class UIComboBoxWithEditLabel extends JPanel implements UIObserver {
private UIEditLabel editLabel;
private UIComboBox comboBox;
protected UIObserverListener listener;
public UIComboBoxWithEditLabel(String text) {
editLabel = new UIEditLabel(text, SwingConstants.LEFT) {
protected void doAfterMousePress() {
clearAllBackground();
}
protected boolean appendOriginalLabel() {
return false;
}
};
editLabel.setPreferredSize(new Dimension(75, 20));
comboBox = new UIComboBox();
this.setLayout(new BorderLayout(4, 0));
this.add(editLabel, BorderLayout.WEST);
this.add(comboBox, BorderLayout.CENTER);
}
public UIComboBox getComboBox() {
return comboBox;
}
public void setComboBox(UIComboBox comboBox) {
this.comboBox = comboBox;
}
protected void addItemListener(ItemListener aListener) {
comboBox.addItemListener(aListener);
}
protected abstract void clearAllBackground();
public void clearBackGround() {
editLabel.resetNomalrBackground();
}
public boolean shouldResponseChangeListener() {
return true;
}
public void registerChangeListener(UIObserverListener listener) {
this.listener = listener;
editLabel.registerChangeListener(listener);
}
public void populateComboBox(String value) {
if (comboBox != null) {
comboBox.setEditable(true);
comboBox.setSelectedItem(value);
comboBox.setEditable(false);
}
}
public Object updateComboBox() {
return comboBox.getSelectedItem();
}
public String getHeaderName() {
return editLabel.getText();
}
public void setHeaderName(String text) {
editLabel.setText(text);
}
}
Loading…
Cancel
Save