From 5b4868a601d318f1d29d2177dda311e71ee2dec9 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 23 Jul 2020 18:04:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E5=88=97=E5=92=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=82=B9=E6=8F=90=E7=A4=BA=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/box/VanChartBoxPlotTooltipPane.java | 6 + .../van/chart/box/VanChartBoxSeriesPane.java | 94 ++++++++++++- .../van/chart/box/VanChartBoxStylePane.java | 4 +- .../box/VanChartBoxTooltipContentPane.java | 123 +++++++++++++++++- 4 files changed, 222 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotTooltipPane.java index e976d05e6..4ad21d0d8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotTooltipPane.java @@ -1,6 +1,8 @@ package com.fr.van.chart.box; import com.fr.chart.chartattr.Plot; +import com.fr.plugin.chart.base.AttrTooltip; +import com.fr.plugin.chart.box.attr.AttrBoxTooltip; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; @@ -14,6 +16,10 @@ public class VanChartBoxPlotTooltipPane extends VanChartPlotTooltipPane { tooltipContentPane = new VanChartBoxTooltipContentPane(parent, VanChartBoxPlotTooltipPane.this); } + protected AttrTooltip getAttrTooltip() { + return new AttrBoxTooltip(); + } + protected boolean hasTooltipSeriesType() { return false; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxSeriesPane.java index 867f7ec9e..e64a134d5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxSeriesPane.java @@ -1,12 +1,102 @@ package com.fr.van.chart.box; import com.fr.chart.chartattr.Plot; +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.ChartStylePane; -import com.fr.van.chart.column.VanChartColumnSeriesPane; +import com.fr.plugin.chart.box.VanChartBoxPlot; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartBeautyPane; +import com.fr.van.chart.designer.component.VanChartMarkerPane; +import com.fr.van.chart.designer.component.border.VanChartBorderPane; +import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; -public class VanChartBoxSeriesPane extends VanChartColumnSeriesPane { +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane { + + private VanChartMarkerPane normalValuePane; + private VanChartMarkerPane outlierValuePane; public VanChartBoxSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } + + protected JPanel getContentInPlotType() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {f}; + double[] rowSize = {p, p, p}; + + Component[][] components = new Component[][]{ + new Component[]{createBorderPane()}, + new Component[]{createNormalValuePane()}, + new Component[]{createOutlierValuePane()} + }; + + contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + return contentPane; + } + + protected VanChartBorderPane createDiffBorderPane() { + return new VanChartBorderPane(); + } + + private JPanel createNormalValuePane() { + normalValuePane = new VanChartMarkerPane(); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Engine_Chart_Normal_Value"), normalValuePane); + } + + private JPanel createOutlierValuePane() { + outlierValuePane = new VanChartMarkerPane(); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Engine_Chart_Outlier_Value"), outlierValuePane); + } + + private void checkMarkerPane(boolean isDetailed) { + normalValuePane.setVisible(isDetailed); + outlierValuePane.setVisible(isDetailed); + } + + protected void setColorPaneContent(JPanel panel) { + panel.add(createAlphaPane(), BorderLayout.SOUTH); + } + + protected VanChartBeautyPane createStylePane() { + return null; + } + + public void populateBean(Plot plot) { + if (plot == null) { + return; + } + + super.populateBean(plot); + + if (plot instanceof VanChartBoxPlot) { + normalValuePane.populate(((VanChartBoxPlot) plot).getNormalValue()); + outlierValuePane.populate(((VanChartBoxPlot) plot).getOutlierValue()); + + checkMarkerPane(((VanChartBoxPlot) plot).isDetailed()); + } + } + + public void updateBean(Plot plot) { + if (plot == null) { + return; + } + + if (plot instanceof VanChartBoxPlot) { + ((VanChartBoxPlot) plot).setNormalValue(normalValuePane.update()); + ((VanChartBoxPlot) plot).setOutlierValue(outlierValuePane.update()); + } + + super.updateBean(plot); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxStylePane.java index b9e60c68e..53cf8083f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxStylePane.java @@ -2,11 +2,11 @@ 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 com.fr.van.chart.designer.style.VanChartStylePane; import java.util.List; -public class VanChartBoxStylePane extends VanChartBarStylePane { +public class VanChartBoxStylePane extends VanChartStylePane { public VanChartBoxStylePane(AttributeChangeListener listener) { super(listener); diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java index 9fc9988f0..870250d65 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java @@ -1,8 +1,12 @@ package com.fr.van.chart.box; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; 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.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -10,6 +14,14 @@ import java.awt.Component; public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { + private VanChartFormatPaneWithCheckBox number; + private VanChartFormatPaneWithCheckBox max; + private VanChartFormatPaneWithCheckBox q3; + private VanChartFormatPaneWithCheckBox median; + private VanChartFormatPaneWithCheckBox q1; + private VanChartFormatPaneWithCheckBox min; + private VanChartFormatPaneWithCheckBox outlier; + public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { super(parent, showOnPane); } @@ -17,12 +29,121 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); + + number = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Data_Number"); + } + }; + max = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Max_Value"); + } + }; + q3 = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Data_Q3"); + } + }; + median = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Data_Median"); + } + }; + q1 = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Data_Q1"); + } + }; + min = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Min_Value"); + } + }; + outlier = new VanChartFormatPaneWithCheckBox(parent, showOnPane) { + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Engine_Chart_Outlier_Value"); + } + }; + } + + protected double[] getRowSize(double p) { + return new double[]{p, p, p, p, p, p, p, p, p}; } protected Component[][] getPaneComponents() { return new Component[][]{ new Component[]{categoryNameFormatPane, null}, - new Component[]{seriesNameFormatPane, null} + new Component[]{seriesNameFormatPane, null}, + new Component[]{number, null}, + new Component[]{max, null}, + new Component[]{q3, null}, + new Component[]{median, null}, + new Component[]{q1, null}, + new Component[]{min, null}, + new Component[]{outlier, null} }; } + + public boolean isDirty() { + return categoryNameFormatPane.isDirty() + || seriesNameFormatPane.isDirty() + || number.isDirty() + || max.isDirty() + || q3.isDirty() + || median.isDirty() + || q1.isDirty() + || min.isDirty() + || outlier.isDirty(); + } + + public void setDirty(boolean isDirty) { + categoryNameFormatPane.setDirty(isDirty); + seriesNameFormatPane.setDirty(isDirty); + number.setDirty(isDirty); + max.setDirty(isDirty); + q3.setDirty(isDirty); + median.setDirty(isDirty); + q1.setDirty(isDirty); + min.setDirty(isDirty); + outlier.setDirty(isDirty); + } + + protected AttrTooltipContent createAttrTooltip() { + return new AttrBoxTooltipContent(); + } + + protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { + categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat()); + seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat()); + + if (attrTooltipContent instanceof AttrBoxTooltipContent) { + AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; + + number.populate(boxTooltipContent.getNumber()); + max.populate(boxTooltipContent.getMax()); + q3.populate(boxTooltipContent.getQ3()); + median.populate(boxTooltipContent.getMedian()); + q1.populate(boxTooltipContent.getQ1()); + min.populate(boxTooltipContent.getMin()); + outlier.populate(boxTooltipContent.getOutlier()); + } + } + + protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { + categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat()); + seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat()); + + if (attrTooltipContent instanceof AttrBoxTooltipContent) { + AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; + + number.update(boxTooltipContent.getNumber()); + max.update(boxTooltipContent.getMax()); + q3.update(boxTooltipContent.getQ3()); + median.update(boxTooltipContent.getMedian()); + q1.update(boxTooltipContent.getQ1()); + min.update(boxTooltipContent.getMin()); + outlier.update(boxTooltipContent.getOutlier()); + } + } }