Browse Source
* commit 'a90b3a756ed736350af22a583137237cdc49c759': 数据集数据流程 完善面板结构 整理数据集数据 填充数据集数据界面 整理箱型图数据点提示 CHART-11549 初始化箱型图界面research/11.0
superman
4 years ago
24 changed files with 1093 additions and 114 deletions
@ -0,0 +1,97 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.condition.ConditionAttributesPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.mainframe.chart.AbstractChartAttrPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
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.table.BoxPlotTableDataContentPane; |
||||
import com.fr.van.chart.designer.other.VanChartInteractivePane; |
||||
import com.fr.van.chart.designer.other.VanChartOtherPane; |
||||
import com.fr.van.chart.designer.other.zoom.ZoomPane; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
public class BoxIndependentVanChartInterface extends AbstractIndependentVanChartUI { |
||||
|
||||
public String getName() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_New_Box"); |
||||
} |
||||
|
||||
public String[] getSubName() { |
||||
return new String[]{ |
||||
Toolkit.i18nText("Fine-Design_Chart_New_Box") |
||||
}; |
||||
} |
||||
|
||||
public String[] getDemoImagePath() { |
||||
return new String[]{ |
||||
"com/fr/plugin/chart/demo/image/box.png" |
||||
}; |
||||
} |
||||
|
||||
public String getIconPath() { |
||||
return "com/fr/design/images/form/toolbar/box.png"; |
||||
} |
||||
|
||||
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { |
||||
return new BoxPlotTableDataContentPane(plot, parent); |
||||
} |
||||
|
||||
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { |
||||
return new BoxPlotReportDataContentPane(parent); |
||||
} |
||||
|
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new VanChartBoxPlotPane(); |
||||
} |
||||
|
||||
public ConditionAttributesPane getPlotConditionPane(Plot plot) { |
||||
return new VanChartBoxConditionPane(plot); |
||||
} |
||||
|
||||
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) { |
||||
return new VanChartBoxSeriesPane(parent, plot); |
||||
} |
||||
|
||||
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { |
||||
VanChartStylePane stylePane = new VanChartBoxStylePane(listener); |
||||
VanChartOtherPane otherPane = new VanChartOtherPane() { |
||||
|
||||
protected BasicBeanPane<Chart> createInteractivePane() { |
||||
return new VanChartInteractivePane() { |
||||
|
||||
protected Component[][] createToolBarComponents() { |
||||
return new Component[][]{ |
||||
new Component[]{null, exportImages}, |
||||
new Component[]{null, fullScreenDisplay} |
||||
}; |
||||
} |
||||
|
||||
protected double[] getToolBarRowSize() { |
||||
double p = TableLayout.PREFERRED; |
||||
return new double[]{p, p}; |
||||
} |
||||
|
||||
protected ZoomPane createZoomPane() { |
||||
return new ZoomPane(); |
||||
} |
||||
}; |
||||
} |
||||
}; |
||||
|
||||
return new AbstractChartAttrPane[]{stylePane, otherPane}; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,53 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.base.AttrAlpha; |
||||
import com.fr.chart.base.AttrBackground; |
||||
import com.fr.chart.base.AttrBorder; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; |
||||
import com.fr.plugin.chart.box.VanChartBoxPlot; |
||||
import com.fr.plugin.chart.type.ConditionKeyType; |
||||
import com.fr.van.chart.column.VanChartColumnLabelBorderPane; |
||||
import com.fr.van.chart.designer.other.condition.item.VanChartColumnSeriesColorConditionPane; |
||||
|
||||
import java.awt.Dimension; |
||||
|
||||
public class VanChartBoxConditionPane extends DataSeriesConditionPane { |
||||
|
||||
public VanChartBoxConditionPane(Plot plot) { |
||||
super(plot); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
|
||||
liteConditionPane.setPreferredSize(new Dimension(300, 400)); |
||||
} |
||||
|
||||
protected void addBasicAction() { |
||||
classPaneMap.put(AttrBackground.class, new VanChartColumnSeriesColorConditionPane(this)); |
||||
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); |
||||
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this)); |
||||
} |
||||
|
||||
protected void addStyleAction() { |
||||
} |
||||
|
||||
protected ChartConditionPane createListConditionPane() { |
||||
|
||||
return new ChartConditionPane() { |
||||
|
||||
@Override |
||||
protected ConditionKeyType[] conditionKeyTypes() { |
||||
return ConditionKeyType.BOX_CONDITION_KEY_TYPES; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
|
||||
public Class<? extends Plot> class4Correspond() { |
||||
return VanChartBoxPlot.class; |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.chart.box.BoxIndependentVanChart; |
||||
import com.fr.plugin.chart.box.VanChartBoxPlot; |
||||
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; |
||||
|
||||
public class VanChartBoxPlotPane extends AbstractVanChartTypePane { |
||||
|
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{"/com/fr/van/chart/box.images/box.png" |
||||
}; |
||||
} |
||||
|
||||
protected Plot getSelectedClonedPlot() { |
||||
VanChartBoxPlot newPlot = null; |
||||
|
||||
Chart[] boxChartGroup = BoxIndependentVanChart.BoxVanChartTypes; |
||||
|
||||
for (int i = 0, len = boxChartGroup.length; i < len; i++) { |
||||
if (typeDemo.get(i).isPressing) { |
||||
newPlot = boxChartGroup[i].getPlot(); |
||||
} |
||||
} |
||||
|
||||
Plot cloned = null; |
||||
|
||||
try { |
||||
if (newPlot != null) { |
||||
cloned = (Plot) newPlot.clone(); |
||||
} |
||||
} catch (CloneNotSupportedException e) { |
||||
FineLoggerFactory.getLogger().error("Error In ColumnChart"); |
||||
} |
||||
|
||||
return cloned; |
||||
} |
||||
|
||||
public Chart getDefaultChart() { |
||||
return BoxIndependentVanChart.BoxVanChartTypes[0]; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; |
||||
|
||||
public class VanChartBoxPlotTooltipPane extends VanChartPlotTooltipPane { |
||||
|
||||
public VanChartBoxPlotTooltipPane(Plot plot, VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
protected void initTooltipContentPane(Plot plot) { |
||||
tooltipContentPane = new VanChartBoxTooltipContentPane(parent, VanChartBoxPlotTooltipPane.this); |
||||
} |
||||
|
||||
protected boolean hasTooltipSeriesType() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.van.chart.column.VanChartColumnSeriesPane; |
||||
|
||||
public class VanChartBoxSeriesPane extends VanChartColumnSeriesPane { |
||||
|
||||
public VanChartBoxSeriesPane(ChartStylePane parent, Plot plot) { |
||||
super(parent, plot); |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.van.chart.bar.VanChartBarStylePane; |
||||
|
||||
import java.util.List; |
||||
|
||||
public class VanChartBoxStylePane extends VanChartBarStylePane { |
||||
|
||||
public VanChartBoxStylePane(AttributeChangeListener listener) { |
||||
super(listener); |
||||
} |
||||
|
||||
protected void createVanChartLabelPane(List<BasicPane> paneList) { |
||||
} |
||||
|
||||
protected void addVanChartTooltipPane(List<BasicPane> paneList) { |
||||
paneList.add(new VanChartBoxTooltipPane(VanChartBoxStylePane.this)); |
||||
} |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; |
||||
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; |
||||
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.Component; |
||||
|
||||
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { |
||||
|
||||
public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { |
||||
super(parent, showOnPane); |
||||
} |
||||
|
||||
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { |
||||
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); |
||||
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); |
||||
} |
||||
|
||||
protected Component[][] getPaneComponents() { |
||||
return new Component[][]{ |
||||
new Component[]{categoryNameFormatPane, null}, |
||||
new Component[]{seriesNameFormatPane, null} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; |
||||
import com.fr.van.chart.designer.style.tooltip.VanChartTooltipPane; |
||||
|
||||
public class VanChartBoxTooltipPane extends VanChartTooltipPane { |
||||
|
||||
public VanChartBoxTooltipPane(VanChartStylePane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
protected VanChartPlotTooltipPane getTooltipPane(Plot plot) { |
||||
return new VanChartBoxPlotTooltipPane(plot, parent); |
||||
} |
||||
} |
@ -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,213 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartdata.NormalTableDataDefinition; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
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.ChartDataFilterPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinitionHelper; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition; |
||||
|
||||
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; |
||||
import java.util.List; |
||||
|
||||
public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane { |
||||
|
||||
private UIButtonGroup dataType; |
||||
|
||||
private BoxPlotTableSeriesTypeUsePane seriesTypeComboxPane; |
||||
private BoxPlotTableResultDataSeriesPane resultDataSeriesPane; |
||||
|
||||
private ChartDataFilterPane dataScreeningPane; |
||||
|
||||
private ChartDataPane parent; |
||||
private Plot initplot; |
||||
|
||||
public BoxPlotTableDataContentPane(Plot plot, ChartDataPane parent) { |
||||
this.initplot = plot; |
||||
this.parent = parent; |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
this.add(createDataTypePane(), BorderLayout.NORTH); |
||||
this.add(createSeriesPane(), BorderLayout.CENTER); |
||||
this.add(createFilterPane(), BorderLayout.SOUTH); |
||||
|
||||
initDataTypeListener(); |
||||
checkDataPaneVisible(); |
||||
} |
||||
|
||||
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() { |
||||
seriesTypeComboxPane = new BoxPlotTableSeriesTypeUsePane(); |
||||
resultDataSeriesPane = new BoxPlotTableResultDataSeriesPane(); |
||||
|
||||
JPanel pane = new JPanel(new BorderLayout(4, 0)); |
||||
|
||||
pane.add(seriesTypeComboxPane, BorderLayout.CENTER); |
||||
pane.add(resultDataSeriesPane, BorderLayout.SOUTH); |
||||
|
||||
return pane; |
||||
} |
||||
|
||||
private JPanel createFilterPane() { |
||||
dataScreeningPane = new ChartDataFilterPane(initplot, parent, false); |
||||
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15)); |
||||
|
||||
JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); |
||||
|
||||
return panel; |
||||
} |
||||
|
||||
private void initDataTypeListener() { |
||||
dataType.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkDataPaneVisible(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkDataPaneVisible() { |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.setVisible(dataType.getSelectedIndex() == 0); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.setVisible(dataType.getSelectedIndex() == 1); |
||||
} |
||||
} |
||||
|
||||
public void checkBoxUse(boolean hasUse) { |
||||
if (dataType.getSelectedIndex() == 0 && seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.checkBoxUse(hasUse); |
||||
} |
||||
|
||||
if (dataType.getSelectedIndex() == 1 && resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.checkBoxUse(hasUse); |
||||
} |
||||
|
||||
dataScreeningPane.checkBoxUse(); |
||||
} |
||||
|
||||
protected void refreshBoxListWithSelectTableData(List list) { |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.refreshBoxListWithSelectTableData(list); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.refreshBoxListWithSelectTableData(list); |
||||
} |
||||
} |
||||
|
||||
public void clearAllBoxList() { |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.clearAllBoxList(); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.clearAllBoxList(); |
||||
} |
||||
} |
||||
|
||||
public void updateBean(ChartCollection collection) { |
||||
checkChartCollection(collection); |
||||
|
||||
VanBoxTableDefinition table = VanBoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||
|
||||
if (table != null) { |
||||
table.setDetailed(dataType.getSelectedIndex() == 0); |
||||
} |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.updateBean(collection); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.updateBean(collection); |
||||
} |
||||
if (dataScreeningPane != null) { |
||||
updateDataScreeningPane(dataScreeningPane, collection); |
||||
} |
||||
} |
||||
|
||||
public void populateBean(ChartCollection collection) { |
||||
checkChartCollection(collection); |
||||
|
||||
if (dataType != null) { |
||||
dataType.setSelectedIndex(VanBoxTableDefinitionHelper.isDetailedTableDataType(collection) ? 0 : 1); |
||||
} |
||||
if (seriesTypeComboxPane != null) { |
||||
seriesTypeComboxPane.populateBean(collection); |
||||
} |
||||
if (resultDataSeriesPane != null) { |
||||
resultDataSeriesPane.populateBean(collection); |
||||
} |
||||
if (dataScreeningPane != null) { |
||||
populateDataScreeningPane(dataScreeningPane, collection); |
||||
} |
||||
|
||||
checkDataPaneVisible(); |
||||
} |
||||
|
||||
private void checkChartCollection(ChartCollection collection) { |
||||
VanBoxTableDefinition table = VanBoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||
|
||||
if (table == null) { |
||||
collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition()); |
||||
} |
||||
} |
||||
|
||||
private void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { |
||||
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
||||
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
||||
|
||||
if (detailedDefinition != null) { |
||||
dataScreeningPane.populateDefinition(detailedDefinition, false); |
||||
} else if (resultDefinition != null) { |
||||
dataScreeningPane.populateDefinition(resultDefinition, false); |
||||
} |
||||
} |
||||
|
||||
private void updateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { |
||||
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
||||
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
||||
|
||||
if (detailedDefinition != null) { |
||||
dataScreeningPane.updateDefinition(detailedDefinition); |
||||
} |
||||
|
||||
if (resultDefinition != null) { |
||||
dataScreeningPane.updateDefinition(resultDefinition); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,179 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
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.data.table.AbstractTableDataContentPane; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinitionHelper; |
||||
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; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.util.List; |
||||
|
||||
public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPane { |
||||
|
||||
private UIComboBox category; |
||||
private UIComboBox seriesName; |
||||
private UIComboBox max; |
||||
private UIComboBox q3; |
||||
private UIComboBox median; |
||||
private UIComboBox q1; |
||||
private UIComboBox min; |
||||
|
||||
public BoxPlotTableResultDataSeriesPane() { |
||||
|
||||
initComboxSize(); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(createDataSeriesPane(), BorderLayout.CENTER); |
||||
|
||||
addItemListener(); |
||||
} |
||||
|
||||
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); |
||||
} |
||||
|
||||
private void addItemListener() { |
||||
category.addItemListener(tooltipListener); |
||||
seriesName.addItemListener(tooltipListener); |
||||
max.addItemListener(tooltipListener); |
||||
q3.addItemListener(tooltipListener); |
||||
median.addItemListener(tooltipListener); |
||||
q1.addItemListener(tooltipListener); |
||||
min.addItemListener(tooltipListener); |
||||
} |
||||
|
||||
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}, |
||||
}; |
||||
|
||||
JPanel center = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north, row, column); |
||||
center.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15)); |
||||
|
||||
return center; |
||||
} |
||||
|
||||
public void checkBoxUse(boolean hasUse) { |
||||
} |
||||
|
||||
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); |
||||
} |
||||
|
||||
public void clearAllBoxList() { |
||||
clearBoxItems(category); |
||||
clearBoxItems(seriesName); |
||||
clearBoxItems(max); |
||||
clearBoxItems(q3); |
||||
clearBoxItems(median); |
||||
clearBoxItems(q1); |
||||
clearBoxItems(min); |
||||
} |
||||
|
||||
public void populateBean(ChartCollection collection) { |
||||
super.populateBean(collection); |
||||
|
||||
VanBoxTableResultDefinition definition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
||||
|
||||
if (definition == null) { |
||||
return; |
||||
} |
||||
|
||||
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()); |
||||
} |
||||
|
||||
public void updateBean(ChartCollection collection) { |
||||
VanBoxTableDefinition table = VanBoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||
|
||||
VanBoxTableResultDefinition definition = new VanBoxTableResultDefinition(); |
||||
|
||||
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(); |
||||
|
||||
if (resultCategory == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultCategory)) { |
||||
definition.setCategoryName(StringUtils.EMPTY); |
||||
} else { |
||||
definition.setCategoryName(resultCategory.toString()); |
||||
} |
||||
if (resultSeries == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultSeries)) { |
||||
definition.setSeriesName(StringUtils.EMPTY); |
||||
} else { |
||||
definition.setSeriesName(resultSeries.toString()); |
||||
} |
||||
if (resultMax != null) { |
||||
definition.setMax(resultMax.toString()); |
||||
} |
||||
if (resultQ3 != null) { |
||||
definition.setQ3(resultQ3.toString()); |
||||
} |
||||
if (resultMedian != null) { |
||||
definition.setMedian(resultMedian.toString()); |
||||
} |
||||
if (resultQ1 != null) { |
||||
definition.setQ1(resultQ1.toString()); |
||||
} |
||||
if (resultMin != null) { |
||||
definition.setMin(resultMin.toString()); |
||||
} |
||||
|
||||
table.setResultDefinition(definition); |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.chartdata.MoreNameCDDefinition; |
||||
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldNamePane; |
||||
import com.fr.plugin.chart.box.data.VanBoxMoreNameCDDefinition; |
||||
|
||||
public class BoxPlotTableSeriesNameUseFieldNamePane extends SeriesNameUseFieldNamePane { |
||||
|
||||
protected MoreNameCDDefinition createMoreNameCDDefinition() { |
||||
return new VanBoxMoreNameCDDefinition(); |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.chartdata.OneValueCDDefinition; |
||||
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane; |
||||
import com.fr.plugin.chart.box.data.VanBoxOneValueCDDefinition; |
||||
|
||||
public class BoxPlotTableSeriesNameUseFieldValuePane extends SeriesNameUseFieldValuePane { |
||||
|
||||
protected OneValueCDDefinition createOneValueCDDefinition() { |
||||
return new VanBoxOneValueCDDefinition(); |
||||
} |
||||
} |
@ -0,0 +1,225 @@
|
||||
package com.fr.van.chart.box.data.table; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartdata.MoreNameCDDefinition; |
||||
import com.fr.chart.chartdata.NormalTableDataDefinition; |
||||
import com.fr.chart.chartdata.OneValueCDDefinition; |
||||
import com.fr.design.beans.FurtherBasicBeanPane; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.frpane.UIComboBoxPane; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.BoldFontTextLabel; |
||||
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.table.DataPaneHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.design.utils.gui.UIComponentUtils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinitionHelper; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollection> { |
||||
|
||||
private static boolean NEED_SUMMERY = false; |
||||
|
||||
private UIComboBox categoryCombox; |
||||
|
||||
private BoxPlotTableSeriesNameUseFieldValuePane nameFieldValuePane; |
||||
private BoxPlotTableSeriesNameUseFieldNamePane nameFieldNamePane; |
||||
|
||||
public BoxPlotTableSeriesTypeUsePane() { |
||||
cards = initPaneList(); |
||||
initComponents(); |
||||
initListener(); |
||||
} |
||||
|
||||
protected void initLayout() { |
||||
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); |
||||
|
||||
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); |
||||
|
||||
this.add(createNorthPane(), BorderLayout.NORTH); |
||||
this.add(createCenterPane(), BorderLayout.CENTER); |
||||
this.add(cardPane, BorderLayout.SOUTH); |
||||
} |
||||
|
||||
protected UIComboBox createComboBox() { |
||||
UIComboBox uiComboBox = new UIComboBox(); |
||||
UIComponentUtils.setPreferedWidth(uiComboBox, 100); |
||||
return uiComboBox; |
||||
} |
||||
|
||||
private JPanel createNorthPane() { |
||||
JPanel north = new JPanel(new BorderLayout(4, 0)); |
||||
north.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); |
||||
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")); |
||||
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); |
||||
|
||||
categoryCombox = new UIComboBox(); |
||||
categoryCombox.setPreferredSize(new Dimension(100, 20)); |
||||
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
|
||||
north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, null, null, label, null})); |
||||
north.setPreferredSize(new Dimension(246, 30)); |
||||
north.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15)); |
||||
|
||||
return north; |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
JPanel center = new JPanel(new BorderLayout(4, 0)); |
||||
|
||||
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); |
||||
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); |
||||
center.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label, null})); |
||||
center.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); |
||||
|
||||
return center; |
||||
} |
||||
|
||||
private void initListener() { |
||||
categoryCombox.addItemListener(new ItemListener() { |
||||
public void itemStateChanged(ItemEvent e) { |
||||
checkBoxUse(categoryCombox.getSelectedItem() != null); |
||||
makeToolTipUse(categoryCombox); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void checkBoxUse(boolean hasUse) { |
||||
categoryCombox.setEnabled(hasUse); |
||||
jcb.setEnabled(hasUse); |
||||
nameFieldValuePane.checkUse(hasUse); |
||||
} |
||||
|
||||
private void makeToolTipUse(UIComboBox comBox) { |
||||
if (comBox.getSelectedItem() != null) { |
||||
comBox.setToolTipText(comBox.getSelectedItem().toString()); |
||||
} else { |
||||
comBox.setToolTipText(null); |
||||
} |
||||
} |
||||
|
||||
public void refreshBoxListWithSelectTableData(List list) { |
||||
DataPaneHelper.refreshBoxItems(categoryCombox, list); |
||||
|
||||
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
|
||||
nameFieldValuePane.refreshBoxListWithSelectTableData(list); |
||||
nameFieldNamePane.refreshBoxListWithSelectTableData(list); |
||||
} |
||||
|
||||
public void clearAllBoxList() { |
||||
DataPaneHelper.clearBoxItems(categoryCombox); |
||||
|
||||
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
|
||||
nameFieldValuePane.clearAllBoxList(); |
||||
nameFieldNamePane.clearAllBoxList(); |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"); |
||||
} |
||||
|
||||
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() { |
||||
nameFieldValuePane = new BoxPlotTableSeriesNameUseFieldValuePane(); |
||||
nameFieldNamePane = new BoxPlotTableSeriesNameUseFieldNamePane(); |
||||
|
||||
nameFieldValuePane.relayoutPane(NEED_SUMMERY); |
||||
nameFieldNamePane.relayoutPane(NEED_SUMMERY); |
||||
|
||||
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>(); |
||||
|
||||
paneList.add(nameFieldValuePane); |
||||
paneList.add(nameFieldNamePane); |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
public void relayoutPane() { |
||||
if (jcb.getSelectedIndex() == 0) { |
||||
nameFieldValuePane.relayoutPane(NEED_SUMMERY); |
||||
} else { |
||||
nameFieldNamePane.relayoutPane(NEED_SUMMERY); |
||||
} |
||||
} |
||||
|
||||
protected void comboBoxItemStateChanged() { |
||||
if (jcb.getSelectedIndex() == 0) { |
||||
nameFieldValuePane.relayoutPane(NEED_SUMMERY); |
||||
} else { |
||||
nameFieldNamePane.relayoutPane(NEED_SUMMERY); |
||||
} |
||||
} |
||||
|
||||
public void populateBean(ChartCollection collection) { |
||||
NormalTableDataDefinition definition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
||||
|
||||
if (definition == null) { |
||||
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
return; |
||||
} |
||||
|
||||
if (definition instanceof OneValueCDDefinition) { |
||||
this.setSelectedIndex(0); |
||||
nameFieldValuePane.populateDefinition(definition, NEED_SUMMERY); |
||||
} else if (definition instanceof MoreNameCDDefinition) { |
||||
this.setSelectedIndex(1); |
||||
nameFieldNamePane.populateDefinition(definition, NEED_SUMMERY); |
||||
} |
||||
|
||||
populateCategoryItem(categoryCombox, definition.getCategoryName()); |
||||
} |
||||
|
||||
public void updateBean(ChartCollection collection) { |
||||
VanBoxTableDefinition table = VanBoxTableDefinitionHelper.getBoxTableDefinition(collection); |
||||
|
||||
if (table == null) { |
||||
return; |
||||
} |
||||
|
||||
NormalTableDataDefinition definition; |
||||
|
||||
if (this.getSelectedIndex() == 0) { |
||||
definition = nameFieldValuePane.updateDefinition(); |
||||
} else { |
||||
definition = nameFieldNamePane.updateDefinition(table.getDetailedDefinition()); |
||||
} |
||||
|
||||
Object categoryName = categoryCombox.getSelectedItem(); |
||||
|
||||
if (ArrayUtils.contains(ChartConstants.getNoneKeys(), categoryName)) { |
||||
definition.setCategoryName(StringUtils.EMPTY); |
||||
} else { |
||||
definition.setCategoryName(categoryName == null ? null : categoryName.toString()); |
||||
} |
||||
|
||||
table.setDetailedDefinition(definition); |
||||
} |
||||
|
||||
private void populateCategoryItem(UIComboBox categoryCombox, String item) { |
||||
if (ComparatorUtils.equals(item, StringUtils.EMPTY)) { |
||||
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
||||
} else if (!DataPaneHelper.boxItemsContainsObject(categoryCombox, item)) { |
||||
categoryCombox.setSelectedItem(null); |
||||
} else { |
||||
DataPaneHelper.combineCustomEditValue(categoryCombox, item); |
||||
} |
||||
} |
||||
|
||||
} |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 918 B |
Loading…
Reference in new issue