Browse Source

降低类型强转

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
cc93839488
  1. 9
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java
  2. 4
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java
  3. 3
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  4. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java
  5. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java
  6. 25
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  7. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  8. 20
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  9. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java

9
designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java

@ -111,13 +111,14 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
if (ComparatorUtils.equals(this.color, color)) { if (ComparatorUtils.equals(this.color, color)) {
return; return;
} }
checkIcon(this.color, color); Color oldColor = this.color;
this.color = color; this.color = color;
hidePopupMenu(); checkColorChange(oldColor, this.color);
fireColorStateChanged();
} }
protected void checkIcon(Color oldColor, Color newColor) { protected void checkColorChange(Color oldColor, Color newColor) {
hidePopupMenu();
fireColorStateChanged();
} }
private void showPopupMenu() { private void showPopupMenu() {

4
designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java

@ -9,7 +9,7 @@ import java.awt.Color;
public class UIColorButtonWithAuto extends UIColorButton { public class UIColorButtonWithAuto extends UIColorButton {
protected void checkIcon(Color oldColor, Color newColor) { protected void checkColorChange(Color oldColor, Color newColor) {
if (ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) { if (ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) {
setIcon(UIConstants.FONT_ICON); setIcon(UIConstants.FONT_ICON);
} }
@ -17,6 +17,8 @@ public class UIColorButtonWithAuto extends UIColorButton {
if (!ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) { if (!ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) {
setIcon(UIConstants.AUTO_FONT_ICON); setIcon(UIConstants.AUTO_FONT_ICON);
} }
super.checkColorChange(oldColor, newColor);
} }
protected ColorControlWindow getColorControlWindow() { protected ColorControlWindow getColorControlWindow() {

3
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -5,6 +5,7 @@ import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -113,7 +114,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5));
if (isSupportTransparent) { if (isSupportTransparent) {
UIButton transparentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency"));
this.add(transparentButton, BorderLayout.NORTH); this.add(transparentButton, BorderLayout.NORTH);
transparentButton.addActionListener(new ActionListener() { transparentButton.addActionListener(new ActionListener() {

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java

@ -4,12 +4,12 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import com.fr.base.Utils;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
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.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -54,7 +54,7 @@ public class ChartTextAttrNoColorPane extends ChartTextAttrPane {
} }
public FRFont updateFRFont() { public FRFont updateFRFont() {
String name = Utils.objectToString(getFontNameComboBox().getSelectedItem()); String name = GeneralUtils.objectToString(getFontNameComboBox().getSelectedItem());
return FRFont.getInstance(name, getFontStyle(), getFontSize()); return FRFont.getInstance(name, getFontStyle(), getFontSize());
} }

10
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java

@ -11,15 +11,11 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
private static final int AUTO_SIZE_INT = 0; private static final int AUTO_SIZE_INT = 0;
private boolean isFontSizeAuto; private boolean isFontSizeAuto = false;
private boolean isColorAuto; private boolean isColorAuto = false;
public ChartTextAttrPaneWithAuto() { public ChartTextAttrPaneWithAuto() {
this.isFontSizeAuto = false; super();
this.isColorAuto = false;
initState();
initComponents();
} }
public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) { public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) {

25
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java

@ -2,9 +2,12 @@ package com.fr.van.chart.designer.style.axis.gauge;
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.gui.ilable.UILabel;
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.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -77,13 +80,13 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
} }
protected JPanel createLabelPane(double[] row, double[] col){ protected JPanel createLabelPane(double[] row, double[] col){
showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")});
labelTextAttrPane = getChartTextAttrPane(); labelTextAttrPane = getChartTextAttrPane();
labelPanel = new JPanel(new BorderLayout()); labelPanel = new JPanel(new BorderLayout());
labelPanel.add(labelTextAttrPane); labelPanel.add(labelTextAttrPane);
labelPanel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); labelPanel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0));
JPanel panel = new JPanel(new BorderLayout(0, 6)); JPanel panel = new JPanel(new BorderLayout(0, 6));
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH); panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH);
panel.add(labelPanel, BorderLayout.CENTER); panel.add(labelPanel, BorderLayout.CENTER);
showLabel.addActionListener(new ActionListener() { showLabel.addActionListener(new ActionListener() {
@Override @Override
@ -96,11 +99,17 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
return jPanel; return jPanel;
} }
protected ChartTextAttrPane getChartTextAttrPane() {
if (isMulti(gaugeStyle)) {
return new ChartTextAttrPaneWithAuto(false, true);
} else {
return new ChartTextAttrPane();
}
}
private JPanel createValueDefinition(){ private JPanel createValueDefinition(){
switch (gaugeStyle){ switch (gaugeStyle){
case RING: case RING:
minMaxValuePane = new MinMaxValuePaneWithOutTick();
break;
case SLOT: case SLOT:
minMaxValuePane = new MinMaxValuePaneWithOutTick(); minMaxValuePane = new MinMaxValuePaneWithOutTick();
break; break;
@ -108,18 +117,18 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
minMaxValuePane = new VanChartMinMaxValuePane(); minMaxValuePane = new VanChartMinMaxValuePane();
break; break;
} }
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), minMaxValuePane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), minMaxValuePane);
} }
private JPanel createTickColorPane(double[] row, double[] col){ private JPanel createTickColorPane(double[] row, double[] col){
mainTickColor = new ColorSelectBox(100); mainTickColor = new ColorSelectBox(100);
secTickColor = new ColorSelectBox(100); secTickColor = new ColorSelectBox(100);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTickColor}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTickColor},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secTickColor}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secTickColor},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TickColor"), panel); JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_TickColor"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
return jPanel; return jPanel;
} }

16
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java

@ -35,9 +35,7 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
} }
protected void initToolTipContentPane(Plot plot) { protected void initToolTipContentPane(Plot plot) {
GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); switch (getGaugeStyle()) {
switch (gaugeStyle) {
case POINTER: case POINTER:
case POINTER_SEMI: case POINTER_SEMI:
dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this);
@ -49,21 +47,15 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
} }
protected boolean getFontSizeAuto() { protected boolean getFontSizeAuto() {
GaugeStyle gaugeStyle = ((VanChartGaugePlot) getPlot()).getGaugeStyle(); return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT;
return gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT;
} }
protected boolean getFontColorAuto() { protected boolean getFontColorAuto() {
GaugeStyle gaugeStyle = ((VanChartGaugePlot) getPlot()).getGaugeStyle(); return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT;
return gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT;
} }
protected boolean hasLabelPosition(Plot plot) { protected boolean hasLabelPosition(Plot plot) {
GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); switch (getGaugeStyle()) {
switch (gaugeStyle) {
case RING: case RING:
case SLOT: case SLOT:
return false; return false;

20
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -11,7 +11,6 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.GaugeDetailStyle;
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;
@ -30,6 +29,7 @@ import java.awt.Dimension;
*/ */
public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
private GaugeStyle gaugeStyle;
private UIButtonGroup<Integer> align; private UIButtonGroup<Integer> align;
private JPanel alignPane; private JPanel alignPane;
private Integer[] oldAlignValues; private Integer[] oldAlignValues;
@ -38,6 +38,19 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
super(plot, parent); super(plot, parent);
} }
protected void initLabelDetailPane (Plot plot) {
setGaugeStyle(((VanChartGaugePlot) plot).getGaugeStyle());
super.initLabelDetailPane(plot);
}
public GaugeStyle getGaugeStyle() {
return gaugeStyle;
}
public void setGaugeStyle(GaugeStyle gaugeStyle) {
this.gaugeStyle = gaugeStyle;
}
protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) {
style = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), style = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")});
@ -176,10 +189,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
protected boolean hasLabelAlign(Plot plot) { protected boolean hasLabelAlign(Plot plot) {
GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout();
GaugeDetailStyle gaugeDetailStyle = ((VanChartGaugePlot) plot).getGaugeDetailStyle();
return gaugeStyle == GaugeStyle.THERMOMETER && !gaugeDetailStyle.isHorizontalLayout();
} }
public void populate(AttrLabelDetail detail) { public void populate(AttrLabelDetail detail) {

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

@ -1,7 +1,6 @@
package com.fr.van.chart.designer.style.label; package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue;
@ -22,9 +21,7 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
} }
protected void initToolTipContentPane(Plot plot) { protected void initToolTipContentPane(Plot plot) {
GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); switch (getGaugeStyle()) {
switch (gaugeStyle) {
case POINTER: case POINTER:
case POINTER_SEMI: case POINTER_SEMI:
dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this);
@ -36,9 +33,7 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
} }
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); switch (getGaugeStyle()) {
switch (gaugeStyle) {
case POINTER: case POINTER:
case POINTER_SEMI: case POINTER_SEMI:
return getLabelPaneComponentsWithBackground(plot, p, columnSize); return getLabelPaneComponentsWithBackground(plot, p, columnSize);
@ -56,9 +51,7 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
} }
protected double[] getLabelPaneRowSize(Plot plot, double p) { protected double[] getLabelPaneRowSize(Plot plot, double p) {
GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); switch (getGaugeStyle()) {
switch (gaugeStyle) {
case POINTER: case POINTER:
case POINTER_SEMI: case POINTER_SEMI:
return new double[]{p, p, p, p, p}; return new double[]{p, p, p, p, p};
@ -68,11 +61,11 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP
} }
protected boolean getFontSizeAuto() { protected boolean getFontSizeAuto() {
return ((VanChartGaugePlot) getPlot()).getGaugeStyle() != GaugeStyle.THERMOMETER; return getGaugeStyle() != GaugeStyle.THERMOMETER;
} }
protected boolean hasLabelPosition(Plot plot) { protected boolean hasLabelPosition(Plot plot) {
return ((VanChartGaugePlot) plot).getGaugeStyle() == GaugeStyle.THERMOMETER; return getGaugeStyle() == GaugeStyle.THERMOMETER;
} }
protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { protected JPanel createTableLayoutPaneWithTitle(String title, Component component) {

Loading…
Cancel
Save