From 1c1b4dab39afd87dd9358ed2cc1d771b2ea743cd Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 29 Dec 2020 17:00:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=9B=B4=E6=96=B0=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartTooltipContentPane.java | 56 ++++++++++++++++--- .../richText/VanChartFieldButton.java | 4 ++ .../richText/VanChartFieldListPane.java | 20 +++++++ .../richText/VanChartRichTextPane.java | 7 ++- 4 files changed, 78 insertions(+), 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index ba6a55cb8..66f04a3d3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -16,7 +16,11 @@ import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.TableFieldCollection; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; 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.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; @@ -50,7 +54,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 数据点提示内容界面,含有通用设置、富文本编辑器、自定义JS界面 @@ -436,15 +442,14 @@ public class VanChartTooltipContentPane extends BasicBeanPane richEditorPane = VanChartRichEditorPane.createRichEditorPane(richText); - VanChartRichTextPane richTextPane = new VanChartRichTextPane(getTableFieldNames(), richEditorPane); + VanChartRichTextPane richTextPane = this.createRichTextPane(getTableFieldNames(), richEditorPane); + BasicDialog richTextDialog = new VanChartRichTextDialog(DesignerContext.getDesignerFrame(), richTextPane); - // 更新字段格式和汇总方式 richTextPane.populateBean(this.richTextTooltipContent); - // 更新富文本编辑器内容 richEditorPane.populate(VanChartRichEditorPane.getRichEditorModel(richText)); richTextDialog.addDialogActionListener(new DialogActionAdapter() { @@ -486,6 +491,42 @@ public class VanChartTooltipContentPane extends BasicBeanPane tableFieldNames, ModernUIPane richEditorPane) { + return new VanChartRichTextPane(tableFieldNames, richEditorPane); + } + + protected void refreshRichTextFormat(AttrTooltipRichText richText) { + String[] fieldNames = new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + + AttrTooltipFormat[] fieldFormats = new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; + + Map params = new HashMap<>(); + + for (int i = 0, len = fieldNames.length; i < len; i++) { + params.put(fieldNames[i], fieldFormats[i].getJs()); + } + + List tableFieldNames = this.getTableFieldNames(); + + if (tableFieldNames != null) { + for (String fieldName : tableFieldNames) { + params.put(fieldName, fieldName); + } + } + + richText.setParams(params); + } + private JPanel createHtmlPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -734,11 +775,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane { public VanChartRichTextPane(List tableFieldNames, ModernUIPane richEditor) { fieldAttrPane = new VanChartFieldAttrPane(); - fieldListPane = new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + fieldListPane = createFieldListPane(tableFieldNames, fieldAttrPane, richEditor); this.setLayout(new BorderLayout()); this.add(createFieldContentPane(), BorderLayout.CENTER); @@ -59,6 +59,11 @@ public class VanChartRichTextPane extends BasicBeanPane { return fieldPane; } + protected VanChartFieldListPane createFieldListPane(List tableFieldNames, VanChartFieldAttrPane fieldAttrPane, + ModernUIPane richEditor) { + return new VanChartFieldListPane(tableFieldNames, fieldAttrPane, richEditor); + } + private JPanel createRichEditorPane(JPanel richEditor) { JPanel richEditorPane = new JPanel();