帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.3 KiB

package com.fr.design.mainframe.chart.gui.style;
import com.fr.chart.base.ChartConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIColorButtonWithAuto;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
private boolean isFontSizeAuto = false;
private boolean isColorAuto = false;
4 years ago
public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2];
static {
FONT_SIZES_WITH_AUTO[0] = AUTO;
for (int i = 1; i < FONT_SIZES_WITH_AUTO.length; i++) {
FONT_SIZES_WITH_AUTO[i] = FONT_START + i - 1 + "";
}
}
public ChartTextAttrPaneWithAuto() {
super();
}
public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) {
this.isFontSizeAuto = isFontSizeAuto;
this.isColorAuto = isColorAuto;
initState();
initComponents();
}
protected void initFontColorState() {
setFontColor(isColorAuto ? new UIColorButtonWithAuto(UIConstants.AUTO_FONT_ICON) : new UIColorButton(UIConstants.FONT_ICON));
}
protected Object[] getFontSizeComboBoxModel() {
4 years ago
return isFontSizeAuto ? FONT_SIZES_WITH_AUTO : FONT_SIZES;
}
4 years ago
protected float updateFontSize() {
if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) {
return ChartConstants.AUTO_FONT_SIZE;
}
return Float.parseFloat(GeneralUtils.objectToString(getFontSizeComboBox().getSelectedItem()));
}
4 years ago
protected void populateFontSize(FRFont frFont) {
if (getFontSizeComboBox() != null && isFontSizeAuto) {
if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) {
getFontSizeComboBox().setSelectedItem(AUTO);
} else {
getFontSizeComboBox().setSelectedItem(frFont.getSize() + "");
}
}
if (getFontSizeComboBox() != null && !isFontSizeAuto) {
getFontSizeComboBox().setSelectedItem(frFont.getSize());
}
}
}