From af29f516ef6e45e286b7aedcd55e60e6897f4a22 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 24 Jan 2021 16:14:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E9=A5=BC=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartPieCategoryLabelContentPane.java | 80 ++++++++++--------- ...ChartPieCategoryRichTextFieldListPane.java | 66 +++++++++++++++ .../VanChartPieValueLabelContentPane.java | 47 +++++++++-- ...VanChartPieValueRichTextFieldListPane.java | 34 ++++++++ ...ChartScatterRefreshTooltipContentPane.java | 21 ----- 5 files changed, 180 insertions(+), 68 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java index e5b55d749..73c63bbee 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java @@ -1,16 +1,20 @@ package com.fr.van.chart.pie.style; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSummaryValueFormat; import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -25,8 +29,6 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan private SummaryValueFormatPaneWithCheckBox summaryValueFormatPane; - private SummaryValueFormatPaneWithoutCheckBox richTextSummaryValueFormatPane; - public VanChartPieCategoryLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { super(parent, showOnPane, inCondition); } @@ -42,25 +44,39 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane = new SummaryValueFormatPaneWithCheckBox(parent, showOnPane); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); - richTextSummaryValueFormatPane = new SummaryValueFormatPaneWithoutCheckBox(parent, showOnPane); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartPieCategoryRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; } - @Override - protected Component[][] getPaneComponents() { - return new Component[][]{ - new Component[]{getCategoryNameFormatPane(), null}, - new Component[]{summaryValueFormatPane, null}, + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSummaryValueFormat() }; } @Override - protected Component[][] getRichTextComponents() { + protected Component[][] getPaneComponents() { return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{richTextSummaryValueFormatPane, null}, + new Component[]{getCategoryNameFormatPane(), null}, + new Component[]{summaryValueFormatPane, null}, }; } @@ -81,23 +97,15 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane.populate(pieCategoryLabelContent.getSummaryValueFormat()); } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextCategoryNameFormatPane(), - richTextSummaryValueFormatPane - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - pieCategoryLabelContent.getRichTextCategoryFormat(), - pieCategoryLabelContent.getRichTextSummaryValueFormat() - }; + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(pieCategoryLabelContent.getRichTextAttr()); + if (target instanceof PieCategoryLabelContent && source instanceof PieCategoryLabelContent) { + PieCategoryLabelContent targetPieCategory = (PieCategoryLabelContent) target; + PieCategoryLabelContent sourcePieCategory = (PieCategoryLabelContent) source; - checkRichEditorState(pieCategoryLabelContent); + targetPieCategory.setRichTextSummaryValueFormat(sourcePieCategory.getRichTextSummaryValueFormat()); + } } @Override @@ -107,12 +115,6 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane.update(pieCategoryLabelContent.getSummaryValueFormat()); } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; - super.updateRichEditor(pieCategoryLabelContent); - richTextSummaryValueFormatPane.update(pieCategoryLabelContent.getRichTextSummaryValueFormat()); - } - @Override public void setDirty(boolean isDirty) { getCategoryNameFormatPane().setDirty(isDirty); diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java new file mode 100644 index 000000000..deb62c01c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java @@ -0,0 +1,66 @@ +package com.fr.van.chart.pie.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipSummaryValueFormat; +import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListener; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartPieCategoryRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton summaryValueButton; + + public VanChartPieCategoryRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + super.initDefaultFieldButton(); + + VanChartFieldListener listener = getFieldListener(); + + summaryValueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value"), + new AttrTooltipSummaryValueFormat(), false, listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(summaryValueButton); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(summaryValueButton); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof PieCategoryLabelContent) { + PieCategoryLabelContent pieCategory = (PieCategoryLabelContent) tooltipContent; + populateButtonFormat(summaryValueButton, pieCategory.getRichTextSummaryValueFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof PieCategoryLabelContent) { + PieCategoryLabelContent pieCategory = (PieCategoryLabelContent) tooltipContent; + updateButtonFormat(summaryValueButton, pieCategory.getRichTextSummaryValueFormat()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java index ddc6e6631..6fdc4e584 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java @@ -1,12 +1,20 @@ package com.fr.van.chart.pie.style; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -35,11 +43,34 @@ public class VanChartPieValueLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartPieValueRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java new file mode 100644 index 000000000..072b3a801 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java @@ -0,0 +1,34 @@ +package com.fr.van.chart.pie.style; + +import com.fr.design.ui.ModernUIPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldButton; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; + +import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; + +public class VanChartPieValueRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartPieValueRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getSeriesNameButton()); + fieldPane.add(getValueButton()); + fieldPane.add(getPercentButton()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(getValueButton()); + fieldButtonList.add(getPercentButton()); + + return fieldButtonList; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java index e5416b1c2..742df9634 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java @@ -77,27 +77,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - super.populateRichEditor(attrTooltipContent); - - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; - - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - richTextChangedSizeFormatPane, - getRichTextChangedPercentFormatPane() - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - scatterAttrTooltipContent.getRichTextChangeSizeFormat(), - scatterAttrTooltipContent.getRichTextChangedSizePercentFormat() - }; - - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - } - } - @Override protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { super.updateFormatPane(attrTooltipContent);