Browse Source

适配饼图

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
af29f516ef
  1. 80
      designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java
  2. 66
      designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java
  3. 47
      designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java
  4. 34
      designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java
  5. 21
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java

80
designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java

@ -1,16 +1,20 @@
package com.fr.van.chart.pie.style; package com.fr.van.chart.pie.style;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
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.AttrTooltipCategoryFormat;
import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSummaryValueFormat;
import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent; import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; 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;
@ -25,8 +29,6 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan
private SummaryValueFormatPaneWithCheckBox summaryValueFormatPane; private SummaryValueFormatPaneWithCheckBox summaryValueFormatPane;
private SummaryValueFormatPaneWithoutCheckBox richTextSummaryValueFormatPane;
public VanChartPieCategoryLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { public VanChartPieCategoryLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) {
super(parent, showOnPane, inCondition); super(parent, showOnPane, inCondition);
} }
@ -42,25 +44,39 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan
summaryValueFormatPane = new SummaryValueFormatPaneWithCheckBox(parent, showOnPane); summaryValueFormatPane = new SummaryValueFormatPaneWithCheckBox(parent, showOnPane);
} }
@Override protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); return new VanChartRichTextPane(richEditorPane) {
richTextSummaryValueFormatPane = new SummaryValueFormatPaneWithoutCheckBox(parent, showOnPane);
protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartPieCategoryRichTextFieldListPane(fieldAttrPane, richEditor);
} }
@Override protected AttrTooltipContent getInitialTooltipContent() {
protected Component[][] getPaneComponents() { return createAttrTooltip();
return new Component[][]{ }
new Component[]{getCategoryNameFormatPane(), null}, };
new Component[]{summaryValueFormatPane, null}, }
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value")
};
}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipCategoryFormat(),
new AttrTooltipSummaryValueFormat()
}; };
} }
@Override @Override
protected Component[][] getRichTextComponents() { protected Component[][] getPaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null}, new Component[]{getCategoryNameFormatPane(), null},
new Component[]{richTextSummaryValueFormatPane, null}, new Component[]{summaryValueFormatPane, null},
}; };
} }
@ -81,23 +97,15 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan
summaryValueFormatPane.populate(pieCategoryLabelContent.getSummaryValueFormat()); summaryValueFormatPane.populate(pieCategoryLabelContent.getSummaryValueFormat());
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) {
PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; super.updateTooltipFormat(target, source);
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextCategoryNameFormatPane(),
richTextSummaryValueFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ if (target instanceof PieCategoryLabelContent && source instanceof PieCategoryLabelContent) {
pieCategoryLabelContent.getRichTextCategoryFormat(), PieCategoryLabelContent targetPieCategory = (PieCategoryLabelContent) target;
pieCategoryLabelContent.getRichTextSummaryValueFormat() PieCategoryLabelContent sourcePieCategory = (PieCategoryLabelContent) source;
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(pieCategoryLabelContent.getRichTextAttr());
checkRichEditorState(pieCategoryLabelContent); targetPieCategory.setRichTextSummaryValueFormat(sourcePieCategory.getRichTextSummaryValueFormat());
}
} }
@Override @Override
@ -107,12 +115,6 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan
summaryValueFormatPane.update(pieCategoryLabelContent.getSummaryValueFormat()); summaryValueFormatPane.update(pieCategoryLabelContent.getSummaryValueFormat());
} }
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent;
super.updateRichEditor(pieCategoryLabelContent);
richTextSummaryValueFormatPane.update(pieCategoryLabelContent.getRichTextSummaryValueFormat());
}
@Override @Override
public void setDirty(boolean isDirty) { public void setDirty(boolean isDirty) {
getCategoryNameFormatPane().setDirty(isDirty); getCategoryNameFormatPane().setDirty(isDirty);

66
designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java

@ -0,0 +1,66 @@
package com.fr.van.chart.pie.style;
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.AttrTooltipSummaryValueFormat;
import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent;
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 VanChartPieCategoryRichTextFieldListPane extends VanChartFieldListPane {
private VanChartFieldButton summaryValueButton;
public VanChartPieCategoryRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
protected void initDefaultFieldButton() {
super.initDefaultFieldButton();
VanChartFieldListener listener = getFieldListener();
summaryValueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value"),
new AttrTooltipSummaryValueFormat(), false, listener);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getCategoryNameButton());
fieldPane.add(summaryValueButton);
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getCategoryNameButton());
fieldButtonList.add(summaryValueButton);
return fieldButtonList;
}
public void populateDefaultField(AttrTooltipContent tooltipContent) {
super.populateDefaultField(tooltipContent);
if (tooltipContent instanceof PieCategoryLabelContent) {
PieCategoryLabelContent pieCategory = (PieCategoryLabelContent) tooltipContent;
populateButtonFormat(summaryValueButton, pieCategory.getRichTextSummaryValueFormat());
}
}
public void updateDefaultField(AttrTooltipContent tooltipContent) {
super.updateDefaultField(tooltipContent);
if (tooltipContent instanceof PieCategoryLabelContent) {
PieCategoryLabelContent pieCategory = (PieCategoryLabelContent) tooltipContent;
updateButtonFormat(summaryValueButton, pieCategory.getRichTextSummaryValueFormat());
}
}
}

47
designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java

@ -1,12 +1,20 @@
package com.fr.van.chart.pie.style; package com.fr.van.chart.pie.style;
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.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.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
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.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.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;
@ -35,11 +43,34 @@ public class VanChartPieValueLabelContentPane extends VanChartLabelContentPane {
setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
} }
@Override protected VanChartRichTextPane createRichTextPane(ModernUIPane<VanChartRichEditorModel> richEditorPane) {
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); return new VanChartRichTextPane(richEditorPane) {
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditor) {
return new VanChartPieValueRichTextFieldListPane(fieldAttrPane, richEditor);
}
protected AttrTooltipContent getInitialTooltipContent() {
return createAttrTooltip();
}
};
}
protected String[] getRichTextFieldNames() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value"),
Toolkit.i18nText("Fine-Design_Chart_Use_Percent")
};
}
protected AttrTooltipFormat[] getRichTextFieldFormats() {
return new AttrTooltipFormat[]{
new AttrTooltipSeriesFormat(),
new AttrTooltipValueFormat(),
new AttrTooltipPercentFormat()
};
} }
@Override @Override

34
designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java

@ -0,0 +1,34 @@
package com.fr.van.chart.pie.style;
import com.fr.design.ui.ModernUIPane;
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.VanChartRichEditorModel;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
public class VanChartPieValueRichTextFieldListPane extends VanChartFieldListPane {
public VanChartPieValueRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) {
super(fieldAttrPane, richEditorPane);
}
protected void addDefaultFieldButton(JPanel fieldPane) {
fieldPane.add(getSeriesNameButton());
fieldPane.add(getValueButton());
fieldPane.add(getPercentButton());
}
protected List<VanChartFieldButton> getDefaultFieldButtonList() {
List<VanChartFieldButton> fieldButtonList = new ArrayList<>();
fieldButtonList.add(getSeriesNameButton());
fieldButtonList.add(getValueButton());
fieldButtonList.add(getPercentButton());
return fieldButtonList;
}
}

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

@ -77,27 +77,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo
} }
} }
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
super.populateRichEditor(attrTooltipContent);
if (attrTooltipContent instanceof ScatterAttrTooltipContent) {
ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
richTextChangedSizeFormatPane,
getRichTextChangedPercentFormatPane()
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
scatterAttrTooltipContent.getRichTextChangeSizeFormat(),
scatterAttrTooltipContent.getRichTextChangedSizePercentFormat()
};
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(attrTooltipContent.getRichTextAttr());
}
}
@Override @Override
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
super.updateFormatPane(attrTooltipContent); super.updateFormatPane(attrTooltipContent);

Loading…
Cancel
Save