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> {
protected ColorSchemeComboBox styleSelectBox;
protected JPanel customPane;
protected JPanel changeColorSetPane;
protected FixedGradientBar colorGradient;
private ColorSchemeComboBox styleSelectBox;
private JPanel customPane;
private JPanel changeColorSetPane;
private FixedGradientBar colorGradient;
protected CardLayout cardLayout;
private CardLayout cardLayout;
protected ColorAdjustPane colorAdjustPane;
private ColorAdjustPane colorAdjustPane;
protected Color[] gradientColors;
protected Color[] accColors;
private Color[] gradientColors;
private Color[] accColors;
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() {
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
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) {

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 {
private static final int PREDEFINED_STYLE = 0;
private static final int CUSTOM = 1;
private UIButtonGroup<Integer> preButton;
private JPanel textFontPane;
@ -68,15 +71,15 @@ public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane {
}
private void checkPreButton() {
textFontPane.setVisible(preButton.getSelectedIndex() == 1);
textFontPane.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0));
textFontPane.setVisible(preButton.getSelectedIndex() == CUSTOM);
textFontPane.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 60) : new Dimension(0, 0));
}
public void populate(TextAttr textAttr) {
if (textAttr.isPredefinedStyle()) {
preButton.setSelectedIndex(0);
preButton.setSelectedIndex(PREDEFINED_STYLE);
} else {
preButton.setSelectedIndex(1);
preButton.setSelectedIndex(CUSTOM);
}
super.populate(textAttr);
checkPreButton();
@ -84,7 +87,7 @@ public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane {
public void update(TextAttr textAttr) {
int selectedIndex = preButton.getSelectedIndex();
if (selectedIndex == 0) {
if (selectedIndex == PREDEFINED_STYLE) {
textAttr.setPredefinedStyle(true);
} else {
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 {
private static final int PREDEFINED_STYLE = 0;
private static final int CUSTOM = 1;
private UIButtonGroup<Integer> preButton;
private ColorSelectBox colorSelectBox;
@ -62,8 +65,8 @@ public class ColorSelectBoxWithPreStyle extends BasicPane {
}
private void checkPreButton() {
colorSelectBox.setVisible(preButton.getSelectedIndex() == 1);
this.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 55) : new Dimension(0, 23));
colorSelectBox.setVisible(preButton.getSelectedIndex() == CUSTOM);
this.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23));
}
public String title4PopupWindow() {
@ -71,14 +74,14 @@ public class ColorSelectBoxWithPreStyle extends BasicPane {
}
public void populate(ColorWithPreStyle colorWithPreStyle) {
preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? 0 : 1);
preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? PREDEFINED_STYLE : CUSTOM);
colorSelectBox.setSelectObject(colorWithPreStyle.getColor());
checkPreButton();
}
public ColorWithPreStyle update() {
ColorWithPreStyle colorWithPreStyle = new ColorWithPreStyle();
colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == 0);
colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == PREDEFINED_STYLE);
colorWithPreStyle.setColor(colorSelectBox.getSelectObject());
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() {
customPane.setVisible(styleSelectBox.getSelectedIndex() != 0);
getCustomPane().setVisible(getStyleSelectBox().getSelectedIndex() != 0);
super.styleSelectBoxChange();
}
@ -49,8 +49,8 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe
protected Component[][] contentPaneComponents() {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox},
new Component[]{null, customPane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), getStyleSelectBox()},
new Component[]{null, getCustomPane()},
};
}
@ -61,14 +61,14 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe
public void populateBean(AttrFillStyle condition) {
if (condition.isPredefinedStyle()) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);
getStyleSelectBox().setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);
return;
}
populateBean(condition.getColorFillStyle());
}
public void updateBean(AttrFillStyle attrFillStyle) {
if (styleSelectBox.getSelectedIndex() == 0) {
if (getStyleSelectBox().getSelectedIndex() == 0) {
attrFillStyle.setPredefinedStyle(true);
return;
}
@ -83,7 +83,7 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe
AttrFillStyle attrFillStyle = new AttrFillStyle();
updateBean(attrFillStyle);
styleSelectBox.refresh();
getStyleSelectBox().refresh();
populateBean(attrFillStyle);
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 {
private static final int AUTO = 0;
public VanChartBackgroundPaneWithAutoColor() {
super();
}
@ -30,14 +32,14 @@ public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane
public void populateBackground(GeneralInfo attr, int begin) {
if (attr.isAutoBackground()) {
typeComboBox.setSelectedIndex(0);
typeComboBox.setSelectedIndex(AUTO);
return;
}
super.populateBackground(attr, begin + 1);
}
public void updateBackground(GeneralInfo attr) {
if (typeComboBox.getSelectedIndex() == 0) {
if (typeComboBox.getSelectedIndex() == AUTO) {
attr.setAutoBackground(true);
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 {
private static final int PREDEFINED_STYLE = 0;
@Override
protected void initList() {
paneList.add(new NullBackgroundQuickPane() {
@ -31,14 +33,14 @@ public class VanChartBackgroundPaneWithPreStyle extends VanChartBackgroundPane {
public void populateBackground(GeneralInfo attr, int begin) {
BackgroundWithPreStyle backgroundWithPreStyle = attr.getBackgroundWithPreStyle();
if (backgroundWithPreStyle.isPredefinedStyle()) {
typeComboBox.setSelectedIndex(0);
typeComboBox.setSelectedIndex(PREDEFINED_STYLE);
return;
}
super.populateBackground(attr, begin + 1);
}
public void updateBackground(GeneralInfo attr) {
if (typeComboBox.getSelectedIndex() == 0) {
if (typeComboBox.getSelectedIndex() == PREDEFINED_STYLE) {
attr.getBackgroundWithPreStyle().setPredefinedStyle(true);
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 UINumberDragPane transparent;//不透明度
private UINumberDragPane transparent;//不透明度
protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸
protected JPanel stackAndAxisEditExpandablePane;//堆積和坐標軸展开面板
@ -82,6 +82,14 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
super(parent, plot);
}
public UINumberDragPane getTransparent() {
return transparent;
}
public void setTransparent(UINumberDragPane transparent) {
this.transparent = transparent;
}
protected JPanel getContentPane(boolean custom) {
if (custom) {
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() {
transparent = new UINumberDragPane(0, 100);
setTransparent(new UINumberDragPane(0, 100));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH};
@ -255,7 +255,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
label.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{
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);
}

Loading…
Cancel
Save