Browse Source

CHART-15835 饼图标签改为值标签+分类标签组合

feature/big-screen
白岳 4 years ago
parent
commit
8a63306c39
  1. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  2. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java
  3. 23
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithCheckBox.java
  4. 23
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithoutCheckBox.java
  5. 68
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieCategoryLabelDetailPane.java
  6. 61
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java
  7. 72
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java
  8. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  9. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java
  10. 130
      designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java
  11. 79
      designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java

3
designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java

@ -35,6 +35,7 @@ import com.fr.van.chart.designer.style.VanChartRangeLegendPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.VanLegendPaneWidthOutHighlight;
import com.fr.van.chart.designer.style.label.VanChartGaugePlotLabelPane;
import com.fr.van.chart.designer.style.label.VanChartPiePlotLabelPane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane;
import com.fr.van.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane;
@ -209,6 +210,8 @@ public class PlotFactory {
public static VanChartPlotLabelPane createPlotLabelPane(Plot plot, VanChartStylePane stylePane, boolean inCondition) {
if (plot instanceof VanChartGaugePlot) {
return new VanChartGaugePlotLabelPane(plot, stylePane);
} else if (plot instanceof PiePlot4VanChart) {
return new VanChartPiePlotLabelPane(plot, stylePane, inCondition);
}
return new VanChartPlotLabelPane(plot, stylePane, inCondition);
}

6
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java

@ -46,6 +46,10 @@ public class VanChartBorderWithShapePane extends BasicPane {
createBorderPane();
}
public LineComboBox getLineTypeBox() {
return lineTypeBox;
}
private void initComponents() {
lineTypeBox = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
lineColorButton = new UIButtonGroup<>(new String[]{
@ -106,7 +110,7 @@ public class VanChartBorderWithShapePane extends BasicPane {
borderRadius.setEnabled(borderShape.getSelectedIndex() == RECTANGULAR_INDEX || borderShape.getSelectedIndex() == DIALOG_INDEX);
}
private JPanel createLineTypePane() {
protected JPanel createLineTypePane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;

23
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithCheckBox.java

@ -0,0 +1,23 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-12-10
*/
public class SummaryValueFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox {
public SummaryValueFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
@Override
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value");
}
}

23
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithoutCheckBox.java

@ -0,0 +1,23 @@
package com.fr.van.chart.designer.component.format;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-12-10
*/
public class SummaryValueFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox {
public SummaryValueFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value");
}
}

68
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieCategoryLabelDetailPane.java

@ -0,0 +1,68 @@
package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.pie.style.VanChartPieCategoryLabelContentPane;
import javax.swing.JPanel;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-12-09
*/
public class VanChartPieCategoryLabelDetailPane extends VanChartPlotLabelDetailPane {
public VanChartPieCategoryLabelDetailPane(Plot plot, VanChartStylePane parent, boolean inCondition) {
super(plot, parent, inCondition);
}
protected void initToolTipContentPane(Plot plot) {
setDataLabelContentPane(new VanChartPieCategoryLabelContentPane(getParentPane(), this, isInCondition()));
}
protected JPanel createLabelPositionPane(String title, Plot plot) {
String[] positionName = new String[]{
Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom"),
Toolkit.i18nText("Fine-Design_Form_Center"),
Toolkit.i18nText("Fine-Design_Chart_Axis_Top")
};
Integer[] positionValue = new Integer[]{Constants.BOTTOM, Constants.CENTER, Constants.TOP};
UIButtonGroup<Integer> position = new UIButtonGroup<>(positionName, positionValue);
setPosition(position);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = {p, p};
double[] col = {f, e};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), position},
};
return TableLayoutHelper.createTableLayoutPane(components, row, col);
}
protected void checkPositionPane(String title) {
}
protected JPanel createLabelBorderPane() {
return null;
}
protected JPanel createLabelBackgroundPane() {
return null;
}
}

61
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java

@ -0,0 +1,61 @@
package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-12-09
*/
public class VanChartPiePlotLabelPane extends VanChartPlotLabelPane {
private VanChartPlotLabelDetailPane pieCategoryLabelPane;
public VanChartPiePlotLabelPane(Plot plot, VanChartStylePane parent, boolean inCondition) {
super(plot, parent, inCondition);
}
protected void createLabelPane() {
setLabelPane(new JPanel(new BorderLayout(0, 4)));
setLabelDetailPane(new VanChartPieValueLabelDetailPane(getPlot(), getParentPane(), isInCondition()));
JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Label"), getLabelDetailPane());
getLabelPane().add(valuePane, BorderLayout.NORTH);
if (!isInCondition()) {
pieCategoryLabelPane = new VanChartPieCategoryLabelDetailPane(getPlot(), getParentPane(), isInCondition());
JPanel categoryPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Category_Label"), pieCategoryLabelPane);
getLabelPane().add(categoryPane, BorderLayout.CENTER);
}
}
public void populate(AttrLabel attrLabel) {
if (attrLabel == null) {
attrLabel = ((VanChartPlot) this.getPlot()).getDefaultAttrLabel();
}
super.populate(attrLabel);
if (pieCategoryLabelPane != null) {
AttrLabelDetail labelDetail = attrLabel.getSecondLabelDetail();
pieCategoryLabelPane.populate(labelDetail);
}
}
public AttrLabel update() {
AttrLabel attrLabel = super.update();
if (pieCategoryLabelPane != null) {
AttrLabelDetail labelDetail = attrLabel.getSecondLabelDetail();
pieCategoryLabelPane.update(labelDetail);
} else {
attrLabel.setSecondLabelDetail(null);
}
return attrLabel;
}
}

72
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java

@ -0,0 +1,72 @@
package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane;
import com.fr.van.chart.designer.component.border.VanChartBorderWithShapePane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.pie.style.VanChartPieValueLabelContentPane;
import javax.swing.JPanel;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-12-09
*/
public class VanChartPieValueLabelDetailPane extends VanChartPlotLabelDetailPane {
public VanChartPieValueLabelDetailPane(Plot plot, VanChartStylePane parent, boolean inCondition) {
super(plot, parent, inCondition);
}
protected void initToolTipContentPane(Plot plot) {
setDataLabelContentPane(new VanChartPieValueLabelContentPane(getParentPane(), this, isInCondition()));
}
protected JPanel getLabelLayoutPane(JPanel panel, String title) {
return panel;
}
protected JPanel createLabelBorderPane() {
VanChartBorderWithShapePane borderPane = new VanChartBorderWithShapePane() {
@Override
protected JPanel createLineTypePane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Border")),
UIComponentUtils.wrapWithBorderLayoutPane(getLineTypeBox())}};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
};
setBorderPane(borderPane);
return borderPane;
}
protected JPanel createLabelBackgroundPane() {
VanChartBackgroundWithOutImagePane backgroundPane = new VanChartBackgroundWithOutImagePane() {
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Utils_Background")), typeComboBox},
new Component[]{null, centerPane},
new Component[]{getTransparentLabel(), transparent},
};
}
};
setBackgroundPane(backgroundPane);
return backgroundPane;
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

@ -83,6 +83,19 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
return parent;
}
public void setPosition(UIButtonGroup<Integer> position) {
this.position = position;
}
public void setBorderPane(VanChartBorderWithShapePane borderPane) {
this.borderPane = borderPane;
}
public void setBackgroundPane(VanChartBackgroundWithOutImagePane backgroundPane) {
this.backgroundPane = backgroundPane;
}
protected void initLabelDetailPane(Plot plot) {
this.setLayout(new BorderLayout());
initToolTipContentPane(plot);
@ -145,14 +158,14 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
return jPanel;
}
private JPanel createLabelBorderPane() {
protected JPanel createLabelBorderPane() {
borderPane = new VanChartBorderWithShapePane();
borderPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane);
return borderPaneWithTitle;
}
private JPanel createLabelBackgroundPane() {
protected JPanel createLabelBackgroundPane() {
backgroundPane = new VanChartBackgroundWithOutImagePane() {
protected Component[][] getPaneComponents() {

4
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java

@ -44,6 +44,10 @@ public class VanChartPlotLabelPane extends BasicPane {
addComponents();
}
public boolean isInCondition() {
return inCondition;
}
public VanChartPlotLabelDetailPane getLabelDetailPane() {
return labelDetailPane;
}

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

@ -0,0 +1,130 @@
package com.fr.van.chart.pie.style;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
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.pie.attr.PieCategoryLabelContent;
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.CategoryNameFormatPaneWithoutCheckBox;
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.format.VanChartFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-12-10
*/
public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPane {
private SummaryValueFormatPaneWithCheckBox summaryValueFormatPane;
private SummaryValueFormatPaneWithoutCheckBox richTextSummaryValueFormatPane;
public VanChartPieCategoryLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) {
super(parent, showOnPane, inCondition);
}
@Override
protected JPanel getLabelContentPane(JPanel contentPane) {
return contentPane;
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane));
summaryValueFormatPane = new SummaryValueFormatPaneWithCheckBox(parent, showOnPane);
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane));
richTextSummaryValueFormatPane = new SummaryValueFormatPaneWithoutCheckBox(parent, showOnPane);
}
@Override
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{getCategoryNameFormatPane(), null},
new Component[]{summaryValueFormatPane, null},
};
}
@Override
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextCategoryNameFormatPane(), null},
new Component[]{richTextSummaryValueFormatPane, null},
};
}
@Override
protected double[] getRowSize(double p) {
return new double[]{p, p};
}
public JPanel createCommonStylePane() {
setTextAttrPane(new ChartTextAttrPane());
return getTextAttrPane();
}
@Override
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent;
super.populateFormatPane(pieCategoryLabelContent);
summaryValueFormatPane.populate(pieCategoryLabelContent.getSummaryValueFormat());
}
protected void populateRichEditor(AttrTooltipContent attrTooltipContent) {
PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent;
VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{
getRichTextCategoryNameFormatPane(),
richTextSummaryValueFormatPane
};
AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{
pieCategoryLabelContent.getRichTextCategoryFormat(),
pieCategoryLabelContent.getRichTextSummaryValueFormat()
};
setRichTextAttr(new AttrTooltipRichText());
populateRichTextFormat(formatPaneGroup, formatGroup);
populateRichText(pieCategoryLabelContent.getRichTextAttr());
checkRichEditorState(pieCategoryLabelContent);
}
@Override
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent;
super.updateFormatPane(pieCategoryLabelContent);
summaryValueFormatPane.update(pieCategoryLabelContent.getSummaryValueFormat());
}
protected void updateRichEditor(AttrTooltipContent attrTooltipContent) {
PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent;
super.updateRichEditor(pieCategoryLabelContent);
richTextSummaryValueFormatPane.update(pieCategoryLabelContent.getRichTextSummaryValueFormat());
}
@Override
public void setDirty(boolean isDirty) {
getCategoryNameFormatPane().setDirty(isDirty);
summaryValueFormatPane.setDirty(isDirty);
}
@Override
public boolean isDirty() {
return getCategoryNameFormatPane().isDirty() || summaryValueFormatPane.isDirty();
}
protected AttrTooltipContent createAttrTooltip() {
return new PieCategoryLabelContent();
}
}

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

@ -0,0 +1,79 @@
package com.fr.van.chart.pie.style;
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.PercentFormatPaneWithoutCheckBox;
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.ValueFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-12-09
*/
public class VanChartPieValueLabelContentPane extends VanChartLabelContentPane {
public VanChartPieValueLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) {
super(parent, showOnPane, inCondition);
}
@Override
protected JPanel getLabelContentPane(JPanel contentPane) {
return contentPane;
}
@Override
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane));
setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane));
setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane));
}
@Override
protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) {
setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane));
setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane));
}
@Override
protected double[] getRowSize(double p) {
return new double[]{p, p, p};
}
@Override
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{getSeriesNameFormatPane(), null},
new Component[]{getValueFormatPane(), null},
new Component[]{getPercentFormatPane(), null},
};
}
@Override
protected Component[][] getRichTextComponents() {
return new Component[][]{
new Component[]{getRichTextSeriesNameFormatPane(), null},
new Component[]{getRichTextValueFormatPane(), null},
new Component[]{getRichTextPercentFormatPane(), null}
};
}
@Override
public void setDirty(boolean isDirty) {
getSeriesNameFormatPane().setDirty(isDirty);
getValueFormatPane().setDirty(isDirty);
getPercentFormatPane().setDirty(isDirty);
}
@Override
public boolean isDirty() {
return getSeriesNameFormatPane().isDirty() || getValueFormatPane().isDirty() || getPercentFormatPane().isDirty();
}
}
Loading…
Cancel
Save