Browse Source

CHART-15946 标签边框颜色支持自动

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
c602e19a68
  1. 67
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java

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

@ -3,6 +3,7 @@ package com.fr.van.chart.designer.component.border;
import com.fr.chart.chartglyph.Marker;
import com.fr.chart.chartglyph.MarkerFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
@ -28,12 +29,17 @@ public class VanChartBorderWithShapePane extends BasicPane {
private static final int RECTANGULAR_INDEX = 0;
private static final int DIALOG_INDEX = 1;
private static final int AUTO_COLOR = 0;
private static final int CUSTOM_COLOR = 1;
private LineComboBox lineTypeBox;
private UIButtonGroup<Integer> lineColorButton;
private ColorSelectBox lineColorBox;
private MarkerComboBox borderShape;
private UISpinner borderRadius;
private JPanel detailPane;
private JPanel colorBoxPane;
public VanChartBorderWithShapePane() {
initComponents();
@ -42,6 +48,10 @@ public class VanChartBorderWithShapePane extends BasicPane {
private void initComponents() {
lineTypeBox = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
lineColorButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
lineColorBox = new ColorSelectBox(100);
borderShape = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers());
borderRadius = new UISpinner(0, 1000, 1, 0);
@ -56,6 +66,7 @@ public class VanChartBorderWithShapePane extends BasicPane {
this.add(detailPane, BorderLayout.SOUTH);
initLineTypeListener();
initLineColorListener();
initShapeListener();
}
@ -71,6 +82,18 @@ public class VanChartBorderWithShapePane extends BasicPane {
detailPane.setVisible(lineTypeBox.getSelectedLineStyle() != Constants.LINE_NONE);
}
private void initLineColorListener() {
lineColorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkColorPane();
}
});
}
private void checkColorPane() {
colorBoxPane.setVisible(lineColorButton.getSelectedIndex() == CUSTOM_COLOR);
}
private void initShapeListener() {
borderShape.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -105,17 +128,52 @@ public class VanChartBorderWithShapePane extends BasicPane {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p, p};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), lineColorBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")),
UIComponentUtils.wrapWithBorderLayoutPane(borderShape)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), borderRadius}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
JPanel center = createLineColorPane();
JPanel south = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
JPanel panel = new JPanel(new BorderLayout());
panel.add(center, BorderLayout.CENTER);
panel.add(south, BorderLayout.SOUTH);
return panel;
}
private JPanel createLineColorPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] center = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), lineColorButton}
};
Component[][] south = new Component[][]{
new Component[]{null, null},
new Component[]{null, lineColorBox}
};
colorBoxPane = TableLayout4VanChartHelper.createGapTableLayoutPane(south, rowSize, columnSize);
JPanel panel = new JPanel(new BorderLayout());
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(center, rowSize, columnSize), BorderLayout.CENTER);
panel.add(colorBoxPane, BorderLayout.SOUTH);
return panel;
}
protected String title4PopupWindow() {
@ -128,11 +186,13 @@ public class VanChartBorderWithShapePane extends BasicPane {
}
lineTypeBox.setSelectedLineStyle(border.getBorderStyle());
lineColorButton.setSelectedIndex(border.isAutoColor() ? AUTO_COLOR : CUSTOM_COLOR);
lineColorBox.setSelectObject(border.getBorderColor());
borderShape.setSelectedMarker((Marker.createMarker(border.getShape())));
borderRadius.setValue(border.getRoundRadius());
checkDetailPane();
checkColorPane();
checkRadiusPane();
}
@ -142,6 +202,7 @@ public class VanChartBorderWithShapePane extends BasicPane {
}
border.setBorderStyle(lineTypeBox.getSelectedLineStyle());
border.setAutoColor(lineColorButton.getSelectedIndex() == AUTO_COLOR);
border.setBorderColor(lineColorBox.getSelectObject());
border.setShape(MarkerType.parse(borderShape.getSelectedMarkder().getMarkerType()));
border.setRoundRadius((int) borderRadius.getValue());

Loading…
Cancel
Save