Browse Source

Pull request #4316: CHART-19306 仪表盘配色面板修改

Merge in DESIGN/design from ~BJORN/design:feature/10.0 to feature/10.0

* commit '46d77e489323f9f03c4e78e80f6df664603c35dc':
  CHART-19306 仪表盘配色面板修改
feature/10.0
Bjorn 4 years ago
parent
commit
ebd8b8c6eb
  1. 121
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneWithMaxMin.java
  2. 35
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java
  3. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java
  4. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  5. 100
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java
  6. 92
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartMultiColorSeriesPane.java
  7. 113
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeBeautyPane.java
  8. 210
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

121
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneWithMaxMin.java

@ -0,0 +1,121 @@
package com.fr.design.mainframe.chart.gui.style.series;
import com.fr.base.BaseFormula;
import com.fr.chart.chartglyph.MapHotAreaColor;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-05-18
*/
public class ColorPickerPaneWithMaxMin extends ColorPickerPaneWithFormula {
private double MAX = Double.MAX_VALUE / 2;
private double MIN = -(Double.MAX_VALUE / 2);
private BaseFormula[] valueArray;
private JPanel autoPane;
public ColorPickerPaneWithMaxMin(AbstractAttrNoScrollPane container, String meterString) {
this(container, meterString, null);
}
public ColorPickerPaneWithMaxMin(AbstractAttrNoScrollPane container, String meterString, JPanel autoPane) {
super(container, meterString);
if (autoPane == null) {
return;
}
this.autoPane = autoPane;
this.getDesignTypeButtonGroup().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
checkAutoPane();
}
});
}
private void checkAutoPane() {
if (getDesignTypeButtonGroup().getSelectedIndex() == 0) {
autoPane.setVisible(true);
} else {
autoPane.setVisible(false);
}
}
public void refreshGroupPane(Color[] colorArray, BaseFormula[] valueArray) {
this.valueArray = valueArray;
super.refreshGroupPane(colorArray, valueArray);
}
protected void setTextValue4Index(int index, String value) {
TinyFormulaPane tinyFormulaPane = (TinyFormulaPane) textFieldList.get(index);
setTextState(tinyFormulaPane, index, textFieldList.size() - 1, value);
}
protected JComponent getNewTextFieldComponent(int i, String value) {
TinyFormulaPane textField = new TinyFormulaPaneWithEnable();
textField.setBounds(0, i * 2 * TEXTFIELD_HEIGHT, TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT);
setTextState(textField, i, valueArray.length - 1, value);
return textField;
}
protected String getValue4Index(int i) {
if (i == 0) {
return String.valueOf(MAX);
}
if (i == textFieldList.size() - 1) {
return String.valueOf(MIN);
}
return ((TinyFormulaPane) textFieldList.get(i)).getUITextField().getText();
}
protected BaseFormula[] getValueArray(int count) {
BaseFormula[] valueArray = new BaseFormula[count + 1];
valueArray[0] = BaseFormula.createFormulaBuilder().build(MAX);
valueArray[count] = BaseFormula.createFormulaBuilder().build(MIN);
for (int i = 1; i < count; i++) {
if (i >= textFieldList.size() - 1) {
valueArray[i] = BaseFormula.createFormulaBuilder().build((count - i) * VALUE);
} else {
valueArray[i] = BaseFormula.createFormulaBuilder().build(getValue4Index(i));
}
}
return valueArray;
}
private void setTextState(TinyFormulaPane tinyFormulaPane, int index, int maxIndex, String value) {
boolean enable = false;
if (index == 0) {
value = "∞";
} else if (index == maxIndex) {
value = "-∞";
} else {
enable = true;
}
tinyFormulaPane.getUITextField().setText(value);
tinyFormulaPane.setEnabled(enable);
}
public void populateBean(MapHotAreaColor hotAreaColor) {
super.populateBean(hotAreaColor);
if (autoPane != null) {
checkAutoPane();
}
}
public class TinyFormulaPaneWithEnable extends TinyFormulaPane {
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
formulaTextField.setEnabled(enabled);
formulaTextFieldButton.setEnabled(enabled);
}
}
}

35
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java

@ -13,6 +13,7 @@ import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ipoppane.PopupHider; import com.fr.design.gui.ipoppane.PopupHider;
import com.fr.design.i18n.Toolkit;
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.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorControlWindow;
@ -53,7 +54,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
protected static final int TEXTFIELD_WIDTH = 130; protected static final int TEXTFIELD_WIDTH = 130;
protected static final int UPCONTROLPANE_WIDTH = 230; protected static final int UPCONTROLPANE_WIDTH = 230;
private static final int LAYOUR_DET = 6; private static final int LAYOUR_DET = 6;
private static final double VALUE = 100; public static final double VALUE = 100;
protected ArrayList<JComponent> textFieldList; protected ArrayList<JComponent> textFieldList;
private List<ColorRecButton> colorRecList = new ArrayList<ColorRecButton>(); private List<ColorRecButton> colorRecList = new ArrayList<ColorRecButton>();
@ -171,7 +172,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
regionNumPane.updateBean().intValue()), getValueArray(regionNumPane.updateBean().intValue())); regionNumPane.updateBean().intValue()), getValueArray(regionNumPane.updateBean().intValue()));
} }
}); });
designTypeButtonGroup = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}, new Integer[]{0, 1}); designTypeButtonGroup = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}, new Integer[]{0, 1});
designTypeButtonGroup.setSelectedIndex(0); designTypeButtonGroup.setSelectedIndex(0);
designTypeButtonGroup.addChangeListener(new ChangeListener() { designTypeButtonGroup.addChangeListener(new ChangeListener() {
@Override @Override
@ -201,11 +202,11 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
}; };
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double e = getEditAreaWidth (); double e = getEditAreaWidth();
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; double d = getDescriptionWidth();
double[] columnSize = {d, e}; double[] columnSize = {d, e};
double[] rowSize = {p}; double[] rowSize = {p};
Component[][] tmpComp = new Component[][]{new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), regionNumPane}}; Component[][] tmpComp = new Component[][]{new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), regionNumPane}};
stagePanel = TableLayout4VanChartHelper.createGapTableLayoutPane(tmpComp, rowSize, columnSize); stagePanel = TableLayout4VanChartHelper.createGapTableLayoutPane(tmpComp, rowSize, columnSize);
@ -226,10 +227,14 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
refreshGroupPane(colors, getValueArray(number)); refreshGroupPane(colors, getValueArray(number));
} }
protected double getEditAreaWidth () { protected double getEditAreaWidth() {
return TableLayout4VanChartHelper.EDIT_AREA_WIDTH; return TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
} }
protected double getDescriptionWidth() {
return TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
}
protected ArrayList getTextFieldList(){ protected ArrayList getTextFieldList(){
return new ArrayList<ColorPickerPaneNumFiled>(); return new ArrayList<ColorPickerPaneNumFiled>();
} }
@ -272,11 +277,11 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
*/ */
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if (designTypeButtonGroup.getSelectedIndex() == 0) { if (designTypeButtonGroup.getSelectedIndex() == 0) {
return new Dimension(colorGroup.getPreferredSize().width + textGroup.getPreferredSize().width, upControlPane.getPreferredSize().height + MARGIN_TOP); return new Dimension(colorGroup.getPreferredSize().width + textGroup.getPreferredSize().width, upControlPane.getPreferredSize().height + getBoundY());
} else { } else {
int extra = stagePanel == null ? 0 : stagePanel.getPreferredSize().height + MARGIN_TOP; int extra = stagePanel == null ? 0 : stagePanel.getPreferredSize().height + getBoundY();
return new Dimension(colorGroup.getPreferredSize().width + textGroup.getPreferredSize().width, return new Dimension(colorGroup.getPreferredSize().width + textGroup.getPreferredSize().width,
extra + textGroup.getPreferredSize().height + upControlPane.getPreferredSize().height + OFF_HEIGHT + MARGIN_TOP); extra + textGroup.getPreferredSize().height + upControlPane.getPreferredSize().height + OFF_HEIGHT + getBoundY());
} }
} }
@ -604,10 +609,10 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
@Override @Override
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
upControlPane.setBounds(MARGIN_LEFT, MARGIN_TOP, UPCONTROLPANE_WIDTH, upControlPane.getPreferredSize().height + MARGIN_TOP); upControlPane.setBounds(getBoundX(), getBoundY(), UPCONTROLPANE_WIDTH, upControlPane.getPreferredSize().height + MARGIN_TOP);
stagePanel.setBounds(MARGIN_LEFT, upControlPane.getPreferredSize().height + LAYOUR_DET + MARGIN_TOP, UPCONTROLPANE_WIDTH, stagePanel.getPreferredSize().height); stagePanel.setBounds(getBoundX(), upControlPane.getPreferredSize().height + LAYOUR_DET + getBoundY(), UPCONTROLPANE_WIDTH, stagePanel.getPreferredSize().height);
colorGroup.setBounds( getColorgroupMarginLeft (), 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + stagePanel.getPreferredSize().height + 2 * LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); colorGroup.setBounds( getColorgroupMarginLeft (), 2 * getBoundY() + upControlPane.getPreferredSize().height + stagePanel.getPreferredSize().height + 2 * LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height);
textGroup.setBounds(colorGroup.getPreferredSize().width + getColorgroupMarginLeft (), upControlPane.getPreferredSize().height + stagePanel.getPreferredSize().height + 2 * LAYOUR_DET + MARGIN_TOP, textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); textGroup.setBounds(colorGroup.getPreferredSize().width + getColorgroupMarginLeft (), upControlPane.getPreferredSize().height + stagePanel.getPreferredSize().height + 2 * LAYOUR_DET + getBoundY(), textGroup.getPreferredSize().width, textGroup.getPreferredSize().height);
} }
@Override @Override
@ -693,7 +698,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
refreshPane(); refreshPane();
} }
private void initContainerLister(){ protected void initContainerLister(){
this.container.initAllListeners(); this.container.initAllListeners();
} }
@ -761,7 +766,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
return ChartBaseUtils.createColorsWithHSB(color, sum); return ChartBaseUtils.createColorsWithHSB(color, sum);
} }
private BaseFormula[] getValueArray(int count) { protected BaseFormula[] getValueArray(int count) {
BaseFormula[] valueArray = new BaseFormula[count + 1]; BaseFormula[] valueArray = new BaseFormula[count + 1];
for (int i = 0; i < valueArray.length; i++) { for (int i = 0; i < valueArray.length; i++) {
if (i >= textFieldList.size()) { if (i >= textFieldList.size()) {

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

@ -44,7 +44,7 @@ public class VanChartBeautyPane extends BasicBeanPane<GradientStyle> {
double[] rowSize = {p}; double[] rowSize = {p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gradient_Style")), gradientTypeBox}, new Component[]{new UILabel(labelName()), gradientTypeBox},
}; };
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
@ -57,6 +57,10 @@ public class VanChartBeautyPane extends BasicBeanPane<GradientStyle> {
}; };
} }
protected String labelName() {
return Toolkit.i18nText("Fine-Design_Chart_Gradient_Style");
}
public void populateBean(GradientStyle gradientStyle) { public void populateBean(GradientStyle gradientStyle) {
gradientTypeBox.setSelectedIndex(this.convertGradientTypeToIndex(gradientStyle.getGradientType())); gradientTypeBox.setSelectedIndex(this.convertGradientTypeToIndex(gradientStyle.getGradientType()));
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java

@ -147,7 +147,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
} }
} }
private void checkFillStylePane(GradientStyle gradientStyle) { protected void checkFillStylePane(GradientStyle gradientStyle) {
if (vanChartFillStylePane != null) { if (vanChartFillStylePane != null) {
vanChartFillStylePane.setVisible(gradientStyle.getGradientType() != GradientType.CUSTOM); vanChartFillStylePane.setVisible(gradientStyle.getGradientType() != GradientType.CUSTOM);
} }

100
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java

@ -2,42 +2,27 @@ package com.fr.van.chart.designer.style.series;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.plugin.chart.range.VanChartRangeLegend;
import com.fr.plugin.chart.type.LegendType; import com.fr.plugin.chart.type.LegendType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartValueColorPane; import com.fr.van.chart.designer.component.VanChartValueColorPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* @author Bjorn * @author Bjorn
* @version 10.0 * @version 10.0
* Created by Bjorn on 2020-08-03 * Created by Bjorn on 2020-08-03
*/ */
public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotSeriesPane { public abstract class VanChartColorValueSeriesPane extends VanChartMultiColorSeriesPane {
//颜色划分切换
private UIButtonGroup<String> colorDivideButton;
private VanChartValueColorPane vanChartValueColorPane; private VanChartValueColorPane vanChartValueColorPane;
private JPanel colorDividePane;
public VanChartColorValueSeriesPane(ChartStylePane parent, Plot plot) { public VanChartColorValueSeriesPane(ChartStylePane parent, Plot plot) {
super(parent, plot); super(parent, plot);
} }
@ -51,31 +36,27 @@ public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotS
this.vanChartValueColorPane = vanChartValueColorPane; this.vanChartValueColorPane = vanChartValueColorPane;
} }
//获取颜色面板 protected JPanel createColorChoosePane() {
protected JPanel getColorPane() { vanChartFillStylePane = getVanChartFillStylePane();
JPanel panel = new JPanel(new BorderLayout()); if (vanChartFillStylePane != null) {
JPanel colorChoosePane = createColorChoosePane(); return super.createColorChoosePane();
if (colorChoosePane != null) { }
panel.add(colorChoosePane, BorderLayout.CENTER); return null;
} }
stylePane = createStylePane(); protected UIButtonGroup<String> createDivideButton() {
setColorPaneContent(panel); return new UIButtonGroup<>(new String[]{
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); Toolkit.i18nText("Fine-Design_Chart_Series"),
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); Toolkit.i18nText("Fine-Design_Chart_Use_Value")
return panel.getComponentCount() == 0 ? null : colorPane; }, new String[]{"series", "value"});
} }
protected JPanel createColorChoosePane() { protected JPanel createColorDividePane() {
vanChartFillStylePane = getVanChartFillStylePane();
if (vanChartFillStylePane != null) {
JPanel divideButtonPane = initDivideButtonPane();
vanChartValueColorPane = new VanChartValueColorPane((VanChartStylePane) parentPane); vanChartValueColorPane = new VanChartValueColorPane((VanChartStylePane) parentPane);
JPanel colorDividePane = new JPanel(new CardLayout()) {
colorDividePane = new JPanel(new CardLayout()) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if (colorDivideButton.getSelectedIndex() == 0) { if (getColorDivideButton().getSelectedIndex() == 0) {
return vanChartFillStylePane.getPreferredSize(); return vanChartFillStylePane.getPreferredSize();
} else { } else {
return vanChartValueColorPane.getPreferredSize(); return vanChartValueColorPane.getPreferredSize();
@ -84,46 +65,7 @@ public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotS
}; };
colorDividePane.add(vanChartFillStylePane, "series"); colorDividePane.add(vanChartFillStylePane, "series");
colorDividePane.add(vanChartValueColorPane, "value"); colorDividePane.add(vanChartValueColorPane, "value");
return colorDividePane;
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] col = {f};
double[] row = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{divideButtonPane},
new Component[]{colorDividePane}
};
return TableLayoutHelper.createCommonTableLayoutPane(components, row, col, 0);
}
return null;
}
private JPanel initDivideButtonPane() {
colorDivideButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Series"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value")
}, new String[]{"series", "value"});
colorDivideButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
colorDivideButton.setSelectedIndex(0);
UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color_Divide"));
Component[][] labelComponent = new Component[][]{
new Component[]{label, colorDivideButton},
};
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(labelComponent);
gapTableLayoutPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return gapTableLayoutPane;
}
private void checkCardPane() {
CardLayout cardLayout = (CardLayout) colorDividePane.getLayout();
cardLayout.show(colorDividePane, colorDivideButton.getSelectedItem());
colorDividePane.validate();
colorDividePane.repaint();
} }
//风格 //风格
@ -139,9 +81,9 @@ public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotS
return; return;
} }
super.updateBean(plot); super.updateBean(plot);
if (colorDivideButton != null) { if (getColorDivideButton() != null) {
VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend(); VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend();
int selectedIndex = colorDivideButton.getSelectedIndex(); int selectedIndex = getColorDivideButton().getSelectedIndex();
if (selectedIndex == 0) { if (selectedIndex == 0) {
legend.setLegendType(LegendType.ORDINARY); legend.setLegendType(LegendType.ORDINARY);
} else { } else {
@ -158,13 +100,13 @@ public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotS
return; return;
} }
super.populateBean(plot); super.populateBean(plot);
if (colorDivideButton != null) { if (getColorDivideButton() != null) {
VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend(); VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend();
LegendType legendType = legend.getLegendType(); LegendType legendType = legend.getLegendType();
if (legendType == LegendType.ORDINARY) { if (legendType == LegendType.ORDINARY) {
colorDivideButton.setSelectedIndex(0); getColorDivideButton().setSelectedIndex(0);
} else { } else {
colorDivideButton.setSelectedIndex(1); getColorDivideButton().setSelectedIndex(1);
} }
vanChartValueColorPane.populateBean(legend); vanChartValueColorPane.populateBean(legend);
checkCardPane(); checkCardPane();

92
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartMultiColorSeriesPane.java

@ -0,0 +1,92 @@
package com.fr.van.chart.designer.style.series;
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.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-05-19
*/
public abstract class VanChartMultiColorSeriesPane extends VanChartAbstractPlotSeriesPane {
//颜色划分切换
private UIButtonGroup<String> colorDivideButton;
private JPanel colorDividePane;
public VanChartMultiColorSeriesPane(ChartStylePane parent, Plot plot) {
super(parent, plot);
}
public UIButtonGroup<String> getColorDivideButton() {
return colorDivideButton;
}
//获取颜色面板
protected JPanel getColorPane() {
JPanel panel = new JPanel(new BorderLayout());
JPanel colorChoosePane = createColorChoosePane();
if (colorChoosePane != null) {
panel.add(colorChoosePane, BorderLayout.CENTER);
}
stylePane = createStylePane();
setColorPaneContent(panel);
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
return panel.getComponentCount() == 0 ? null : colorPane;
}
protected JPanel createColorChoosePane() {
JPanel divideButtonPane = initDivideButtonPane();
colorDividePane = createColorDividePane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] col = {f};
double[] row = {p, p, p, p};
Component[][] components = new Component[][]{
new Component[]{divideButtonPane},
new Component[]{colorDividePane}
};
return TableLayoutHelper.createCommonTableLayoutPane(components, row, col, 0);
}
private JPanel initDivideButtonPane() {
colorDivideButton = createDivideButton();
colorDivideButton.addActionListener(e -> checkCardPane());
colorDivideButton.setSelectedIndex(0);
UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color_Divide"));
Component[][] labelComponent = new Component[][]{
new Component[]{label, colorDivideButton},
};
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(labelComponent);
gapTableLayoutPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return gapTableLayoutPane;
}
protected abstract UIButtonGroup<String> createDivideButton();
protected abstract JPanel createColorDividePane();
protected void checkCardPane() {
CardLayout cardLayout = (CardLayout) colorDividePane.getLayout();
cardLayout.show(colorDividePane, String.valueOf(colorDivideButton.getSelectedItem()));
colorDividePane.validate();
colorDividePane.repaint();
}
}

113
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeBeautyPane.java

@ -0,0 +1,113 @@
package com.fr.van.chart.gauge;
import com.fr.chart.base.GradientStyle;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.plugin.chart.type.GradientType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-05-20
*/
public class VanChartGaugeBeautyPane extends VanChartBeautyPane {
private FixedGradientBar colorGradient;
private JPanel gradientBarPane;
public VanChartGaugeBeautyPane() {
super();
this.add(initGradientBarPane(), BorderLayout.SOUTH);
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
initListener();
}
private JPanel initGradientBarPane() {
colorGradient = new FixedGradientBar(4, 140);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{null, colorGradient},
};
gradientBarPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
return gradientBarPane;
}
private void initListener() {
getGradientTypeBox().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkGradientBarVisible();
}
});
}
protected String labelName() {
return Toolkit.i18nText("Fine-Design_Chart_Color_Style");
}
private void checkGradientBarVisible() {
gradientBarPane.setVisible(getGradientTypeBox().getSelectedIndex() == 1);
}
protected String[] getNameArray() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Solid_Color"),
Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"),
};
}
public void populateBean(GradientStyle gradientStyle) {
super.populateBean(gradientStyle);
if (gradientStyle.getGradientType() == GradientType.CUSTOM) {
colorGradient.updateColor(gradientStyle.getStartColor(), gradientStyle.getEndColor());
}
checkGradientBarVisible();
}
@Override
public GradientStyle updateBean() {
GradientStyle gradientStyle = super.updateBean();
if (gradientStyle.getGradientType() == GradientType.CUSTOM) {
gradientStyle.setStartColor(colorGradient.getSelectColorPointBtnP1().getColorInner());
gradientStyle.setEndColor(colorGradient.getSelectColorPointBtnP2().getColorInner());
}
return gradientStyle;
}
protected int convertGradientTypeToIndex(GradientType gradientType) {
switch (gradientType) {
case CUSTOM:
return 1;
default:
return 0;
}
}
protected GradientType convertIndexToGradientType(int index) {
switch (index) {
case 1:
return GradientType.CUSTOM;
default:
return GradientType.AUTO;
}
}
}

210
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -1,5 +1,7 @@
package com.fr.van.chart.gauge; package com.fr.van.chart.gauge;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.GradientStyle;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
@ -12,7 +14,7 @@ import com.fr.design.i18n.Toolkit;
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.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithFormula; import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithMaxMin;
import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane; import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -21,15 +23,17 @@ import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.plugin.chart.type.GradientType;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.component.VanChartFillStylePane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartMultiColorSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -38,7 +42,7 @@ import java.awt.event.ActionListener;
/** /**
* Created by Mitisky on 15/11/27. * Created by Mitisky on 15/11/27.
*/ */
public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { public class VanChartGaugeSeriesPane extends VanChartMultiColorSeriesPane {
private static final long serialVersionUID = -4414343926082129759L; private static final long serialVersionUID = -4414343926082129759L;
private UIButtonGroup gaugeLayout;//布局:横向、纵向 private UIButtonGroup gaugeLayout;//布局:横向、纵向
@ -61,6 +65,10 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private UISpinner thermometerWidth; private UISpinner thermometerWidth;
private UINumberDragPane chutePercent; private UINumberDragPane chutePercent;
private VanChartFillStylePane valueFillStylePane;
private JPanel colorChoosePane;
public VanChartGaugeSeriesPane(ChartStylePane parent, Plot plot) { public VanChartGaugeSeriesPane(ChartStylePane parent, Plot plot) {
super(parent, plot); super(parent, plot);
} }
@ -71,16 +79,86 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f}; double[] columnSize = {f};
//TODO Bjorn //TODO Bjorn
double[] rowSize = {p,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createGaugeLayoutPane()}, new Component[]{createGaugeLayoutPane()},
new Component[]{createGaugeStylePane(rowSize, new double[]{f,e})}, new Component[]{createGaugeStylePane(rowSize, new double[]{f, e})},
new Component[]{createGaugeBandsPane()} new Component[]{createGaugeBandsPane()}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected JPanel createColorChoosePane() {
vanChartFillStylePane = getVanChartFillStylePane();
GaugeStyle style = getGaugeStyle();
switch (style) {
case RING:
case SLOT:
case THERMOMETER:
colorChoosePane = super.createColorChoosePane();
break;
default:
colorChoosePane = vanChartFillStylePane;
break;
}
return colorChoosePane;
}
protected void checkFillStylePane(GradientStyle gradientStyle) {
if (colorChoosePane != null) {
colorChoosePane.setVisible(gradientStyle.getGradientType() != GradientType.CUSTOM);
}
}
protected UIButtonGroup<String> createDivideButton() {
return new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Style_Category"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value")
}, new String[]{"category", "value"});
}
protected JPanel createColorDividePane() {
JPanel panel = new JPanel(new BorderLayout(0, 0));
valueFillStylePane = getVanChartFillStylePane();
JPanel stylePane = valueFillStylePane == null ? new JPanel() : valueFillStylePane;
colorPickerPane = new ColorPickerPaneWithMaxMin(parentPane, "meterString", valueFillStylePane) {
protected int getBoundX() {
return 0;
}
protected int getBoundY() {
return 10;
}
protected double getDescriptionWidth() {
double descriptionWidth = super.getDescriptionWidth();
if (valueFillStylePane == null) {
descriptionWidth += 3;
}
return descriptionWidth;
}
};
panel.add(colorPickerPane, BorderLayout.NORTH);
panel.add(stylePane, BorderLayout.CENTER);
JPanel categoryFillPane = vanChartFillStylePane == null ? new JPanel() : vanChartFillStylePane;
JPanel colorDividePane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (getColorDivideButton().getSelectedIndex() == 0) {
return categoryFillPane.getPreferredSize();
} else {
return panel.getPreferredSize();
}
}
};
colorDividePane.add(categoryFillPane, "category");
colorDividePane.add(panel, "value");
return colorDividePane;
}
private JPanel createGaugeLayoutPane() { private JPanel createGaugeLayoutPane() {
gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")}); gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")});
@ -105,20 +183,20 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
private void changeLabelPosition() { private void changeLabelPosition() {
if(plot instanceof VanChartGaugePlot){ if (plot instanceof VanChartGaugePlot) {
VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot; VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot;
if (ComparatorUtils.equals(gaugePlot.getGaugeStyle(), GaugeStyle.THERMOMETER)){ if (ComparatorUtils.equals(gaugePlot.getGaugeStyle(), GaugeStyle.THERMOMETER)) {
ConditionAttr attrList = gaugePlot.getConditionCollection().getDefaultAttr(); ConditionAttr attrList = gaugePlot.getConditionCollection().getDefaultAttr();
AttrLabel attrLabel = (AttrLabel)attrList.getExisted(AttrLabel.class); AttrLabel attrLabel = (AttrLabel) attrList.getExisted(AttrLabel.class);
if(attrLabel == null){ if (attrLabel == null) {
return; return;
} }
AttrLabelDetail attrLabelDetail = attrLabel.getAttrLabelDetail(); AttrLabelDetail attrLabelDetail = attrLabel.getAttrLabelDetail();
if(attrLabelDetail == null || attrLabelDetail.getTextAttr() == null){ if (attrLabelDetail == null || attrLabelDetail.getTextAttr() == null) {
return; return;
} }
attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT); attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT);
if(gaugeLayout.getSelectedIndex() == 0){ if (gaugeLayout.getSelectedIndex() == 0) {
attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT); attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT);
attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT); attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT);
} else { } else {
@ -133,7 +211,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
JPanel panel = new JPanel(new BorderLayout(0, 6)); JPanel panel = new JPanel(new BorderLayout(0, 6));
JPanel centerPanel = TableLayoutHelper.createTableLayoutPane(getDiffComponentsWithGaugeStyle(), row, col); JPanel centerPanel = TableLayoutHelper.createTableLayoutPane(getDiffComponentsWithGaugeStyle(), row, col);
panel.add(centerPanel, BorderLayout.CENTER); panel.add(centerPanel, BorderLayout.CENTER);
if(rotate != null){ if (rotate != null) {
JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate); JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate);
panel.add(panel1, BorderLayout.NORTH); panel.add(panel1, BorderLayout.NORTH);
} }
@ -141,7 +219,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
private Component[][] getDiffComponentsWithGaugeStyle() { private Component[][] getDiffComponentsWithGaugeStyle() {
GaugeStyle style = plot == null ? GaugeStyle.POINTER : ((VanChartGaugePlot)plot).getGaugeStyle(); GaugeStyle style = getGaugeStyle();
switch (style) { switch (style) {
//TODO Bjorn 仪表盘样式自动逻辑 //TODO Bjorn 仪表盘样式自动逻辑
case RING: case RING:
@ -212,12 +290,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[] getHingeBackgroundColor() { private Component[] getHingeBackgroundColor() {
hingeBackgroundColor = new ColorSelectBox(120); hingeBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")), hingeBackgroundColor};
} }
private Component[] getNeedleColor() { private Component[] getNeedleColor() {
needleColor = new ColorSelectBox(120); needleColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")), needleColor};
} }
private Component[] getPaneBackgroundColorAuto() { private Component[] getPaneBackgroundColorAuto() {
@ -236,7 +314,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[] getPaneBackgroundColor() { private Component[] getPaneBackgroundColor() {
paneBackgroundColor = new ColorSelectBox(120); paneBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")), paneBackgroundColor};
} }
private Component[] getSlotBackgroundColorAuto() { private Component[] getSlotBackgroundColorAuto() {
@ -255,17 +333,17 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[] getSlotBackgroundColor() { private Component[] getSlotBackgroundColor() {
slotBackgroundColor = new ColorSelectBox(120); slotBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")), slotBackgroundColor};
} }
private Component[] getThermometerWidth() { private Component[] getThermometerWidth() {
thermometerWidth = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.1, 10); thermometerWidth = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.1, 10);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")), thermometerWidth};
} }
private Component[] getChutePercent() { private Component[] getChutePercent() {
chutePercent = new UINumberDragPaneWithPercent(0, 100, 1); chutePercent = new UINumberDragPaneWithPercent(0, 100, 1);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")), chutePercent};
} }
private void initRotate() { private void initRotate() {
@ -274,13 +352,17 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private Component[] getInnerPaneBackgroundColor() { private Component[] getInnerPaneBackgroundColor() {
innerPaneBackgroundColor = new ColorSelectBox(120); innerPaneBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")), innerPaneBackgroundColor};
} }
private JPanel createGaugeBandsPane() { private JPanel createGaugeBandsPane() {
colorPickerPane = new ColorPickerPaneWithFormula(parentPane, "meterString"); GaugeStyle gaugeStyle = getGaugeStyle();
if (gaugeStyle == GaugeStyle.POINTER || gaugeStyle == GaugeStyle.POINTER_SEMI) {
colorPickerPane = new ColorPickerPaneWithMaxMin(parentPane, "meterString");
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane);
} }
return null;
}
private void checkHingeColorAutoButton() { private void checkHingeColorAutoButton() {
hingeColor.setVisible(hingeColorAuto.getSelectedIndex() == 1); hingeColor.setVisible(hingeColorAuto.getSelectedIndex() == 1);
@ -298,12 +380,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
} }
public void populateBean(Plot plot) { public void populateBean(Plot plot) {
if(plot == null) { if (plot == null) {
return; return;
} }
super.populateBean(plot); super.populateBean(plot);
if(plot instanceof VanChartGaugePlot){ if (plot instanceof VanChartGaugePlot) {
VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot; VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot;
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle(); GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
gaugeLayout.setSelectedIndex(detailStyle.isHorizontalLayout() ? 0 : 1); gaugeLayout.setSelectedIndex(detailStyle.isHorizontalLayout() ? 0 : 1);
@ -319,46 +401,53 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
slotBackgroundColorAuto.setSelectedIndex(detailStyle.isSlotBackgroundColorAuto() ? 0 : 1); slotBackgroundColorAuto.setSelectedIndex(detailStyle.isSlotBackgroundColorAuto() ? 0 : 1);
checkSlotBackgroundColorAutoButton(); checkSlotBackgroundColorAutoButton();
} }
if(hingeColor != null){ if (hingeColor != null) {
hingeColor.setSelectObject(detailStyle.getHingeColor()); hingeColor.setSelectObject(detailStyle.getHingeColor());
} }
if(hingeBackgroundColor != null){ if (hingeBackgroundColor != null) {
hingeBackgroundColor.setSelectObject(detailStyle.getHingeBackgroundColor()); hingeBackgroundColor.setSelectObject(detailStyle.getHingeBackgroundColor());
} }
if(needleColor != null){ if (needleColor != null) {
needleColor.setSelectObject(detailStyle.getNeedleColor()); needleColor.setSelectObject(detailStyle.getNeedleColor());
} }
if(paneBackgroundColor != null){ if (paneBackgroundColor != null) {
paneBackgroundColor.setSelectObject(detailStyle.getPaneBackgroundColor()); paneBackgroundColor.setSelectObject(detailStyle.getPaneBackgroundColor());
} }
if(slotBackgroundColor != null){ if (slotBackgroundColor != null) {
slotBackgroundColor.setSelectObject(detailStyle.getSlotBackgroundColor()); slotBackgroundColor.setSelectObject(detailStyle.getSlotBackgroundColor());
} }
if(rotate != null){ if (rotate != null) {
rotate.setSelectedIndex(detailStyle.isAntiClockWise() ? 0 : 1); rotate.setSelectedIndex(detailStyle.isAntiClockWise() ? 0 : 1);
} }
if(innerPaneBackgroundColor != null){ if (innerPaneBackgroundColor != null) {
innerPaneBackgroundColor.setSelectObject(detailStyle.getInnerPaneBackgroundColor()); innerPaneBackgroundColor.setSelectObject(detailStyle.getInnerPaneBackgroundColor());
} }
if(thermometerWidth != null){ if (thermometerWidth != null) {
thermometerWidth.setValue(detailStyle.getThermometerWidth()); thermometerWidth.setValue(detailStyle.getThermometerWidth());
} }
if(chutePercent != null){ if (chutePercent != null) {
chutePercent.populateBean(detailStyle.getChutePercent()); chutePercent.populateBean(detailStyle.getChutePercent());
} }
if (getColorDivideButton() != null) {
getColorDivideButton().setSelectedIndex(detailStyle.isColorUseCategory() ? 0 : 1);
checkCardPane();
}
colorPickerPane.populateBean(detailStyle.getHotAreaColor()); colorPickerPane.populateBean(detailStyle.getHotAreaColor());
if (valueFillStylePane != null) {
valueFillStylePane.populateBean(plot.getPlotFillStyle());
}
} }
} }
@Override @Override
public void updateBean(Plot plot) { public void updateBean(Plot plot) {
if(plot == null){ if (plot == null) {
return; return;
} }
super.updateBean(plot); super.updateBean(plot);
if(plot instanceof VanChartGaugePlot){ if (plot instanceof VanChartGaugePlot) {
VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot; VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot;
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle(); GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
detailStyle.setHorizontalLayout(gaugeLayout.getSelectedIndex() == 0); detailStyle.setHorizontalLayout(gaugeLayout.getSelectedIndex() == 0);
@ -372,40 +461,65 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
if (slotBackgroundColorAuto != null) { if (slotBackgroundColorAuto != null) {
detailStyle.setSlotBackgroundColorAuto(slotBackgroundColorAuto.getSelectedIndex() == 0); detailStyle.setSlotBackgroundColorAuto(slotBackgroundColorAuto.getSelectedIndex() == 0);
} }
if(hingeColor != null){ if (hingeColor != null) {
detailStyle.setHingeColor(hingeColor.getSelectObject()); detailStyle.setHingeColor(hingeColor.getSelectObject());
} }
if(hingeBackgroundColor != null){ if (hingeBackgroundColor != null) {
detailStyle.setHingeBackgroundColor(hingeBackgroundColor.getSelectObject()); detailStyle.setHingeBackgroundColor(hingeBackgroundColor.getSelectObject());
} }
if(needleColor != null){ if (needleColor != null) {
detailStyle.setNeedleColor(needleColor.getSelectObject()); detailStyle.setNeedleColor(needleColor.getSelectObject());
} }
if(paneBackgroundColor != null){ if (paneBackgroundColor != null) {
detailStyle.setPaneBackgroundColor(paneBackgroundColor.getSelectObject()); detailStyle.setPaneBackgroundColor(paneBackgroundColor.getSelectObject());
} }
if(slotBackgroundColor != null){ if (slotBackgroundColor != null) {
detailStyle.setSlotBackgroundColor(slotBackgroundColor.getSelectObject()); detailStyle.setSlotBackgroundColor(slotBackgroundColor.getSelectObject());
} }
if(rotate != null){ if (rotate != null) {
detailStyle.setAntiClockWise(rotate.getSelectedIndex() == 0); detailStyle.setAntiClockWise(rotate.getSelectedIndex() == 0);
} }
if(innerPaneBackgroundColor != null){ if (innerPaneBackgroundColor != null) {
detailStyle.setInnerPaneBackgroundColor(innerPaneBackgroundColor.getSelectObject()); detailStyle.setInnerPaneBackgroundColor(innerPaneBackgroundColor.getSelectObject());
} }
if(thermometerWidth != null){ if (thermometerWidth != null) {
detailStyle.setThermometerWidth(thermometerWidth.getValue()); detailStyle.setThermometerWidth(thermometerWidth.getValue());
} }
if(chutePercent != null){ if (chutePercent != null) {
detailStyle.setChutePercent(chutePercent.updateBean()); detailStyle.setChutePercent(chutePercent.updateBean());
} }
colorPickerPane.updateBean(detailStyle.getHotAreaColor()); colorPickerPane.updateBean(detailStyle.getHotAreaColor());
if (getColorDivideButton() != null) {
int selectedIndex = getColorDivideButton().getSelectedIndex();
detailStyle.setColorUseCategory(selectedIndex == 0);
}
if (!detailStyle.isColorUseCategory()) {
if (valueFillStylePane != null) {
AttrFillStyle plotFillStyle = plot.getPlotFillStyle();
if (plotFillStyle == null) {
plotFillStyle = new AttrFillStyle();
plot.setPlotFillStyle(plotFillStyle);
}
valueFillStylePane.updateBean(plotFillStyle);
}
}
} }
} }
@Override @Override
protected VanChartBeautyPane createStylePane() { protected VanChartGaugeBeautyPane createStylePane() {
GaugeStyle gaugeStyle = getGaugeStyle();
switch (gaugeStyle) {
case POINTER:
case POINTER_SEMI:
return null; return null;
default:
return new VanChartGaugeBeautyPane();
}
}
private GaugeStyle getGaugeStyle() {
return plot == null ? GaugeStyle.POINTER : ((VanChartGaugePlot) plot).getGaugeStyle();
} }
} }
Loading…
Cancel
Save