Browse Source

散点图富文本新增字段适配

persist/11.0
Qinghui.Liu 4 years ago
parent
commit
51f08486e5
  1. 28
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  2. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java
  3. 10
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java
  4. 9
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java
  5. 93
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java
  6. 114
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java

28
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -115,9 +115,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
this.parent = parent; this.parent = parent;
this.showOnPane = showOnPane; this.showOnPane = showOnPane;
this.richTextTooltipContent = new AttrTooltipContent();
initFormatPane(parent, showOnPane); initFormatPane(parent, showOnPane);
initRichTextTooltipContent();
initRichTextFormatPane(parent, showOnPane); initRichTextFormatPane(parent, showOnPane);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -244,6 +243,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
this.richTextTooltipContent.setRichTextAttr(richText); this.richTextTooltipContent.setRichTextAttr(richText);
} }
public void setRichTextTooltipContent(AttrTooltipContent richTextTooltipContent) {
this.richTextTooltipContent = richTextTooltipContent;
}
private JPanel createLabelContentPane() { private JPanel createLabelContentPane() {
initDetailPane(); initDetailPane();
initCenterPane(); initCenterPane();
@ -311,6 +314,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return Toolkit.i18nText("Fine-Design_Report_Text"); return Toolkit.i18nText("Fine-Design_Report_Text");
} }
protected void initRichTextTooltipContent() {
this.richTextTooltipContent = new AttrTooltipContent();
}
protected JPanel getLabelContentPane(JPanel contentPane) { protected JPanel getLabelContentPane(JPanel contentPane) {
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane); return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane);
} }
@ -486,20 +493,27 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return new VanChartRichTextPane(richEditorPane); return new VanChartRichTextPane(richEditorPane);
} }
protected void refreshRichTextParams(AttrTooltipRichText richText) { protected String[] getRichTextFieldNames() {
String[] fieldNames = new String[]{ return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"), Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value"), Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent") Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
}; };
}
AttrTooltipFormat[] fieldFormats = new AttrTooltipFormat[]{ protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(), new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(), new AttrTooltipSeriesFormat(),
new AttrTooltipValueFormat(), new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat() new AttrTooltipPercentFormat()
}; };
}
private void refreshRichTextParams(AttrTooltipRichText richText) {
String[] fieldNames = getRichTextFieldNames();
AttrTooltipFormat[] fieldFormats = getRichTextFieldFormats();
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
@ -874,6 +888,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
if (target == null || source == null) {
return;
}
// 更新富文本字段格式 // 更新富文本字段格式
target.setRichTextCategoryFormat(source.getRichTextCategoryFormat()); target.setRichTextCategoryFormat(source.getRichTextCategoryFormat());
target.setRichTextSeriesFormat(source.getRichTextSeriesFormat()); target.setRichTextSeriesFormat(source.getRichTextSeriesFormat());

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java

@ -68,18 +68,34 @@ public class VanChartFieldListPane extends JPanel {
this.add(createTableFieldPane(), BorderLayout.SOUTH); this.add(createTableFieldPane(), BorderLayout.SOUTH);
} }
public VanChartFieldButton getCategoryNameButton() {
return categoryNameButton;
}
public void setCategoryNameButton(VanChartFieldButton categoryNameButton) { public void setCategoryNameButton(VanChartFieldButton categoryNameButton) {
this.categoryNameButton = categoryNameButton; this.categoryNameButton = categoryNameButton;
} }
public VanChartFieldButton getSeriesNameButton() {
return seriesNameButton;
}
public void setSeriesNameButton(VanChartFieldButton seriesNameButton) { public void setSeriesNameButton(VanChartFieldButton seriesNameButton) {
this.seriesNameButton = seriesNameButton; this.seriesNameButton = seriesNameButton;
} }
public VanChartFieldButton getValueButton() {
return valueButton;
}
public void setValueButton(VanChartFieldButton valueButton) { public void setValueButton(VanChartFieldButton valueButton) {
this.valueButton = valueButton; this.valueButton = valueButton;
} }
public VanChartFieldButton getPercentButton() {
return percentButton;
}
public void setPercentButton(VanChartFieldButton percentButton) { public void setPercentButton(VanChartFieldButton percentButton) {
this.percentButton = percentButton; this.percentButton = percentButton;
} }

10
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java

@ -33,6 +33,10 @@ public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH); this.add(createRichEditorPane(richEditor), BorderLayout.SOUTH);
} }
public VanChartFieldListPane getFieldListPane() {
return fieldListPane;
}
private JPanel createFieldContentPane() { private JPanel createFieldContentPane() {
JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
@ -71,12 +75,16 @@ public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
return richEditorPane; return richEditorPane;
} }
protected AttrTooltipContent getInitialTooltipContent() {
return new AttrTooltipContent();
}
public void populateBean(AttrTooltipContent tooltipContent) { public void populateBean(AttrTooltipContent tooltipContent) {
fieldListPane.populate(tooltipContent); fieldListPane.populate(tooltipContent);
} }
public AttrTooltipContent updateBean() { public AttrTooltipContent updateBean() {
AttrTooltipContent content = new AttrTooltipContent(); AttrTooltipContent content = getInitialTooltipContent();
fieldListPane.update(content); fieldListPane.update(content);
return content; return content;
} }

9
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java

@ -62,14 +62,7 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo
@Override @Override
protected Component[][] getRichTextComponents() { protected Component[][] getRichTextComponents() {
return new Component[][]{ return null;
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextXFormatPane(), null},
new Component[]{getRichTextYFormatPane(), null},
new Component[]{getRichTextSizeFormatPane(), null},
new Component[]{richTextChangedSizeFormatPane, null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
};
} }

93
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRichTextFieldListPane.java

@ -0,0 +1,93 @@
package com.fr.van.chart.scatter;
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.AttrTooltipSizeFormat;
import com.fr.plugin.chart.base.format.AttrTooltipXFormat;
import com.fr.plugin.chart.base.format.AttrTooltipYFormat;
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent;
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 VanChartScatterRichTextFieldListPane extends VanChartFieldListPane {
private VanChartFieldButton richTextXFormatPane;
private VanChartFieldButton richTextYFormatPane;
private VanChartFieldButton richTextSizeFormatPane;
public VanChartScatterRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
public VanChartFieldButton getRichTextXFormatPane() {
return richTextXFormatPane;
}
public VanChartFieldButton getRichTextYFormatPane() {
return richTextYFormatPane;
}
public VanChartFieldButton getRichTextSizeFormatPane() {
return richTextSizeFormatPane;
}
protected void initDefaultFieldButton() {
super.initDefaultFieldButton();
VanChartFieldListener listener = getFieldListener();
richTextXFormatPane = new VanChartFieldButton("x", new AttrTooltipXFormat(), false, listener);
richTextYFormatPane = new VanChartFieldButton("y", new AttrTooltipYFormat(), false, listener);
richTextSizeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), new AttrTooltipSizeFormat(), false, listener);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getSeriesNameButton());
fieldPane.add(richTextXFormatPane);
fieldPane.add(richTextYFormatPane);
fieldPane.add(richTextSizeFormatPane);
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getSeriesNameButton());
fieldButtonList.add(richTextXFormatPane);
fieldButtonList.add(richTextYFormatPane);
fieldButtonList.add(richTextSizeFormatPane);
return fieldButtonList;
}
public void populateDefaultField(AttrTooltipContent tooltipContent) {
super.populateDefaultField(tooltipContent);
if (tooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent;
populateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat());
populateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat());
populateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat());
}
}
public void updateDefaultField(AttrTooltipContent tooltipContent) {
super.updateDefaultField(tooltipContent);
if (tooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatter = (ScatterAttrTooltipContent) tooltipContent;
updateButtonFormat(richTextXFormatPane, scatter.getRichTextXFormat());
updateButtonFormat(richTextYFormatPane, scatter.getRichTextYFormat());
updateButtonFormat(richTextSizeFormatPane, scatter.getRichTextSizeFormat());
}
}
}

114
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterTooltipContentPane.java

@ -1,17 +1,22 @@
package com.fr.van.chart.scatter; package com.fr.van.chart.scatter;
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.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSizeFormat;
import com.fr.plugin.chart.base.format.AttrTooltipXFormat;
import com.fr.plugin.chart.base.format.AttrTooltipYFormat;
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; 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.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.XFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.XFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.XFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.YFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.YFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.YFormatPaneWithoutCheckBox; 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;
@ -26,10 +31,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
private YFormatPaneWithCheckBox yFormatPane; private YFormatPaneWithCheckBox yFormatPane;
private ValueFormatPaneWithCheckBox sizeFormatPane; private ValueFormatPaneWithCheckBox sizeFormatPane;
private XFormatPaneWithoutCheckBox richTextXFormatPane;
private YFormatPaneWithoutCheckBox richTextYFormatPane;
private ValueFormatPaneWithoutCheckBox richTextSizeFormatPane;
public XFormatPaneWithCheckBox getXFormatPane() { public XFormatPaneWithCheckBox getXFormatPane() {
return xFormatPane; return xFormatPane;
} }
@ -42,18 +43,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
return sizeFormatPane; return sizeFormatPane;
} }
public XFormatPaneWithoutCheckBox getRichTextXFormatPane() {
return richTextXFormatPane;
}
public YFormatPaneWithoutCheckBox getRichTextYFormatPane() {
return richTextYFormatPane;
}
public ValueFormatPaneWithoutCheckBox getRichTextSizeFormatPane() {
return richTextSizeFormatPane;
}
public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){
super(parent, showOnPane); super(parent, showOnPane);
} }
@ -71,13 +60,22 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
} }
@Override protected void initRichTextTooltipContent() {
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { setRichTextTooltipContent(new ScatterAttrTooltipContent());
super.initRichTextFormatPane(parent, showOnPane); }
protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
return new VanChartRichTextPane(richEditorPane) {
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartScatterRichTextFieldListPane(fieldAttrPane, richEditor);
}
richTextXFormatPane = new XFormatPaneWithoutCheckBox(parent, showOnPane); protected AttrTooltipContent getInitialTooltipContent() {
richTextYFormatPane = new YFormatPaneWithoutCheckBox(parent, showOnPane); return new ScatterAttrTooltipContent();
richTextSizeFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); }
};
} }
@Override @Override
@ -90,16 +88,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
}; };
} }
@Override
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{richTextXFormatPane, null},
new Component[]{richTextYFormatPane, null},
new Component[]{richTextSizeFormatPane, null}
};
}
@Override @Override
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
super.populateFormatPane(attrTooltipContent); super.populateFormatPane(attrTooltipContent);
@ -111,30 +99,20 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
} }
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { protected String[] getRichTextFieldNames() {
if (attrTooltipContent instanceof ScatterAttrTooltipContent) { return new String[]{
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
"x",
"y",
Toolkit.i18nText("Fine-Design_Chart_Use_Value")};
}
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ protected AttrTooltipFormat[] getRichTextFieldFormats() {
getRichTextSeriesNameFormatPane(), return new AttrTooltipFormat[]{
richTextXFormatPane, new AttrTooltipSeriesFormat(),
richTextYFormatPane, new AttrTooltipXFormat(),
richTextSizeFormatPane new AttrTooltipYFormat(),
}; new AttrTooltipSizeFormat()};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
scatterAttrTooltipContent.getRichTextSeriesFormat(),
scatterAttrTooltipContent.getRichTextXFormat(),
scatterAttrTooltipContent.getRichTextYFormat(),
scatterAttrTooltipContent.getRichTextSizeFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
} }
@Override @Override
@ -148,14 +126,16 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
} }
} }
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
super.updateRichEditor(attrTooltipContent); super.updateTooltipFormat(target, source);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) { if (target instanceof ScatterAttrTooltipContent && source instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; ScatterAttrTooltipContent targetScatter = (ScatterAttrTooltipContent) target;
richTextXFormatPane.update(scatterAttrTooltipContent.getRichTextXFormat()); ScatterAttrTooltipContent sourceScatter = (ScatterAttrTooltipContent) source;
richTextYFormatPane.update(scatterAttrTooltipContent.getRichTextYFormat());
richTextSizeFormatPane.update(scatterAttrTooltipContent.getRichTextSizeFormat()); targetScatter.setRichTextXFormat(sourceScatter.getRichTextXFormat());
targetScatter.setRichTextYFormat(sourceScatter.getRichTextYFormat());
targetScatter.setRichTextSizeFormat(sourceScatter.getRichTextSizeFormat());
} }
} }

Loading…
Cancel
Save