Browse Source

CHART-15566 代码质量

research/11.0
白岳 4 years ago
parent
commit
ebabd33dff
  1. 24
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java
  2. 2
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java
  3. 13
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java
  4. 11
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java
  5. 12
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  6. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java
  7. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java
  8. 10
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  9. 4
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

24
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java

@ -37,17 +37,17 @@ import java.awt.event.ActionListener;
*/ */
public class ColorFillStylePane extends BasicBeanPane<ColorFillStyle> { public class ColorFillStylePane extends BasicBeanPane<ColorFillStyle> {
protected ColorSchemeComboBox styleSelectBox; private ColorSchemeComboBox styleSelectBox;
protected JPanel customPane; private JPanel customPane;
protected JPanel changeColorSetPane; private JPanel changeColorSetPane;
protected FixedGradientBar colorGradient; private FixedGradientBar colorGradient;
protected CardLayout cardLayout; private CardLayout cardLayout;
protected ColorAdjustPane colorAdjustPane; private ColorAdjustPane colorAdjustPane;
protected Color[] gradientColors; private Color[] gradientColors;
protected Color[] accColors; private Color[] accColors;
private boolean gradientSelect = false; private boolean gradientSelect = false;
@ -80,6 +80,14 @@ public class ColorFillStylePane extends BasicBeanPane<ColorFillStyle> {
} }
public ColorSchemeComboBox getStyleSelectBox() {
return styleSelectBox;
}
public JPanel getCustomPane() {
return customPane;
}
protected ColorSchemeComboBox createColorSchemeComboBox() { protected ColorSchemeComboBox createColorSchemeComboBox() {
return new ColorSchemeComboBox(); return new ColorSchemeComboBox();
} }

2
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java

@ -35,7 +35,7 @@ public class ChartTitleStylePane extends AbstractChartStylePane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title"); return Toolkit.i18nText("Fine-Design_Report_Title");
} }
public void populate(PredefinedChartStyle chartStyle) { public void populate(PredefinedChartStyle chartStyle) {

13
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java

@ -21,6 +21,9 @@ import java.awt.event.ActionListener;
*/ */
public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane { public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane {
private static final int PREDEFINED_STYLE = 0;
private static final int CUSTOM = 1;
private UIButtonGroup<Integer> preButton; private UIButtonGroup<Integer> preButton;
private JPanel textFontPane; private JPanel textFontPane;
@ -68,15 +71,15 @@ public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane {
} }
private void checkPreButton() { private void checkPreButton() {
textFontPane.setVisible(preButton.getSelectedIndex() == 1); textFontPane.setVisible(preButton.getSelectedIndex() == CUSTOM);
textFontPane.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); textFontPane.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 60) : new Dimension(0, 0));
} }
public void populate(TextAttr textAttr) { public void populate(TextAttr textAttr) {
if (textAttr.isPredefinedStyle()) { if (textAttr.isPredefinedStyle()) {
preButton.setSelectedIndex(0); preButton.setSelectedIndex(PREDEFINED_STYLE);
} else { } else {
preButton.setSelectedIndex(1); preButton.setSelectedIndex(CUSTOM);
} }
super.populate(textAttr); super.populate(textAttr);
checkPreButton(); checkPreButton();
@ -84,7 +87,7 @@ public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane {
public void update(TextAttr textAttr) { public void update(TextAttr textAttr) {
int selectedIndex = preButton.getSelectedIndex(); int selectedIndex = preButton.getSelectedIndex();
if (selectedIndex == 0) { if (selectedIndex == PREDEFINED_STYLE) {
textAttr.setPredefinedStyle(true); textAttr.setPredefinedStyle(true);
} else { } else {
textAttr.setPredefinedStyle(false); textAttr.setPredefinedStyle(false);

11
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java

@ -24,6 +24,9 @@ import java.awt.event.ActionListener;
*/ */
public class ColorSelectBoxWithPreStyle extends BasicPane { public class ColorSelectBoxWithPreStyle extends BasicPane {
private static final int PREDEFINED_STYLE = 0;
private static final int CUSTOM = 1;
private UIButtonGroup<Integer> preButton; private UIButtonGroup<Integer> preButton;
private ColorSelectBox colorSelectBox; private ColorSelectBox colorSelectBox;
@ -62,8 +65,8 @@ public class ColorSelectBoxWithPreStyle extends BasicPane {
} }
private void checkPreButton() { private void checkPreButton() {
colorSelectBox.setVisible(preButton.getSelectedIndex() == 1); colorSelectBox.setVisible(preButton.getSelectedIndex() == CUSTOM);
this.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 55) : new Dimension(0, 23)); this.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23));
} }
public String title4PopupWindow() { public String title4PopupWindow() {
@ -71,14 +74,14 @@ public class ColorSelectBoxWithPreStyle extends BasicPane {
} }
public void populate(ColorWithPreStyle colorWithPreStyle) { public void populate(ColorWithPreStyle colorWithPreStyle) {
preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? 0 : 1); preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? PREDEFINED_STYLE : CUSTOM);
colorSelectBox.setSelectObject(colorWithPreStyle.getColor()); colorSelectBox.setSelectObject(colorWithPreStyle.getColor());
checkPreButton(); checkPreButton();
} }
public ColorWithPreStyle update() { public ColorWithPreStyle update() {
ColorWithPreStyle colorWithPreStyle = new ColorWithPreStyle(); ColorWithPreStyle colorWithPreStyle = new ColorWithPreStyle();
colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == 0); colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == PREDEFINED_STYLE);
colorWithPreStyle.setColor(colorSelectBox.getSelectObject()); colorWithPreStyle.setColor(colorSelectBox.getSelectObject());
return colorWithPreStyle; return colorWithPreStyle;
} }

12
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -27,7 +27,7 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe
} }
protected void styleSelectBoxChange() { protected void styleSelectBoxChange() {
customPane.setVisible(styleSelectBox.getSelectedIndex() != 0); getCustomPane().setVisible(getStyleSelectBox().getSelectedIndex() != 0);
super.styleSelectBoxChange(); super.styleSelectBoxChange();
} }
@ -49,8 +49,8 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe
protected Component[][] contentPaneComponents() { protected Component[][] contentPaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), getStyleSelectBox()},
new Component[]{null, customPane}, new Component[]{null, getCustomPane()},
}; };
} }
@ -61,14 +61,14 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe
public void populateBean(AttrFillStyle condition) { public void populateBean(AttrFillStyle condition) {
if (condition.isPredefinedStyle()) { if (condition.isPredefinedStyle()) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT); getStyleSelectBox().setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);
return; return;
} }
populateBean(condition.getColorFillStyle()); populateBean(condition.getColorFillStyle());
} }
public void updateBean(AttrFillStyle attrFillStyle) { public void updateBean(AttrFillStyle attrFillStyle) {
if (styleSelectBox.getSelectedIndex() == 0) { if (getStyleSelectBox().getSelectedIndex() == 0) {
attrFillStyle.setPredefinedStyle(true); attrFillStyle.setPredefinedStyle(true);
return; return;
} }
@ -83,7 +83,7 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe
AttrFillStyle attrFillStyle = new AttrFillStyle(); AttrFillStyle attrFillStyle = new AttrFillStyle();
updateBean(attrFillStyle); updateBean(attrFillStyle);
styleSelectBox.refresh(); getStyleSelectBox().refresh();
populateBean(attrFillStyle); populateBean(attrFillStyle);
GUICoreUtils.repaint(this); GUICoreUtils.repaint(this);

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

@ -13,6 +13,8 @@ import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
*/ */
public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane { public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane {
private static final int AUTO = 0;
public VanChartBackgroundPaneWithAutoColor() { public VanChartBackgroundPaneWithAutoColor() {
super(); super();
} }
@ -30,14 +32,14 @@ public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane
public void populateBackground(GeneralInfo attr, int begin) { public void populateBackground(GeneralInfo attr, int begin) {
if (attr.isAutoBackground()) { if (attr.isAutoBackground()) {
typeComboBox.setSelectedIndex(0); typeComboBox.setSelectedIndex(AUTO);
return; return;
} }
super.populateBackground(attr, begin + 1); super.populateBackground(attr, begin + 1);
} }
public void updateBackground(GeneralInfo attr) { public void updateBackground(GeneralInfo attr) {
if (typeComboBox.getSelectedIndex() == 0) { if (typeComboBox.getSelectedIndex() == AUTO) {
attr.setAutoBackground(true); attr.setAutoBackground(true);
return; return;
} }

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

@ -15,6 +15,8 @@ import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
*/ */
public class VanChartBackgroundPaneWithPreStyle extends VanChartBackgroundPane { public class VanChartBackgroundPaneWithPreStyle extends VanChartBackgroundPane {
private static final int PREDEFINED_STYLE = 0;
@Override @Override
protected void initList() { protected void initList() {
paneList.add(new NullBackgroundQuickPane() { paneList.add(new NullBackgroundQuickPane() {
@ -31,14 +33,14 @@ public class VanChartBackgroundPaneWithPreStyle extends VanChartBackgroundPane {
public void populateBackground(GeneralInfo attr, int begin) { public void populateBackground(GeneralInfo attr, int begin) {
BackgroundWithPreStyle backgroundWithPreStyle = attr.getBackgroundWithPreStyle(); BackgroundWithPreStyle backgroundWithPreStyle = attr.getBackgroundWithPreStyle();
if (backgroundWithPreStyle.isPredefinedStyle()) { if (backgroundWithPreStyle.isPredefinedStyle()) {
typeComboBox.setSelectedIndex(0); typeComboBox.setSelectedIndex(PREDEFINED_STYLE);
return; return;
} }
super.populateBackground(attr, begin + 1); super.populateBackground(attr, begin + 1);
} }
public void updateBackground(GeneralInfo attr) { public void updateBackground(GeneralInfo attr) {
if (typeComboBox.getSelectedIndex() == 0) { if (typeComboBox.getSelectedIndex() == PREDEFINED_STYLE) {
attr.getBackgroundWithPreStyle().setPredefinedStyle(true); attr.getBackgroundWithPreStyle().setPredefinedStyle(true);
return; return;
} }

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

@ -65,7 +65,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
protected VanChartFillStylePane vanChartFillStylePane;//配色 protected VanChartFillStylePane vanChartFillStylePane;//配色
protected UINumberDragPane transparent;//不透明度 private UINumberDragPane transparent;//不透明度
protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸 protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸
protected JPanel stackAndAxisEditExpandablePane;//堆積和坐標軸展开面板 protected JPanel stackAndAxisEditExpandablePane;//堆積和坐標軸展开面板
@ -82,6 +82,14 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
super(parent, plot); super(parent, plot);
} }
public UINumberDragPane getTransparent() {
return transparent;
}
public void setTransparent(UINumberDragPane transparent) {
this.transparent = transparent;
}
protected JPanel getContentPane(boolean custom) { protected JPanel getContentPane(boolean custom) {
if (custom) { if (custom) {
JScrollPane scrollPane = new JScrollPane(); JScrollPane scrollPane = new JScrollPane();

4
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -246,7 +246,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
//不透明度 //不透明度
protected JPanel createAlphaPane() { protected JPanel createAlphaPane() {
transparent = new UINumberDragPane(0, 100); setTransparent(new UINumberDragPane(0, 100));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH};
@ -255,7 +255,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
label.setVerticalAlignment(SwingConstants.TOP); label.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(transparent)}, new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(getTransparent())},
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, TableLayout4VanChartHelper.COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, TableLayout4VanChartHelper.COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE);
} }

Loading…
Cancel
Save