|
|
@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; |
|
|
|
import com.fr.design.gui.ibutton.UIColorButton; |
|
|
|
import com.fr.design.gui.ibutton.UIColorButton; |
|
|
|
import com.fr.design.gui.ibutton.UIColorButtonWithAuto; |
|
|
|
import com.fr.design.gui.ibutton.UIColorButtonWithAuto; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
|
|
|
import com.fr.plugin.chart.type.FontAutoType; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.FRFont; |
|
|
|
import com.fr.general.FRFont; |
|
|
|
import com.fr.general.GeneralUtils; |
|
|
|
import com.fr.general.GeneralUtils; |
|
|
@ -11,9 +12,9 @@ import com.fr.general.GeneralUtils; |
|
|
|
public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { |
|
|
|
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 boolean isFontSizeAuto = false; |
|
|
|
private FontAutoType type; |
|
|
|
private boolean isColorAuto = false; |
|
|
|
|
|
|
|
public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2]; |
|
|
|
public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2]; |
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
static { |
|
|
|
FONT_SIZES_WITH_AUTO[0] = AUTO; |
|
|
|
FONT_SIZES_WITH_AUTO[0] = AUTO; |
|
|
|
|
|
|
|
|
|
|
@ -22,28 +23,30 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ChartTextAttrPaneWithAuto() { |
|
|
|
public ChartTextAttrPaneWithAuto(FontAutoType type) { |
|
|
|
super(); |
|
|
|
this.type = type; |
|
|
|
|
|
|
|
initState(); |
|
|
|
|
|
|
|
initComponents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) { |
|
|
|
private boolean isFontSizeAuto() { |
|
|
|
this.isFontSizeAuto = isFontSizeAuto; |
|
|
|
return type == FontAutoType.SIZE || type == FontAutoType.SIZE_AND_COLOR; |
|
|
|
this.isColorAuto = isColorAuto; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
initState(); |
|
|
|
private boolean isFontColorAuto() { |
|
|
|
initComponents(); |
|
|
|
return type == FontAutoType.COLOR || type == FontAutoType.SIZE_AND_COLOR; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void initFontColorState() { |
|
|
|
protected void initFontColorState() { |
|
|
|
setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton()); |
|
|
|
setFontColor(isFontColorAuto() ? new UIColorButtonWithAuto() : new UIColorButton()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected Object[] getFontSizeComboBoxModel() { |
|
|
|
protected Object[] getFontSizeComboBoxModel() { |
|
|
|
return isFontSizeAuto ? FONT_SIZES_WITH_AUTO : FONT_SIZES; |
|
|
|
return isFontSizeAuto() ? FONT_SIZES_WITH_AUTO : FONT_SIZES; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected float updateFontSize() { |
|
|
|
protected float updateFontSize() { |
|
|
|
if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { |
|
|
|
if (isFontSizeAuto() && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { |
|
|
|
return ChartConstants.AUTO_FONT_SIZE; |
|
|
|
return ChartConstants.AUTO_FONT_SIZE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -51,7 +54,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void populateFontSize(FRFont frFont) { |
|
|
|
protected void populateFontSize(FRFont frFont) { |
|
|
|
if (getFontSizeComboBox() != null && isFontSizeAuto) { |
|
|
|
if (getFontSizeComboBox() != null && isFontSizeAuto()) { |
|
|
|
if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) { |
|
|
|
if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) { |
|
|
|
getFontSizeComboBox().setSelectedItem(AUTO); |
|
|
|
getFontSizeComboBox().setSelectedItem(AUTO); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -59,8 +62,8 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (getFontSizeComboBox() != null && !isFontSizeAuto) { |
|
|
|
if (getFontSizeComboBox() != null && !isFontSizeAuto()) { |
|
|
|
getFontSizeComboBox().setSelectedItem(frFont.getSize()); |
|
|
|
getFontSizeComboBox().setSelectedItem(frFont.getSize()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |