Browse Source

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

research/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.showOnPane = showOnPane;
this.richTextTooltipContent = new AttrTooltipContent();
initFormatPane(parent, showOnPane);
initRichTextTooltipContent();
initRichTextFormatPane(parent, showOnPane);
this.setLayout(new BorderLayout());
@ -244,6 +243,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
this.richTextTooltipContent.setRichTextAttr(richText);
}
public void setRichTextTooltipContent(AttrTooltipContent richTextTooltipContent) {
this.richTextTooltipContent = richTextTooltipContent;
}
private JPanel createLabelContentPane() {
initDetailPane();
initCenterPane();
@ -311,6 +314,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return Toolkit.i18nText("Fine-Design_Report_Text");
}
protected void initRichTextTooltipContent() {
this.richTextTooltipContent = new AttrTooltipContent();
}
protected JPanel getLabelContentPane(JPanel contentPane) {
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), contentPane);
}
@ -486,20 +493,27 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return new VanChartRichTextPane(richEditorPane);
}
protected void refreshRichTextParams(AttrTooltipRichText richText) {
String[] fieldNames = new String[]{
protected String[] getRichTextFieldNames() {
return 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[]{
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSeriesFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
}
private void refreshRichTextParams(AttrTooltipRichText richText) {
String[] fieldNames = getRichTextFieldNames();
AttrTooltipFormat[] fieldFormats = getRichTextFieldFormats();
Map<String, String> params = new HashMap<>();
@ -874,6 +888,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
if (target == null || source == null) {
return;
}
// 更新富文本字段格式
target.setRichTextCategoryFormat(source.getRichTextCategoryFormat());
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);
}
public VanChartFieldButton getCategoryNameButton() {
return categoryNameButton;
}
public void setCategoryNameButton(VanChartFieldButton categoryNameButton) {
this.categoryNameButton = categoryNameButton;
}
public VanChartFieldButton getSeriesNameButton() {
return seriesNameButton;
}
public void setSeriesNameButton(VanChartFieldButton seriesNameButton) {
this.seriesNameButton = seriesNameButton;
}
public VanChartFieldButton getValueButton() {
return valueButton;
}
public void setValueButton(VanChartFieldButton valueButton) {
this.valueButton = valueButton;
}
public VanChartFieldButton getPercentButton() {
return percentButton;
}
public void setPercentButton(VanChartFieldButton 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);
}
public VanChartFieldListPane getFieldListPane() {
return fieldListPane;
}
private JPanel createFieldContentPane() {
JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
@ -71,12 +75,16 @@ public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
return richEditorPane;
}
protected AttrTooltipContent getInitialTooltipContent() {
return new AttrTooltipContent();
}
public void populateBean(AttrTooltipContent tooltipContent) {
fieldListPane.populate(tooltipContent);
}
public AttrTooltipContent updateBean() {
AttrTooltipContent content = new AttrTooltipContent();
AttrTooltipContent content = getInitialTooltipContent();
fieldListPane.update(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
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextXFormatPane(), null},
new Component[]{getRichTextYFormatPane(), null},
new Component[]{getRichTextSizeFormatPane(), null},
new Component[]{richTextChangedSizeFormatPane, null},
new Component[]{getRichTextChangedPercentFormatPane(), null}
};
return 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;
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.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.van.chart.designer.component.VanChartTooltipContentPane;
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.XFormatPaneWithoutCheckBox;
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 javax.swing.JPanel;
@ -26,10 +31,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
private YFormatPaneWithCheckBox yFormatPane;
private ValueFormatPaneWithCheckBox sizeFormatPane;
private XFormatPaneWithoutCheckBox richTextXFormatPane;
private YFormatPaneWithoutCheckBox richTextYFormatPane;
private ValueFormatPaneWithoutCheckBox richTextSizeFormatPane;
public XFormatPaneWithCheckBox getXFormatPane() {
return xFormatPane;
}
@ -42,18 +43,6 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
return sizeFormatPane;
}
public XFormatPaneWithoutCheckBox getRichTextXFormatPane() {
return richTextXFormatPane;
}
public YFormatPaneWithoutCheckBox getRichTextYFormatPane() {
return richTextYFormatPane;
}
public ValueFormatPaneWithoutCheckBox getRichTextSizeFormatPane() {
return richTextSizeFormatPane;
}
public VanChartScatterTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){
super(parent, showOnPane);
}
@ -71,13 +60,22 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
sizeFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane);
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
super.initRichTextFormatPane(parent, showOnPane);
protected void initRichTextTooltipContent() {
setRichTextTooltipContent(new ScatterAttrTooltipContent());
}
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);
richTextYFormatPane = new YFormatPaneWithoutCheckBox(parent, showOnPane);
richTextSizeFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane);
protected AttrTooltipContent getInitialTooltipContent() {
return new ScatterAttrTooltipContent();
}
};
}
@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
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
super.populateFormatPane(attrTooltipContent);
@ -111,30 +99,20 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
}
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
"x",
"y",
Toolkit.i18nText("Fine-Design_Chart_Use_Value")};
}
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextSeriesNameFormatPane(),
richTextXFormatPane,
richTextYFormatPane,
richTextSizeFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
scatterAttrTooltipContent.getRichTextSeriesFormat(),
scatterAttrTooltipContent.getRichTextXFormat(),
scatterAttrTooltipContent.getRichTextYFormat(),
scatterAttrTooltipContent.getRichTextSizeFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
checkRichEditorState(attrTooltipContent);
}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipSeriesFormat(),
new AttrTooltipXFormat(),
new AttrTooltipYFormat(),
new AttrTooltipSizeFormat()};
}
@Override
@ -148,14 +126,16 @@ public class VanChartScatterTooltipContentPane extends VanChartTooltipContentPa
}
}
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
super.updateRichEditor(attrTooltipContent);
protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
super.updateTooltipFormat(target, source);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
richTextXFormatPane.update(scatterAttrTooltipContent.getRichTextXFormat());
richTextYFormatPane.update(scatterAttrTooltipContent.getRichTextYFormat());
richTextSizeFormatPane.update(scatterAttrTooltipContent.getRichTextSizeFormat());
if (target instanceof ScatterAttrTooltipContent && source instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent targetScatter = (ScatterAttrTooltipContent) target;
ScatterAttrTooltipContent sourceScatter = (ScatterAttrTooltipContent) source;
targetScatter.setRichTextXFormat(sourceScatter.getRichTextXFormat());
targetScatter.setRichTextYFormat(sourceScatter.getRichTextYFormat());
targetScatter.setRichTextSizeFormat(sourceScatter.getRichTextSizeFormat());
}
}

Loading…
Cancel
Save