Browse Source

CHART-9435 使用枚举类型来判断字符自动类型

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
604c8530f8
  1. 32
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java
  2. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  3. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

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

@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIColorButtonWithAuto;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
@ -22,18 +23,33 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
}
}
public ChartTextAttrPaneWithAuto() {
super();
}
public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) {
this.isFontSizeAuto = isFontSizeAuto;
this.isColorAuto = isColorAuto;
public ChartTextAttrPaneWithAuto(FontAutoType type) {
initAutoType(type);
initState();
initComponents();
}
private void initAutoType(FontAutoType type) {
switch (type) {
case NONE:
this.isFontSizeAuto = false;
this.isColorAuto = false;
break;
case SIZE:
this.isFontSizeAuto = true;
this.isColorAuto = false;
break;
case COLOR:
this.isFontSizeAuto = false;
this.isColorAuto = true;
break;
case SIZE_AND_COLOR:
this.isFontSizeAuto = true;
this.isColorAuto = true;
break;
}
}
protected void initFontColorState() {
setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton());
}

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

@ -13,6 +13,7 @@ import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
@ -101,7 +102,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
protected ChartTextAttrPane getChartTextAttrPane() {
if (isMulti(gaugeStyle)) {
return new ChartTextAttrPaneWithAuto(true, true);
return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR);
} else {
return new ChartTextAttrPane();
}

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

@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -69,9 +70,23 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return false;
}
private FontAutoType getFontAutoType(boolean isFontSizeAuto, boolean isFontColorAuto) {
if (isFontSizeAuto && isFontColorAuto) {
return FontAutoType.SIZE_AND_COLOR;
}
if (isFontSizeAuto) {
return FontAutoType.SIZE;
}
if (isFontColorAuto) {
return FontAutoType.COLOR;
}
return FontAutoType.NONE;
}
protected ChartTextAttrPane initTextFontPane() {
FontAutoType type = getFontAutoType(isFontSizeAuto(), isFontColorAuto());
return new ChartTextAttrPaneWithAuto(isFontSizeAuto(), isFontColorAuto()) {
return new ChartTextAttrPaneWithAuto(type) {
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p};

Loading…
Cancel
Save