Browse Source

CHART-14744 箱型图单元格数据集

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
f92697c91e
  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. 133
      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. 19
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.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;
@ -27,35 +28,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(246,30));
categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,7));
this.add(categoryName, "0,0,2,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,2,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);
@ -84,15 +85,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")
};
}
@ -100,6 +101,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) {
@ -110,20 +115,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();
@ -136,6 +146,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);
}
}

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

@ -0,0 +1,133 @@
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 TinyFormulaPane max;
private TinyFormulaPane q3;
private TinyFormulaPane median;
private TinyFormulaPane q1;
private TinyFormulaPane 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 = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Max"));
q3 = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Q3"));
median = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Median"));
q1 = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Q1"));
min = createTinyFormulaPaneWithTitle(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);
}
};
}
public void populateBean(ChartCollection ob) {
VanBoxReportResultDefinition detailedDefinition = BoxReportDefinitionHelper.getBoxReportResultDefinition(ob);
if (detailedDefinition == null) {
return;
}
populateFormulaPane(category, detailedDefinition.getCategoryName());
populateFormulaPane(seriesName, detailedDefinition.getSeriesName());
populateFormulaPane(max, detailedDefinition.getMax());
populateFormulaPane(q3, detailedDefinition.getQ3());
populateFormulaPane(median, detailedDefinition.getMedian());
populateFormulaPane(q1, detailedDefinition.getQ1());
populateFormulaPane(min, 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.setMax(canBeFormula(max.getUITextField().getText()));
resultDefinition.setQ3(canBeFormula(q3.getUITextField().getText()));
resultDefinition.setMedian(canBeFormula(median.getUITextField().getText()));
resultDefinition.setQ1(canBeFormula(q1.getUITextField().getText()));
resultDefinition.setMin(canBeFormula(min.getUITextField().getText()));
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;
}
}

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);

Loading…
Cancel
Save