Browse Source

适配甘特图

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
6475734917
  1. 52
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java
  2. 31
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java
  3. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  4. 107
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java
  5. 127
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java

52
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.data.util.function.AbstractDataFunction;
import com.fr.design.event.UIObserverListener; 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.ilable.UILabel;
import com.fr.design.gui.style.FormatPane; import com.fr.design.gui.style.FormatPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; 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.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont;
@ -21,15 +23,18 @@ import java.text.Format;
public class VanChartFieldAttrPane extends JPanel { public class VanChartFieldAttrPane extends JPanel {
private FormatPane fieldFormatPane; private FormatPane fieldFormatPane;
private CalculateComboBox fieldDataFunction; private UIComboBox intervalTimeBox;
private CalculateComboBox dataFunctionBox;
private JPanel formatPane;
private JPanel intervalTimePane;
private JPanel fieldFunctionPane; private JPanel fieldFunctionPane;
public VanChartFieldAttrPane() { public VanChartFieldAttrPane() {
initComponents(); initComponents();
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(fieldFormatPane, BorderLayout.NORTH); this.add(formatPane, BorderLayout.NORTH);
this.add(fieldFunctionPane, BorderLayout.CENTER); this.add(fieldFunctionPane, BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); 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}); 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[][] intervalTimeComponents = new Component[][]{
new Component[]{null, null},
Component[][] components = new Component[][]{ new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), intervalTimeBox}
};
Component[][] dataFunctionComponents = new Component[][]{
new Component[]{null, null}, 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) { formatPane = new JPanel(new BorderLayout());
fieldDataFunction.addActionListener(listener); 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); 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); fieldFormatPane.populateBean(format);
fieldDataFunction.populateBean(dataFunction); intervalTimeBox.setSelectedItem(intervalTime);
dataFunctionBox.populateBean(dataFunction);
fieldFormatPane.setVisible(!showIntervalTime);
intervalTimePane.setVisible(showIntervalTime);
fieldFunctionPane.setVisible(showDataFunction); fieldFunctionPane.setVisible(showDataFunction);
} }
@ -73,7 +93,11 @@ public class VanChartFieldAttrPane extends JPanel {
return fieldFormatPane.update(); return fieldFormatPane.update();
} }
public IntervalTimeFormat updateIntervalTime() {
return (IntervalTimeFormat) intervalTimeBox.getSelectedItem();
}
public AbstractDataFunction updateDataFunction() { public AbstractDataFunction updateDataFunction() {
return fieldDataFunction.updateBean(); return dataFunctionBox.updateBean();
} }
} }

31
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.gui.ibutton.UIToggleButton;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; 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.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.IntervalTimeFormat;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -33,16 +35,27 @@ public class VanChartFieldButton extends JPanel {
private final AttrTooltipFormat tooltipFormat; private final AttrTooltipFormat tooltipFormat;
private final boolean showDataFunction; private final boolean showDataFunction;
private final boolean showIntervalTime;
private UIToggleButton fieldButton; private UIToggleButton fieldButton;
private UIButton addButton; private UIButton addButton;
private DataFunction dataFunction = new NoneFunction(); 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) { 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.fieldName = fieldName;
this.tooltipFormat = format; this.tooltipFormat = format;
this.showDataFunction = showDataFunction; this.showDataFunction = showDataFunction;
this.showIntervalTime = showIntervalTime;
this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey(); this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey();
@ -72,6 +85,20 @@ public class VanChartFieldButton extends JPanel {
this.tooltipFormat.setFormat(format); 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() { public DataFunction getDataFunction() {
return dataFunction; return dataFunction;
} }
@ -84,6 +111,10 @@ public class VanChartFieldButton extends JPanel {
return showDataFunction; return showDataFunction;
} }
public boolean isShowIntervalTime() {
return showIntervalTime;
}
public String getFormatJs() { public String getFormatJs() {
return this.tooltipFormat.getJs(); return this.tooltipFormat.getJs();
} }

18
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.TableFieldCollection;
import com.fr.plugin.chart.base.TableFieldDefinition; import com.fr.plugin.chart.base.TableFieldDefinition;
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; 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.AttrTooltipFieldFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.plugin.chart.base.format.IntervalTimeFormat;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -242,10 +244,13 @@ public class VanChartFieldListPane extends JPanel {
} }
Format format = fieldButton.getFormat(); Format format = fieldButton.getFormat();
IntervalTimeFormat intervalTime = fieldButton.getIntervalTimeFormat();
AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction(); AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction();
boolean showDataFunction = fieldButton.isShowDataFunction(); boolean showDataFunction = fieldButton.isShowDataFunction();
boolean showIntervalTime = fieldButton.isShowIntervalTime();
fieldAttrPane.populate(format, dataFunction, showDataFunction); fieldAttrPane.populate(format, intervalTime, dataFunction, showDataFunction, showIntervalTime);
} }
public void updateFieldFormatPane() { public void updateFieldFormatPane() {
@ -256,6 +261,7 @@ public class VanChartFieldListPane extends JPanel {
} }
fieldButton.setFormat(fieldAttrPane.updateFormat()); fieldButton.setFormat(fieldAttrPane.updateFormat());
fieldButton.setIntervalTimeFormat(fieldAttrPane.updateIntervalTime());
fieldButton.setDataFunction(fieldAttrPane.updateDataFunction()); fieldButton.setDataFunction(fieldAttrPane.updateDataFunction());
if (tableFieldNameList.contains(fieldName)) { if (tableFieldNameList.contains(fieldName)) {
@ -276,7 +282,7 @@ public class VanChartFieldListPane extends JPanel {
} }
}); });
fieldAttrPane.registerChangeListener(new UIObserverListener() { fieldAttrPane.registerFormatListener(new UIObserverListener() {
public void doChange() { public void doChange() {
fieldListener.updateFieldFormatPane(); fieldListener.updateFieldFormatPane();
} }
@ -317,6 +323,10 @@ public class VanChartFieldListPane extends JPanel {
button.setEnable(format.isEnable()); button.setEnable(format.isEnable());
button.setFormat(format.getFormat()); button.setFormat(format.getFormat());
if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) {
button.setIntervalTimeFormat(((AttrTooltipDurationFormat) format).getIntervalTimeFormat());
}
} }
public void populateTableField(AttrTooltipContent tooltipContent) { public void populateTableField(AttrTooltipContent tooltipContent) {
@ -378,5 +388,9 @@ public class VanChartFieldListPane extends JPanel {
format.setEnable(button.isEnable()); format.setEnable(button.isEnable());
format.setFormat(button.getFormat()); format.setFormat(button.getFormat());
if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) {
((AttrTooltipDurationFormat) format).setIntervalTimeFormat(button.getIntervalTimeFormat());
}
} }
} }

107
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<VanChartRichEditorModel> 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<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> 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());
}
}
}

127
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; package com.fr.van.chart.gantt.designer.style.tooltip;
import com.fr.design.i18n.Toolkit; 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.AttrTooltipContent;
import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat;
import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; 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.AttrTooltipProcessesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat; import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; 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.plugin.chart.gantt.attr.AttrGanttTooltipContent;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; 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.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.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 com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Component; import java.awt.Component;
import java.util.Map;
/** /**
* Created by hufan on 2017/1/13. * Created by hufan on 2017/1/13.
@ -31,12 +33,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
private VanChartFormatComBoxWithCheckBox durationFormatPane; private VanChartFormatComBoxWithCheckBox durationFormatPane;
private VanChartFormatPaneWithCheckBox progressFormatPane; private VanChartFormatPaneWithCheckBox progressFormatPane;
private VanChartFormatPaneWithoutCheckBox richTextProcessesFormatPane;
private VanChartDateFormatPaneWithoutCheckBox richTextStartTimeFormatPane;
private VanChartDateFormatPaneWithoutCheckBox richTextEndTimeFormatPane;
private VanChartFormatComBoxWithoutCheckBox richTextDurationFormatPane;
private VanChartFormatPaneWithoutCheckBox richTextProgressFormatPane;
public VanChartGanttTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { public VanChartGanttTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane); super(parent, showOnPane);
} }
@ -70,28 +66,39 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
}; };
} }
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
richTextProcessesFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){
protected String getCheckBoxText() { return new VanChartRichTextPane(richEditorPane) {
return Toolkit.i18nText("Fine-Design_Chart_Project_Name");
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartGanttRichTextFieldListPane(fieldAttrPane, richEditor);
} }
};
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); protected AttrTooltipContent getInitialTooltipContent() {
richTextStartTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){ return createAttrTooltip();
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Start_Time");
} }
}; };
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){ protected double[] getRowSize(double p){
return new double[]{p,p,p,p,p,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<String, String> 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) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent instanceof AttrGanttTooltipContent){ if (attrTooltipContent instanceof AttrGanttTooltipContent){
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
@ -184,16 +143,18 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane
} }
} }
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
if(attrTooltipContent instanceof AttrGanttTooltipContent) { super.updateTooltipFormat(target, source);
AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent;
if (target instanceof AttrGanttTooltipContent && source instanceof AttrGanttTooltipContent) {
AttrGanttTooltipContent targetGantt = (AttrGanttTooltipContent) target;
AttrGanttTooltipContent sourceGantt = (AttrGanttTooltipContent) source;
richTextProcessesFormatPane.update(ganttTooltipContent.getRichTextProcessesFormat()); targetGantt.setRichTextProcessesFormat(sourceGantt.getRichTextProcessesFormat());
getRichTextSeriesNameFormatPane().update(ganttTooltipContent.getRichTextSeriesFormat()); targetGantt.setRichTextStartTimeFormat(sourceGantt.getRichTextStartTimeFormat());
richTextStartTimeFormatPane.update(ganttTooltipContent.getRichTextStartTimeFormat()); targetGantt.setRichTextEndTimeFormat(sourceGantt.getRichTextEndTimeFormat());
richTextEndTimeFormatPane.update(ganttTooltipContent.getRichTextEndTimeFormat()); targetGantt.setRichTextDurationFormat(sourceGantt.getRichTextDurationFormat());
richTextDurationFormatPane.update(ganttTooltipContent.getRichTextDurationFormat()); targetGantt.setRichTextProgressFormat(sourceGantt.getRichTextProgressFormat());
richTextProgressFormatPane.update(ganttTooltipContent.getRichTextProgressFormat());
} }
} }

Loading…
Cancel
Save