Qinghui.Liu
4 years ago
6 changed files with 354 additions and 2 deletions
@ -0,0 +1,11 @@ |
|||||||
|
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); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,4 @@ |
|||||||
|
package com.fr.van.chart.box.data; |
||||||
|
|
||||||
|
public class BoxPlotReportResultDataSeriesPane { |
||||||
|
} |
@ -0,0 +1,141 @@ |
|||||||
|
package com.fr.van.chart.box.data; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||||
|
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.Component; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane { |
||||||
|
|
||||||
|
private UIButtonGroup dataType; |
||||||
|
private JPanel detailedDataPane; |
||||||
|
private JPanel resultDataPane; |
||||||
|
|
||||||
|
public BoxPlotTableDataContentPane(ChartDataPane parent) { |
||||||
|
|
||||||
|
this.setLayout(new BorderLayout()); |
||||||
|
|
||||||
|
this.add(createDataTypePane(), BorderLayout.NORTH); |
||||||
|
this.add(createDetailDataPane(parent), BorderLayout.CENTER); |
||||||
|
this.add(createResultDataPane(parent), BorderLayout.SOUTH); |
||||||
|
|
||||||
|
initDataTypeListener(); |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createDataTypePane() { |
||||||
|
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); |
||||||
|
|
||||||
|
String[] names = new String[]{ |
||||||
|
Toolkit.i18nText("Fine-Design_Chart_Detailed_Data"), |
||||||
|
Toolkit.i18nText("Fine-Design_Chart_Result_Data") |
||||||
|
}; |
||||||
|
|
||||||
|
dataType = new UIButtonGroup(names); |
||||||
|
|
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
|
||||||
|
double[] column = {p, f}; |
||||||
|
double[] row = {p, p}; |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{null, null}, |
||||||
|
new Component[]{label, dataType}, |
||||||
|
new Component[]{null, null} |
||||||
|
}; |
||||||
|
|
||||||
|
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createDetailDataPane(ChartDataPane parent) { |
||||||
|
detailedDataPane = new BoxPlotTableDetailedDataSeriesPane(parent); |
||||||
|
|
||||||
|
return detailedDataPane; |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createResultDataPane(ChartDataPane parent) { |
||||||
|
resultDataPane = new BoxPlotTableResultDataSeriesPane(parent); |
||||||
|
|
||||||
|
return resultDataPane; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void initDataTypeListener() { |
||||||
|
dataType.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
checkDataPaneVisible(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkDataPaneVisible() { |
||||||
|
if (detailedDataPane != null) { |
||||||
|
detailedDataPane.setVisible(dataType.getSelectedIndex() == 0); |
||||||
|
} |
||||||
|
if (resultDataPane != null) { |
||||||
|
resultDataPane.setVisible(dataType.getSelectedIndex() == 1); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void checkBoxUse(boolean hasUse) { |
||||||
|
if (dataType.getSelectedIndex() == 0 && detailedDataPane != null) { |
||||||
|
((BoxPlotTableDetailedDataSeriesPane) detailedDataPane).checkBoxUse(hasUse); |
||||||
|
} |
||||||
|
if (dataType.getSelectedIndex() == 1 && resultDataPane != null) { |
||||||
|
((BoxPlotTableResultDataSeriesPane) resultDataPane).checkBoxUse(hasUse); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void refreshBoxListWithSelectTableData(List list) { |
||||||
|
if (dataType.getSelectedIndex() == 0 && detailedDataPane != null) { |
||||||
|
((BoxPlotTableDetailedDataSeriesPane) detailedDataPane).refreshBoxListWithSelectTableData(list); |
||||||
|
} |
||||||
|
if (dataType.getSelectedIndex() == 1 && resultDataPane != null) { |
||||||
|
((BoxPlotTableResultDataSeriesPane) resultDataPane).refreshBoxListWithSelectTableData(list); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void clearAllBoxList() { |
||||||
|
if (dataType.getSelectedIndex() == 0 && detailedDataPane != null) { |
||||||
|
((BoxPlotTableDetailedDataSeriesPane) detailedDataPane).clearAllBoxList(); |
||||||
|
} |
||||||
|
if (dataType.getSelectedIndex() == 1 && resultDataPane != null) { |
||||||
|
((BoxPlotTableResultDataSeriesPane) resultDataPane).clearAllBoxList(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void updateBean(ChartCollection collection) { |
||||||
|
if (dataType.getSelectedIndex() == 0 && detailedDataPane != null) { |
||||||
|
((BoxPlotTableDetailedDataSeriesPane) detailedDataPane).updateBean(collection); |
||||||
|
} |
||||||
|
if (dataType.getSelectedIndex() == 1 && resultDataPane != null) { |
||||||
|
((BoxPlotTableResultDataSeriesPane) resultDataPane).updateBean(collection); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void populateBean(ChartCollection collection) { |
||||||
|
if (detailedDataPane != null) { |
||||||
|
((BoxPlotTableDetailedDataSeriesPane) detailedDataPane).populateBean(collection); |
||||||
|
} |
||||||
|
if (resultDataPane != null) { |
||||||
|
((BoxPlotTableResultDataSeriesPane) resultDataPane).populateBean(collection); |
||||||
|
} |
||||||
|
|
||||||
|
dataType.setSelectedIndex(isDetailedDataType(collection) ? 0 : 1); |
||||||
|
} |
||||||
|
|
||||||
|
private boolean isDetailedDataType(ChartCollection collection) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.fr.van.chart.box.data; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class BoxPlotTableDetailedDataSeriesPane extends CategoryPlotTableDataContentPane { |
||||||
|
|
||||||
|
public BoxPlotTableDetailedDataSeriesPane(ChartDataPane parent) { |
||||||
|
super(parent); |
||||||
|
} |
||||||
|
|
||||||
|
public void refreshBoxListWithSelectTableData(List list) { |
||||||
|
refreshBoxItems(categoryCombox, list); |
||||||
|
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||||
|
|
||||||
|
seriesTypeComboxPane.refreshBoxListWithSelectTableData(list); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,163 @@ |
|||||||
|
package com.fr.van.chart.box.data; |
||||||
|
|
||||||
|
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||||
|
import com.fr.chart.base.ChartConstants; |
||||||
|
import com.fr.chart.chartattr.BubblePlot; |
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
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.mainframe.chart.gui.ChartDataPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||||
|
import com.fr.plugin.chart.box.VanChartBoxPlot; |
||||||
|
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; |
||||||
|
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; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.Component; |
||||||
|
import java.awt.Dimension; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPane { |
||||||
|
|
||||||
|
private UIComboBox seriesName; |
||||||
|
private UIComboBox max; |
||||||
|
private UIComboBox median; |
||||||
|
private UIComboBox min; |
||||||
|
|
||||||
|
private ChartDataFilterPane dataScreeningPane; |
||||||
|
|
||||||
|
public BoxPlotTableResultDataSeriesPane(ChartDataPane parent) { |
||||||
|
|
||||||
|
initComboxSize(); |
||||||
|
|
||||||
|
this.setLayout(new BorderLayout()); |
||||||
|
|
||||||
|
this.add(createCenterPane(), BorderLayout.CENTER); |
||||||
|
this.add(createSouthPane(parent), BorderLayout.SOUTH); |
||||||
|
|
||||||
|
seriesName.addItemListener(tooltipListener); |
||||||
|
max.addItemListener(tooltipListener); |
||||||
|
median.addItemListener(tooltipListener); |
||||||
|
min.addItemListener(tooltipListener); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComboxSize() { |
||||||
|
Dimension preferredSize = new Dimension(100, 20); |
||||||
|
|
||||||
|
seriesName = new UIComboBox(); |
||||||
|
max = new UIComboBox(); |
||||||
|
median = new UIComboBox(); |
||||||
|
min = new UIComboBox(); |
||||||
|
|
||||||
|
seriesName.setPreferredSize(preferredSize); |
||||||
|
max.setPreferredSize(preferredSize); |
||||||
|
median.setPreferredSize(preferredSize); |
||||||
|
min.setPreferredSize(preferredSize); |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createCenterPane() { |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
|
||||||
|
double[] column = {f, COMPONENT_WIDTH}; |
||||||
|
double[] row = {p, p, p, p}; |
||||||
|
|
||||||
|
Component[][] components_north = new Component[][]{ |
||||||
|
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_Median")), median}, |
||||||
|
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")), min}, |
||||||
|
}; |
||||||
|
|
||||||
|
JPanel center = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north, row, column); |
||||||
|
center.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15)); |
||||||
|
|
||||||
|
return center; |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createSouthPane(ChartDataPane parent) { |
||||||
|
dataScreeningPane = new ChartDataFilterPane(new VanChartBoxPlot(), parent); |
||||||
|
|
||||||
|
JPanel south = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), dataScreeningPane); |
||||||
|
south.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); |
||||||
|
|
||||||
|
return south; |
||||||
|
} |
||||||
|
|
||||||
|
public void checkBoxUse(boolean hasUse) { |
||||||
|
} |
||||||
|
|
||||||
|
protected void refreshBoxListWithSelectTableData(List list) { |
||||||
|
refreshBoxItems(seriesName, list); |
||||||
|
refreshBoxItems(max, list); |
||||||
|
refreshBoxItems(median, list); |
||||||
|
refreshBoxItems(min, list); |
||||||
|
} |
||||||
|
|
||||||
|
public void clearAllBoxList() { |
||||||
|
clearBoxItems(seriesName); |
||||||
|
clearBoxItems(max); |
||||||
|
clearBoxItems(median); |
||||||
|
clearBoxItems(min); |
||||||
|
} |
||||||
|
|
||||||
|
public void populateBean(ChartCollection collection) { |
||||||
|
super.populateBean(collection); |
||||||
|
|
||||||
|
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); |
||||||
|
|
||||||
|
if (!(top instanceof VanBoxTableDefinition)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
VanBoxTableDefinition definition = (VanBoxTableDefinition) top; |
||||||
|
|
||||||
|
combineCustomEditValue(seriesName, definition.getSeriesName()); |
||||||
|
combineCustomEditValue(max, definition.getMax()); |
||||||
|
combineCustomEditValue(median, definition.getMedian()); |
||||||
|
combineCustomEditValue(median, definition.getMin()); |
||||||
|
|
||||||
|
dataScreeningPane.populateBean(collection); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateBean(ChartCollection collection) { |
||||||
|
VanBoxTableDefinition definition = new VanBoxTableDefinition(); |
||||||
|
|
||||||
|
collection.getSelectedChart().setFilterDefinition(definition); |
||||||
|
|
||||||
|
Object resultName = seriesName.getSelectedItem(); |
||||||
|
Object resultMax = max.getSelectedItem(); |
||||||
|
Object resultMedian = median.getSelectedItem(); |
||||||
|
Object resultMin = min.getSelectedItem(); |
||||||
|
|
||||||
|
if (resultName == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultName)) { |
||||||
|
definition.setSeriesName(StringUtils.EMPTY); |
||||||
|
} else { |
||||||
|
definition.setSeriesName(resultName.toString()); |
||||||
|
} |
||||||
|
|
||||||
|
if (resultMax != null) { |
||||||
|
definition.setMax(resultMax.toString()); |
||||||
|
} |
||||||
|
if (resultMedian != null) { |
||||||
|
definition.setMedian(resultMedian.toString()); |
||||||
|
} |
||||||
|
if (resultMin != null) { |
||||||
|
definition.setMin(resultMin.toString()); |
||||||
|
} |
||||||
|
|
||||||
|
dataScreeningPane.updateBean(collection); |
||||||
|
} |
||||||
|
|
||||||
|
public void redoLayoutPane() { |
||||||
|
dataScreeningPane.relayoutPane(this.isNeedSummaryCaculateMethod()); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue