From 6475734917184e419ea9d31da723540556c4fde7 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 22 Jan 2021 15:47:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E7=94=98=E7=89=B9=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartFieldAttrPane.java | 52 +++++-- .../richText/VanChartFieldButton.java | 31 +++++ .../richText/VanChartFieldListPane.java | 18 ++- .../VanChartGanttRichTextFieldListPane.java | 107 ++++++++++++++ .../VanChartGanttTooltipContentPane.java | 131 ++++++------------ 5 files changed, 238 insertions(+), 101 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java index 89c3cd73e..5cab5485f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java @@ -2,11 +2,13 @@ package com.fr.van.chart.designer.component.richText; import com.fr.data.util.function.AbstractDataFunction; import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.FormatPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; @@ -21,15 +23,18 @@ import java.text.Format; public class VanChartFieldAttrPane extends JPanel { private FormatPane fieldFormatPane; - private CalculateComboBox fieldDataFunction; + private UIComboBox intervalTimeBox; + private CalculateComboBox dataFunctionBox; + private JPanel formatPane; + private JPanel intervalTimePane; private JPanel fieldFunctionPane; public VanChartFieldAttrPane() { initComponents(); this.setLayout(new BorderLayout()); - this.add(fieldFormatPane, BorderLayout.NORTH); + this.add(formatPane, BorderLayout.NORTH); this.add(fieldFunctionPane, BorderLayout.CENTER); this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); } @@ -44,28 +49,43 @@ public class VanChartFieldAttrPane extends JPanel { return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{d, e}); } }; + intervalTimeBox = new UIComboBox(IntervalTimeFormat.getFormats()); + dataFunctionBox = new CalculateComboBox(); - fieldDataFunction = new CalculateComboBox(); - - Component[][] components = new Component[][]{ + Component[][] intervalTimeComponents = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), intervalTimeBox} + }; + Component[][] dataFunctionComponents = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldDataFunction} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), dataFunctionBox} }; - fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{d, e}); - } + intervalTimePane = TableLayout4VanChartHelper.createGapTableLayoutPane(intervalTimeComponents, new double[]{p, p}, new double[]{d, e}); - public void registerFunctionListener(ActionListener listener) { - fieldDataFunction.addActionListener(listener); + formatPane = new JPanel(new BorderLayout()); + formatPane.add(fieldFormatPane, BorderLayout.NORTH); + formatPane.add(intervalTimePane, BorderLayout.CENTER); + + fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(dataFunctionComponents, new double[]{p, p}, new double[]{d, e}); } - public void registerChangeListener(UIObserverListener listener) { + public void registerFormatListener(UIObserverListener listener) { fieldFormatPane.registerChangeListener(listener); + intervalTimeBox.registerChangeListener(listener); } - public void populate(Format format, AbstractDataFunction dataFunction, boolean showDataFunction) { + public void registerFunctionListener(ActionListener listener) { + dataFunctionBox.addActionListener(listener); + } + + public void populate(Format format, IntervalTimeFormat intervalTime, AbstractDataFunction dataFunction, boolean showDataFunction, boolean showIntervalTime) { fieldFormatPane.populateBean(format); - fieldDataFunction.populateBean(dataFunction); + intervalTimeBox.setSelectedItem(intervalTime); + dataFunctionBox.populateBean(dataFunction); + + fieldFormatPane.setVisible(!showIntervalTime); + intervalTimePane.setVisible(showIntervalTime); fieldFunctionPane.setVisible(showDataFunction); } @@ -73,7 +93,11 @@ public class VanChartFieldAttrPane extends JPanel { return fieldFormatPane.update(); } + public IntervalTimeFormat updateIntervalTime() { + return (IntervalTimeFormat) intervalTimeBox.getSelectedItem(); + } + public AbstractDataFunction updateDataFunction() { - return fieldDataFunction.updateBean(); + return dataFunctionBox.updateBean(); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index 74bf77030..1e76d616c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -7,7 +7,9 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -33,16 +35,27 @@ public class VanChartFieldButton extends JPanel { private final AttrTooltipFormat tooltipFormat; private final boolean showDataFunction; + private final boolean showIntervalTime; private UIToggleButton fieldButton; private UIButton addButton; private DataFunction dataFunction = new NoneFunction(); + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, VanChartFieldListener listener) { + this(fieldName, format, false, false, listener); + } + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { + this(fieldName, format, showDataFunction, false, listener); + } + + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, boolean showIntervalTime, VanChartFieldListener listener) { this.fieldName = fieldName; this.tooltipFormat = format; + this.showDataFunction = showDataFunction; + this.showIntervalTime = showIntervalTime; this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey(); @@ -72,6 +85,20 @@ public class VanChartFieldButton extends JPanel { this.tooltipFormat.setFormat(format); } + public IntervalTimeFormat getIntervalTimeFormat() { + if (tooltipFormat instanceof AttrTooltipDurationFormat) { + return ((AttrTooltipDurationFormat) tooltipFormat).getIntervalTimeFormat(); + } + + return IntervalTimeFormat.DAY; + } + + public void setIntervalTimeFormat(IntervalTimeFormat intervalTime) { + if (tooltipFormat instanceof AttrTooltipDurationFormat) { + ((AttrTooltipDurationFormat) tooltipFormat).setIntervalTimeFormat(intervalTime); + } + } + public DataFunction getDataFunction() { return dataFunction; } @@ -84,6 +111,10 @@ public class VanChartFieldButton extends JPanel { return showDataFunction; } + public boolean isShowIntervalTime() { + return showIntervalTime; + } + public String getFormatJs() { return this.tooltipFormat.getJs(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index 2d6b4b579..60a0b1158 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -11,11 +11,13 @@ import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.TableFieldCollection; import com.fr.plugin.chart.base.TableFieldDefinition; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipFieldFormat; 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.plugin.chart.base.format.IntervalTimeFormat; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; @@ -242,10 +244,13 @@ public class VanChartFieldListPane extends JPanel { } Format format = fieldButton.getFormat(); + IntervalTimeFormat intervalTime = fieldButton.getIntervalTimeFormat(); AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction(); + boolean showDataFunction = fieldButton.isShowDataFunction(); + boolean showIntervalTime = fieldButton.isShowIntervalTime(); - fieldAttrPane.populate(format, dataFunction, showDataFunction); + fieldAttrPane.populate(format, intervalTime, dataFunction, showDataFunction, showIntervalTime); } public void updateFieldFormatPane() { @@ -256,6 +261,7 @@ public class VanChartFieldListPane extends JPanel { } fieldButton.setFormat(fieldAttrPane.updateFormat()); + fieldButton.setIntervalTimeFormat(fieldAttrPane.updateIntervalTime()); fieldButton.setDataFunction(fieldAttrPane.updateDataFunction()); if (tableFieldNameList.contains(fieldName)) { @@ -276,7 +282,7 @@ public class VanChartFieldListPane extends JPanel { } }); - fieldAttrPane.registerChangeListener(new UIObserverListener() { + fieldAttrPane.registerFormatListener(new UIObserverListener() { public void doChange() { fieldListener.updateFieldFormatPane(); } @@ -317,6 +323,10 @@ public class VanChartFieldListPane extends JPanel { button.setEnable(format.isEnable()); button.setFormat(format.getFormat()); + + if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) { + button.setIntervalTimeFormat(((AttrTooltipDurationFormat) format).getIntervalTimeFormat()); + } } public void populateTableField(AttrTooltipContent tooltipContent) { @@ -378,5 +388,9 @@ public class VanChartFieldListPane extends JPanel { format.setEnable(button.isEnable()); format.setFormat(button.getFormat()); + + if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) { + ((AttrTooltipDurationFormat) format).setIntervalTimeFormat(button.getIntervalTimeFormat()); + } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java new file mode 100644 index 000000000..6332c6757 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java @@ -0,0 +1,107 @@ +package com.fr.van.chart.gantt.designer.style.tooltip; + +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.AttrTooltipDurationFormat; +import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipStartTimeFormat; +import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; +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 VanChartGanttRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton richTextProcessesFormatPane; + private VanChartFieldButton richTextStartTimeFormatPane; + private VanChartFieldButton richTextEndTimeFormatPane; + private VanChartFieldButton richTextDurationFormatPane; + private VanChartFieldButton richTextProgressFormatPane; + + public VanChartGanttRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener listener = getFieldListener(); + + richTextProcessesFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Project_Name"), + new AttrTooltipProcessesFormat(), false, listener); + + setSeriesNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, listener)); + + richTextStartTimeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Start_Time"), + new AttrTooltipStartTimeFormat(), false, listener); + + richTextEndTimeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_End_Time"), + new AttrTooltipEndTimeFormat(), false, listener); + + richTextDurationFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Duration_Time"), + new AttrTooltipDurationFormat(), false, true, listener); + + richTextProgressFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Process"), + new AttrTooltipProgressFormat(), false, listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(richTextProcessesFormatPane); + fieldPane.add(getSeriesNameButton()); + fieldPane.add(richTextStartTimeFormatPane); + fieldPane.add(richTextEndTimeFormatPane); + fieldPane.add(richTextDurationFormatPane); + fieldPane.add(richTextProgressFormatPane); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(richTextProcessesFormatPane); + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(richTextStartTimeFormatPane); + fieldButtonList.add(richTextEndTimeFormatPane); + fieldButtonList.add(richTextDurationFormatPane); + fieldButtonList.add(richTextProgressFormatPane); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent gantt = (AttrGanttTooltipContent) tooltipContent; + + populateButtonFormat(richTextProcessesFormatPane, gantt.getRichTextProcessesFormat()); + populateButtonFormat(richTextStartTimeFormatPane, gantt.getRichTextStartTimeFormat()); + populateButtonFormat(richTextEndTimeFormatPane, gantt.getRichTextEndTimeFormat()); + populateButtonFormat(richTextDurationFormatPane, gantt.getRichTextDurationFormat()); + populateButtonFormat(richTextProgressFormatPane, gantt.getRichTextProgressFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent gantt = (AttrGanttTooltipContent) tooltipContent; + + updateButtonFormat(richTextProcessesFormatPane, gantt.getRichTextProcessesFormat()); + updateButtonFormat(richTextStartTimeFormatPane, gantt.getRichTextStartTimeFormat()); + updateButtonFormat(richTextEndTimeFormatPane, gantt.getRichTextEndTimeFormat()); + updateButtonFormat(richTextDurationFormatPane, gantt.getRichTextDurationFormat()); + updateButtonFormat(richTextProgressFormatPane, gantt.getRichTextProgressFormat()); + } + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java index d724deff5..6868a0c87 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java @@ -1,10 +1,11 @@ package com.fr.van.chart.gantt.designer.style.tooltip; 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.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat; import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; @@ -12,14 +13,15 @@ import com.fr.plugin.chart.base.format.AttrTooltipStartTimeFormat; import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; 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.VanChartFormatPaneWithCheckBox; -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; import java.awt.Component; -import java.util.Map; /** * Created by hufan on 2017/1/13. @@ -31,12 +33,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane private VanChartFormatComBoxWithCheckBox durationFormatPane; private VanChartFormatPaneWithCheckBox progressFormatPane; - private VanChartFormatPaneWithoutCheckBox richTextProcessesFormatPane; - private VanChartDateFormatPaneWithoutCheckBox richTextStartTimeFormatPane; - private VanChartDateFormatPaneWithoutCheckBox richTextEndTimeFormatPane; - private VanChartFormatComBoxWithoutCheckBox richTextDurationFormatPane; - private VanChartFormatPaneWithoutCheckBox richTextProgressFormatPane; - public VanChartGanttTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { super(parent, showOnPane); } @@ -70,28 +66,39 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane }; } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - richTextProcessesFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Project_Name"); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartGanttRichTextFieldListPane(fieldAttrPane, richEditor); } - }; - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - richTextStartTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Start_Time"); + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); } }; - richTextEndTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_End_Time"); - } + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Project_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Start_Time"), + Toolkit.i18nText("Fine-Design_Chart_End_Time"), + Toolkit.i18nText("Fine-Design_Chart_Duration_Time"), + Toolkit.i18nText("Fine-Design_Chart_Process") }; - richTextDurationFormatPane = new VanChartFormatComBoxWithoutCheckBox(); - richTextProgressFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Process"); - } + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipProcessesFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipStartTimeFormat(), + new AttrTooltipEndTimeFormat(), + new AttrTooltipDurationFormat(), + new AttrTooltipProgressFormat() }; } @@ -106,17 +113,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{richTextProcessesFormatPane,null}, - new Component[]{getRichTextSeriesNameFormatPane(),null}, - new Component[]{richTextStartTimeFormatPane,null}, - new Component[]{richTextEndTimeFormatPane,null}, - new Component[]{richTextDurationFormatPane, null}, - new Component[]{richTextProgressFormatPane, null} - }; - } - protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p,p}; } @@ -135,43 +131,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - if(attrTooltipContent instanceof AttrGanttTooltipContent){ - setRichTextAttr(new AttrTooltipRichText()); - - AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; - Map params = getRichTextAttr().getParams(); - - AttrTooltipProcessesFormat processesFormat = ganttTooltipContent.getRichTextProcessesFormat(); - richTextProcessesFormatPane.populate(processesFormat); - richTextProcessesFormatPane.updateFormatParams(params, processesFormat.getJs()); - - AttrTooltipSeriesFormat seriesFormat = ganttTooltipContent.getRichTextSeriesFormat(); - getRichTextSeriesNameFormatPane().populate(seriesFormat); - getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs()); - - AttrTooltipStartTimeFormat startTimeFormat = ganttTooltipContent.getRichTextStartTimeFormat(); - richTextStartTimeFormatPane.populate(startTimeFormat); - richTextStartTimeFormatPane.updateFormatParams(params, startTimeFormat.getJs()); - - AttrTooltipEndTimeFormat endTimeFormat = ganttTooltipContent.getRichTextEndTimeFormat(); - richTextEndTimeFormatPane.populate(endTimeFormat); - richTextEndTimeFormatPane.updateFormatParams(params, endTimeFormat.getJs()); - - AttrTooltipDurationFormat durationFormat = ganttTooltipContent.getRichTextDurationFormat(); - richTextDurationFormatPane.populate(durationFormat); - richTextDurationFormatPane.updateFormatParams(params, durationFormat.getJs()); - - AttrTooltipProgressFormat progressFormat = ganttTooltipContent.getRichTextProgressFormat(); - richTextProgressFormatPane.populate(progressFormat); - richTextProgressFormatPane.updateFormatParams(params, progressFormat.getJs()); - - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); - } - } - protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { if (attrTooltipContent instanceof AttrGanttTooltipContent){ AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; @@ -184,16 +143,18 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - if(attrTooltipContent instanceof AttrGanttTooltipContent) { - AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); + + if (target instanceof AttrGanttTooltipContent && source instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent targetGantt = (AttrGanttTooltipContent) target; + AttrGanttTooltipContent sourceGantt = (AttrGanttTooltipContent) source; - richTextProcessesFormatPane.update(ganttTooltipContent.getRichTextProcessesFormat()); - getRichTextSeriesNameFormatPane().update(ganttTooltipContent.getRichTextSeriesFormat()); - richTextStartTimeFormatPane.update(ganttTooltipContent.getRichTextStartTimeFormat()); - richTextEndTimeFormatPane.update(ganttTooltipContent.getRichTextEndTimeFormat()); - richTextDurationFormatPane.update(ganttTooltipContent.getRichTextDurationFormat()); - richTextProgressFormatPane.update(ganttTooltipContent.getRichTextProgressFormat()); + targetGantt.setRichTextProcessesFormat(sourceGantt.getRichTextProcessesFormat()); + targetGantt.setRichTextStartTimeFormat(sourceGantt.getRichTextStartTimeFormat()); + targetGantt.setRichTextEndTimeFormat(sourceGantt.getRichTextEndTimeFormat()); + targetGantt.setRichTextDurationFormat(sourceGantt.getRichTextDurationFormat()); + targetGantt.setRichTextProgressFormat(sourceGantt.getRichTextProgressFormat()); } }