diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 1e119d27ed..15a7c87c08 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -145,7 +145,6 @@ public interface UIConstants { public static final Color LIST_ITEM_SPLIT_LINE = new Color(0xf0f0f3); - public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png"); public static final BufferedImage DRAG_BAR_LIGHT = IOUtils.readImage("com/fr/design/images/control/bar-light.png"); public static final BufferedImage ARROW_NORTH = IOUtils.readImage("com/fr/design/images/control/up_arrow.png"); @@ -196,6 +195,7 @@ public interface UIConstants { public static final Icon ANA_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anas.png"); public static final Icon REFRESH_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/refresh.png"); public static final Icon FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"); + public static final Icon AUTO_FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/autoForeground.png"); public static final Icon HISTORY_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/history.png"); public static final Icon DELETE_ICON = IOUtils.readIcon("com/fr/design/images/m_file/close.png"); public static final Icon EDIT_ICON = IOUtils.readIcon("com/fr/design/images/m_file/edit.png"); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java index 86fc564384..28f5830619 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java @@ -24,10 +24,10 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver { - private static final int SIZE = 16; - private static final int SIZE_2 = 2; - private static final int SIZE_4 = 4; - private static final int SIZE_6 = 6; + public static final int SIZE = 16; + public static final int SIZE_2 = 2; + public static final int SIZE_4 = 4; + public static final int SIZE_6 = 6; private static final int POPUP_MENU_SHIFT = -70; private Color color = Color.BLACK; private ColorControlWindow popupWin; @@ -53,6 +53,14 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G iniListener(); } + public ColorControlWindow getPopupWin() { + return popupWin; + } + + public void setPopupWin(ColorControlWindow popupWin) { + this.popupWin = popupWin; + } + private void iniListener() { if (shouldResponseChangeListener()) { this.addColorChangeListener(new ChangeListener() { @@ -103,8 +111,12 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G if (ComparatorUtils.equals(this.color, color)) { return; } - + Color oldColor = this.color; this.color = color; + checkColorChange(oldColor, this.color); + } + + protected void checkColorChange(Color oldColor, Color newColor) { hidePopupMenu(); fireColorStateChanged(); } @@ -139,7 +151,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G repaint(); } - private ColorControlWindow getColorControlWindow() { + protected ColorControlWindow getColorControlWindow() { //find parant. if (this.popupWin == null) { this.popupWin = new ColorControlWindow(UIColorButton.this) { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java new file mode 100644 index 0000000000..c883148ca3 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java @@ -0,0 +1,38 @@ +package com.fr.design.gui.ibutton; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.constants.UIConstants; +import com.fr.design.style.color.ColorControlWindow; +import com.fr.design.style.color.ColorControlWindowWithAuto; +import com.fr.general.ComparatorUtils; + +import java.awt.Color; + +public class UIColorButtonWithAuto extends UIColorButton { + + protected void checkColorChange(Color oldColor, Color newColor) { + if (ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { + setIcon(UIConstants.FONT_ICON); + } + + if (!ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { + setIcon(UIConstants.AUTO_FONT_ICON); + } + + super.checkColorChange(oldColor, newColor); + } + + protected ColorControlWindow getColorControlWindow() { + if (getPopupWin() == null) { + ColorControlWindowWithAuto colorControlWindowWithAuto = new ColorControlWindowWithAuto(UIColorButtonWithAuto.this) { + protected void colorChanged() { + UIColorButtonWithAuto.this.setColor(this.getColor()); + } + }; + + setPopupWin(colorControlWindowWithAuto); + } + + return getPopupWin(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java index b5a5e40752..4ee3a119ea 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java @@ -38,6 +38,10 @@ public abstract class ColorControlWindow extends JPopupMenu { return selectionPopupPane.getColor(); } + public PopupHider getPopupHider() { + return popupHider; + } + /** * Init components. */ @@ -49,9 +53,13 @@ public abstract class ColorControlWindow extends JPopupMenu { setOpaque(false); setDoubleBuffered(true); setFocusable(false); + initSelectionPopupPane(isSupportTransparent); + this.pack(); + } + + protected void initSelectionPopupPane(boolean isSupportTransparent) { selectionPopupPane = new ColorSelectionPopupPane(isSupportTransparent); this.add(selectionPopupPane, BorderLayout.CENTER); - this.pack(); } class ColorSelectionPopupPane extends NewColorSelectPane { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java new file mode 100644 index 0000000000..05da3d4b97 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java @@ -0,0 +1,116 @@ +package com.fr.design.style.color; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ipoppane.PopupHider; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public abstract class ColorControlWindowWithAuto extends ColorControlWindow { + + private ColorSelectionPopupPaneWithAuto selectionPopupPaneWithAuto; + + public ColorControlWindowWithAuto(PopupHider popupHider) { + this(false, popupHider); + } + + public ColorControlWindowWithAuto(boolean isSupportTransparent, PopupHider popupHider) { + super(isSupportTransparent, popupHider); + } + + public Color getColor() { + if (selectionPopupPaneWithAuto == null) { + return null; + } + return selectionPopupPaneWithAuto.getColor(); + } + + protected void initSelectionPopupPane(boolean isSupportTransparent) { + selectionPopupPaneWithAuto = new ColorSelectionPopupPaneWithAuto(isSupportTransparent); + this.add(selectionPopupPaneWithAuto, BorderLayout.CENTER); + } + + class ColorSelectionPopupPaneWithAuto extends NewColorSelectPane { + private static final long serialVersionUID = 7822856562329146354L; + + public ColorSelectionPopupPaneWithAuto(boolean isSupportTransparent) { + super(isSupportTransparent); + + this.addChangeListener(new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + colorChanged(); + } + }); + } + + protected void doTransparent() { + getPopupHider().hidePopupMenu(); + setColor(null); + } + + protected void doAuto() { + getPopupHider().hidePopupMenu(); + setColor(ChartConstants.AUTO_FONT_COLOR); + } + + public void customButtonPressed() { + getPopupHider().hidePopupMenu(); + super.customButtonPressed(); + } + + protected void initSelectButton(boolean isSupportTransparent) { + setSupportTransparent(isSupportTransparent); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); + + UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); + UIButton autoButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto")); + + transparentButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doTransparent(); + } + }); + + autoButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doAuto(); + } + }); + + if (isSupportTransparent) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, 0}; + double[] rowSize = {p, p}; + + Component[][] components = new Component[][]{ + new Component[]{autoButton, null}, + new Component[]{transparentButton, null} + }; + + JPanel buttonGroup = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.add(buttonGroup, BorderLayout.NORTH); + } else { + this.add(autoButton, BorderLayout.NORTH); + } + } + + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index d532324165..e823f3061c 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/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.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; @@ -56,20 +57,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { * Constructor. */ NewColorSelectPane(boolean isSupportTransparent) { - this.isSupportTransparent = isSupportTransparent; - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); - if (isSupportTransparent) { - UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); - this.add(transpanrentButton, BorderLayout.NORTH); - transpanrentButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - doTransparent(); - } - }); - } + initSelectButton(isSupportTransparent); // center JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); @@ -97,7 +85,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(Box.createVerticalStrut(1)); // mod by anchore 16/11/16 - final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); + final UIButton customButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_More_Color")); // 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654) customButton.addMouseListener(new MouseAdapter() { @@ -117,6 +105,27 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(centerPane1); } + public void setSupportTransparent(boolean supportTransparent) { + isSupportTransparent = supportTransparent; + } + + protected void initSelectButton(boolean isSupportTransparent){ + this.isSupportTransparent = isSupportTransparent; + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); + if (isSupportTransparent) { + UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); + this.add(transparentButton, BorderLayout.NORTH); + transparentButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + doTransparent(); + } + }); + } + } + /** * 添加监听 diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png b/designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png new file mode 100755 index 0000000000..4186fea2cf Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png differ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index cc8a7db137..3de9aaa09a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -70,7 +71,7 @@ public class ChangeConfigPane extends BasicBeanPane { double[] columnSize = {p, f}; double[] rowSize = {p,p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Style")),configStyleButton}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Change_Style")),configStyleButton}, new Component[]{configPane, null}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -107,19 +108,19 @@ public class ChangeConfigPane extends BasicBeanPane { double[] rowSize = {p, p, p}; timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0); colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH); - switchStyleGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hide")}); + switchStyleGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Show"), Toolkit.i18nText("Fine-Design_Report_Hide")}); Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Arrow_Style")), switchStyleGroup, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), timeInterval, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Second"))}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")),colorSelectBox4carousel, null} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrow_Style")), switchStyleGroup, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), timeInterval, new UILabel(Toolkit.i18nText("Fine-Design_Chart_Time_Second"))}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Background")),colorSelectBox4carousel, null} }; return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); } private JPanel createTitleStylePane() { - final UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + final UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); styleAttrPane = new ChartTextAttrPane() { protected JPanel getContentPane(JPanel buttonPane) { double p = TableLayout.PREFERRED; @@ -132,7 +133,7 @@ public class ChangeConfigPane extends BasicBeanPane { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ - new Component[]{text, fontNameComboBox}, + new Component[]{text, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } @@ -143,7 +144,7 @@ public class ChangeConfigPane extends BasicBeanPane { private JPanel createButtonBackgroundColorPane(){ colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH); - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), colorSelectBox4button, EDIT_AREA_WIDTH); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Basic_Background"), colorSelectBox4button, EDIT_AREA_WIDTH); } private JPanel createButtonConfigPane() { @@ -160,8 +161,8 @@ public class ChangeConfigPane extends BasicBeanPane { } private void initButtonGroup() { - configStyleButton = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Button_Style"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Carousel_Style")}); + configStyleButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Button_Style"), + Toolkit.i18nText("Fine-Design_Chart_Carousel_Style")}); configStyleButton.setPreferredSize(new Dimension(WIDTH * 2, (int) configStyleButton.getPreferredSize().getHeight())); configStyleButton.addActionListener(new ActionListener() { @Override @@ -227,6 +228,6 @@ public class ChangeConfigPane extends BasicBeanPane { @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"); + return Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java index 820f0c3358..177168cd77 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java @@ -4,19 +4,17 @@ package com.fr.design.mainframe.chart.gui.style; -import com.fr.base.BaseUtils; -import com.fr.base.Utils; import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ibutton.UIColorButton; -import com.fr.design.gui.ibutton.UIToggleButton; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.FRFont; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; /** * Created by IntelliJ IDEA. @@ -25,34 +23,27 @@ import java.awt.*; * Date: 14-9-11 * Time: 上午11:27 */ -public class ChartTextAttrNoColorPane extends ChartTextAttrPane{ +public class ChartTextAttrNoColorPane extends ChartTextAttrPane { - public ChartTextAttrNoColorPane() { - super(); + public ChartTextAttrNoColorPane() { + super(); } protected void initComponents() { - fontColor = new UIColorButton(); - fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontSizeComboBox = new UIComboBox(Font_Sizes); - bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); - double p = TableLayout.PREFERRED; double f = TableLayout.FILL; Component[] components1 = new Component[]{ - italic, bold + getItalic(), getBold() }; JPanel buttonPane = new JPanel(new BorderLayout()); - buttonPane.add(fontSizeComboBox, BorderLayout.CENTER); + buttonPane.add(getFontSizeComboBox(), BorderLayout.CENTER); buttonPane.add(GUICoreUtils.createFlowPane(components1, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); - double[] columnSize = {f}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{getFontNameComboBox()}, new Component[]{buttonPane} }; @@ -62,20 +53,9 @@ public class ChartTextAttrNoColorPane extends ChartTextAttrPane{ populate(FRFont.getInstance()); } - /** - * 更新字体 - * @return 字体 - */ public FRFont updateFRFont() { - int style = Font.PLAIN; - if (bold.isSelected() && !italic.isSelected()) { - style = Font.BOLD; - } else if (!bold.isSelected() && italic.isSelected()) { - style = Font.ITALIC; - } else if (bold.isSelected() && italic.isSelected()) { - style = 3; - } - return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, - Float.valueOf(Utils.objectToString(fontSizeComboBox.getSelectedItem()))); + String name = GeneralUtils.objectToString(getFontNameComboBox().getSelectedItem()); + + return FRFont.getInstance(name, updateFontStyle(), updateFontSize()); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java index e1b17eb156..d04df2f72a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java @@ -1,47 +1,36 @@ package com.fr.design.mainframe.chart.gui.style; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; - -import javax.swing.JPanel; - -import com.fr.base.BaseUtils; -import com.fr.base.Utils; import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ibutton.UIColorButton; -import com.fr.design.gui.ibutton.UIToggleButton; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.FRFont; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; /** * 字体格式设置, 无字体大小设置. + * * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-1-21 下午03:35:47 */ public class ChartTextAttrNoFontSizePane extends ChartTextAttrPane { - - private static final long serialVersionUID = 4890526255627852602L; - public ChartTextAttrNoFontSizePane() { - super(); - } - - protected void initComponents() { - fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontColor = new UIColorButton(); - fontSizeComboBox = new UIComboBox(Font_Sizes); - bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + private static final long serialVersionUID = 4890526255627852602L; + + public ChartTextAttrNoFontSizePane() { + super(); + } + protected void initComponents() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; Component[] components1 = new Component[]{ - fontColor, italic, bold + getFontColor(), getItalic(), getBold() }; JPanel buttonPane = new JPanel(new BorderLayout()); buttonPane.add(GUICoreUtils.createFlowPane(components1, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.CENTER); @@ -49,7 +38,7 @@ public class ChartTextAttrNoFontSizePane extends ChartTextAttrPane { double[] columnSize = {f}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{getFontNameComboBox()}, new Component[]{buttonPane} }; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index dea30d0c97..a6be91a248 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -10,10 +10,12 @@ import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; @@ -25,25 +27,52 @@ import java.awt.Font; public class ChartTextAttrPane extends BasicPane { private static final long serialVersionUID = 6731679928019436869L; - private static final int FONT_START = 6; - private static final int FONT_END = 72; - protected UIComboBox fontNameComboBox; - protected UIComboBox fontSizeComboBox; - protected UIToggleButton bold; - protected UIToggleButton italic; - protected UIColorButton fontColor; - public static Integer[] Font_Sizes = new Integer[FONT_END-FONT_START+1]; - static{ - for(int i = FONT_START; i <= FONT_END; i++){ - Font_Sizes [i - FONT_START] = new Integer(i); + public static final int FONT_START = 6; + public static final int FONT_END = 72; + private UIComboBox fontNameComboBox; + private UIComboBox fontSizeComboBox; + private UIToggleButton bold; + private UIToggleButton italic; + private UIColorButton fontColor; + public static Integer[] FONT_SIZES = new Integer[FONT_END - FONT_START + 1]; + static { + for (int i = FONT_START; i <= FONT_END; i++) { + FONT_SIZES[i - FONT_START] = i; } } + public ChartTextAttrPane() { + initState(); initComponents(); } + public UIComboBox getFontNameComboBox() { + return fontNameComboBox; + } + + public UIComboBox getFontSizeComboBox() { + return fontSizeComboBox; + } + + public UIToggleButton getBold() { + return bold; + } + + public UIToggleButton getItalic() { + return italic; + } + + public UIColorButton getFontColor() { + return fontColor; + } + + public void setFontColor(UIColorButton fontColor) { + this.fontColor = fontColor; + } + /** * 标题 + * * @return 标题 */ public String title4PopupWindow() { @@ -84,9 +113,7 @@ public class ChartTextAttrPane extends BasicPane { fontNameComboBox.setSelectedItem(frFont.getFamily()); bold.setSelected(frFont.isBold()); italic.setSelected(frFont.isItalic()); - if(fontSizeComboBox != null) { - fontSizeComboBox.setSelectedItem(frFont.getSize()); - } + populateFontSize(frFont); if (fontColor != null) { fontColor.setColor(frFont.getForeground()); } @@ -96,6 +123,12 @@ public class ChartTextAttrPane extends BasicPane { registerAllComboBoxListener(listener); } + protected void populateFontSize(FRFont frFont) { + if (fontSizeComboBox != null) { + fontSizeComboBox.setSelectedItem(frFont.getSize()); + } + } + private void removeAllComboBoxListener() { fontNameComboBox.removeChangeListener(); fontSizeComboBox.removeChangeListener(); @@ -108,9 +141,16 @@ public class ChartTextAttrPane extends BasicPane { /** * 更新字 + * * @return 更新字 */ public FRFont updateFRFont() { + String name = GeneralUtils.objectToString(fontNameComboBox.getSelectedItem()); + + return FRFont.getInstance(name, updateFontStyle(), updateFontSize(), fontColor.getColor()); + } + + protected int updateFontStyle() { int style = Font.PLAIN; if (bold.isSelected() && !italic.isSelected()) { style = Font.BOLD; @@ -119,8 +159,12 @@ public class ChartTextAttrPane extends BasicPane { } else if (bold.isSelected() && italic.isSelected()) { style = 3; } - return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, - Float.valueOf(Utils.objectToString(fontSizeComboBox.getSelectedItem())), fontColor.getColor()); + + return style; + } + + protected float updateFontSize() { + return Float.parseFloat(GeneralUtils.objectToString(fontSizeComboBox.getSelectedItem())); } public void setEnabled(boolean enabled) { @@ -131,13 +175,23 @@ public class ChartTextAttrPane extends BasicPane { this.italic.setEnabled(enabled); } - protected void initComponents() { + protected Object[] getFontSizeComboBoxModel() { + return FONT_SIZES; + } + + protected void initState() { fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontSizeComboBox = new UIComboBox(Font_Sizes); - fontColor = new UIColorButton(); + fontSizeComboBox = new UIComboBox(getFontSizeComboBoxModel()); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + initFontColorState(); + } + protected void initFontColorState() { + setFontColor(new UIColorButton()); + } + + protected void initComponents() { Component[] components1 = new Component[]{ fontColor, italic, bold }; @@ -151,21 +205,21 @@ public class ChartTextAttrPane extends BasicPane { populate(FRFont.getInstance()); } - protected JPanel getContentPane (JPanel buttonPane) { + protected JPanel getContentPane(JPanel buttonPane) { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f,e}; + double[] columnSize = {f, e}; return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize); } - protected double[] getRowSize () { + protected double[] getRowSize() { double p = TableLayout.PREFERRED; return new double[]{p, p, p}; } protected Component[][] getComponents(JPanel buttonPane) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ new Component[]{null, null}, new Component[]{text, fontNameComboBox}, diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java new file mode 100644 index 0000000000..70fdf903eb --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -0,0 +1,66 @@ +package com.fr.design.mainframe.chart.gui.style; + +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.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; + 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() : new UIColorButton()); + } + + protected Object[] getFontSizeComboBoxModel() { + return isFontSizeAuto ? FONT_SIZES_WITH_AUTO : FONT_SIZES; + } + + protected float updateFontSize() { + if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { + return ChartConstants.AUTO_FONT_SIZE; + } + + return Float.parseFloat(GeneralUtils.objectToString(getFontSizeComboBox().getSelectedItem())); + } + + 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()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index e047830291..55622a85b5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/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.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; 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.plugin.chart.attr.axis.VanChartAxis; @@ -77,13 +80,13 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { } 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(); labelPanel = new JPanel(new BorderLayout()); labelPanel.add(labelTextAttrPane); labelPanel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); 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); showLabel.addActionListener(new ActionListener() { @Override @@ -96,11 +99,17 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { return jPanel; } + protected ChartTextAttrPane getChartTextAttrPane() { + if (isMulti(gaugeStyle)) { + return new ChartTextAttrPaneWithAuto(false, true); + } else { + return new ChartTextAttrPane(); + } + } + private JPanel createValueDefinition(){ switch (gaugeStyle){ case RING: - minMaxValuePane = new MinMaxValuePaneWithOutTick(); - break; case SLOT: minMaxValuePane = new MinMaxValuePaneWithOutTick(); break; @@ -108,18 +117,18 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { minMaxValuePane = new VanChartMinMaxValuePane(); 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){ mainTickColor = new ColorSelectBox(100); secTickColor = new ColorSelectBox(100); 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(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secTickColor}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTickColor}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secTickColor}, }; 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)); return jPanel; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index 4199e8f7c3..64187f89b9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java @@ -1,11 +1,6 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - -import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCate; @@ -13,39 +8,34 @@ import com.fr.van.chart.designer.component.label.LabelContentPaneWithPercent; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.Component; /** * 仪表盘的分类(多指针时)或者百分比标签 */ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabelDetailPane { - //todo 重新整理这个面板 private static final long serialVersionUID = 5176535960949074945L; - private GaugeStyle gaugeStyle; - public VanChartGaugeCateOrPercentLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } protected double[] getLabelPaneRowSize(Plot plot, double p) { - return hasLabelPosition(plot) ? new double[]{p,p,p} : new double[]{p,p}; - } + if (hasLabelAlign(plot)) { + return new double[]{p, p, p, p}; + } - private void initGaugeStyle(Plot plot) { - if(gaugeStyle == null){ - gaugeStyle = ((VanChartGaugePlot)plot).getGaugeStyle(); + if (hasLabelPosition(plot)) { + return new double[]{p, p, p}; } + + return new double[]{p, p}; } protected void initToolTipContentPane(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); - break; case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); break; @@ -55,13 +45,17 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } } + protected boolean isFontSizeAuto() { + return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; + } + protected boolean isFontColorAuto() { + return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; + } protected boolean hasLabelPosition(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case RING: - return false; case SLOT: return false; default: @@ -70,67 +64,10 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } protected double[] getLabelStyleRowSize(double p) { - switch (gaugeStyle){ - case RING: - return new double[] {p, p}; - case SLOT: - return new double[] {p, p}; - default: - return new double[] {p}; - } + return new double[]{p, p}; } protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component); } - - - protected Component[][] getLabelStyleComponents(Plot plot) { - initGaugeStyle(plot); - if (gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); - return new Component[][]{ - new Component[]{text,style}, - new Component[]{textFontPane,null}, - }; - } else { - return new Component[][]{ - new Component[]{textFontPane, null}, - }; - } - } - - protected ChartTextAttrPane initTextFontPane () { - //todo 需要再整理下 - if (gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT){ - return new ChartTextAttrPane(){ - protected double[] getRowSize () { - double p = TableLayout.PREFERRED; - return new double[]{p, p}; - } - - protected Component[][] getComponents(JPanel buttonPane) { - return new Component[][]{ - new Component[]{null, fontNameComboBox}, - new Component[]{null, buttonPane} - }; - } - }; - } else { - return new ChartTextAttrPane(){ - protected double[] getRowSize () { - double p = TableLayout.PREFERRED; - return new double[]{p, p}; - } - - protected Component[][] getComponents(JPanel buttonPane) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); - return new Component[][]{ - new Component[]{text, fontNameComboBox}, - new Component[]{null, buttonPane} - }; - } - }; - } - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 3cf057df59..0303a5a20d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -1,28 +1,59 @@ package com.fr.van.chart.designer.style.label; +import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.TwoTuple; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - +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.GaugeStyle; +import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Dimension; /** * Created by mengao on 2017/8/13. */ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { + private GaugeStyle gaugeStyle; + private UIButtonGroup align; + private JPanel alignPane; + private Integer[] oldAlignValues; + public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } + protected void initLabelDetailPane(Plot plot) { + setGaugeStyle(((VanChartGaugePlot) plot).getGaugeStyle()); + super.initLabelDetailPane(plot); + } + + public GaugeStyle getGaugeStyle() { + return ((VanChartGaugePlot)this.getPlot()).getGaugeStyle(); + } + + public void setGaugeStyle(GaugeStyle gaugeStyle) { + this.gaugeStyle = gaugeStyle; + } + protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane = initTextFontPane(); initStyleListener(); @@ -30,16 +61,156 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col); } + protected boolean isFontSizeAuto() { + return false; + } + + protected boolean isFontColorAuto() { + return false; + } + + protected ChartTextAttrPane initTextFontPane() { + + return new ChartTextAttrPaneWithAuto(isFontSizeAuto(), isFontColorAuto()) { + protected double[] getRowSize() { + double p = TableLayout.PREFERRED; + return new double[]{p, p}; + } - protected ChartTextAttrPane initTextFontPane () { - return new ChartTextAttrPane(); + protected Component[][] getComponents(JPanel buttonPane) { + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + return new Component[][]{ + new Component[]{text, getFontNameComboBox()}, + new Component[]{null, buttonPane} + }; + } + }; } - protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ - return TableLayoutHelper.createTableLayoutPane(comps,row,col); + protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) { + return TableLayoutHelper.createTableLayoutPane(comps, row, col); } protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { return TableLayout4VanChartHelper.createGapTableLayoutPane(title, panel); } + + protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { + if (hasLabelAlign(plot)) { + + return new Component[][]{ + new Component[]{dataLabelContentPane, null}, + new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical"), plot), null}, + new Component[]{createLabelAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")), null}, + new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, + }; + } else { + + return super.getLabelPaneComponents(plot, p, columnSize); + } + } + + private JPanel createLabelAlignPane(String title) { + JPanel panel = new JPanel(new BorderLayout()); + + alignPane = new JPanel(); + checkAlignPane(title); + panel.add(alignPane, BorderLayout.CENTER); + + return panel; + } + + protected void checkAlignPane(String title) { + if (alignPane == null && !hasLabelAlign(getPlot())) { + return; + } + if (alignPane != null && !hasLabelAlign(getPlot())) { + oldAlignValues = null; + alignPane.removeAll(); + return; + } + if (alignPane == null && hasLabelAlign(getPlot())) { + alignPane = new JPanel(); + } + TwoTuple result = getAlignNamesAndValues(); + + String[] names = result.getFirst(); + Integer[] values = result.getSecond(); + if (ComparatorUtils.equals(values, oldAlignValues)) { + return; + } + + oldAlignValues = values; + + align = new UIButtonGroup(names, values); + + Component[][] comps = new Component[2][2]; + + comps[0] = new Component[]{null, null}; + comps[1] = new Component[]{new UILabel(title, SwingConstants.LEFT), align}; + + double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; + double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + + alignPane.removeAll(); + alignPane.setLayout(new BorderLayout()); + alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER); + + if (parent != null) { + parent.initListener(alignPane); + } + } + + private TwoTuple getAlignNamesAndValues() { + String[] names = new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow"), Toolkit.i18nText("Fine-Design_Chart_Align_Left"), Toolkit.i18nText("Fine-Design_Chart_Align_Right")}; + Integer[] values = new Integer[]{ChartConstants.AUTO_LABEL_POSITION, Constants.LEFT, Constants.RIGHT}; + + return new TwoTuple<>(names, values); + } + + protected Component[][] getLabelStyleComponents(Plot plot) { + return new Component[][]{ + new Component[]{textFontPane, null}, + }; + } + + protected void checkPane() { + String verticalTitle = hasLabelAlign(getPlot()) + ? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical") + : Toolkit.i18nText("Fine-Design_Chart_Layout_Position"); + + checkPositionPane(verticalTitle); + checkAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")); + } + + protected void checkStyleUse() { + textFontPane.setVisible(true); + textFontPane.setPreferredSize(new Dimension(0, 60)); + } + + protected boolean hasLabelAlign(Plot plot) { + return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); + } + + public void populate(AttrLabelDetail detail) { + super.populate(detail); + + style.setSelectedIndex(1); + if (hasLabelAlign(this.getPlot()) && align != null) { + align.setSelectedItem(detail.getAlign()); + } + } + + public void update(AttrLabelDetail detail) { + super.update(detail); + + detail.setCustom(true); + if (align != null) { + if (align.getSelectedItem() != null) { + detail.setAlign(align.getSelectedItem()); + } else { + align.setSelectedItem(detail.getAlign()); + } + } + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java index 42e6909e9f..0f81deefca 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java @@ -7,6 +7,7 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.design.i18n.Toolkit; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -28,16 +29,14 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane { labelDetailPane = new VanChartGaugeCateOrPercentLabelDetailPane(this.plot, this.parent); gaugeValueLabelPane = new VanChartGaugeValueLabelDetailPane(this.plot, this.parent); GaugeStyle gaugeStyle = ((VanChartGaugePlot)this.plot).getGaugeStyle(); - String cateTitle, valueTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Label"); + String cateTitle, valueTitle = Toolkit.i18nText("Fine-Design_Chart_Value_Label"); switch (gaugeStyle){ case POINTER: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Label"); - break; case POINTER_SEMI: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Label"); + cateTitle = Toolkit.i18nText("Fine-Design_Chart_Category_Label"); break; default: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Percent_Label"); + cateTitle = Toolkit.i18nText("Fine-Design_Chart_Percent_Label"); break; } JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, labelDetailPane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java index 1d66925554..01a21d3823 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java +++ b/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; import com.fr.chart.chartattr.Plot; -import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue; @@ -17,24 +16,13 @@ import java.awt.Component; public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailPane { private static final long serialVersionUID = 2601073419430634281L; - private GaugeStyle gaugeStyle; - public VanChartGaugeValueLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } - private void initGaugeStyle(Plot plot) { - if(gaugeStyle == null){ - gaugeStyle = ((VanChartGaugePlot)plot).getGaugeStyle(); - } - } - protected void initToolTipContentPane(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); - break; case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); break; @@ -45,10 +33,8 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - return getLabelPaneComponentsWithBackground(plot, p, columnSize); case POINTER_SEMI: return getLabelPaneComponentsWithBackground(plot, p, columnSize); default: @@ -57,43 +43,32 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } private Component[][] getLabelPaneComponentsWithBackground(Plot plot, double p, double[] columnSize) { - return new Component[][]{ - new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot),null}, - new Component[]{createBackgroundColorPane(),null}, + return new Component[][]{ + new Component[]{dataLabelContentPane, null}, + new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot), null}, + new Component[]{createBackgroundColorPane(), null}, }; } protected double[] getLabelPaneRowSize(Plot plot, double p) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - return new double[]{p,p,p,p,p}; case POINTER_SEMI: - return new double[]{p,p,p,p,p}; + return new double[]{p, p, p, p, p}; default: return super.getLabelPaneRowSize(plot, p); } } + protected boolean isFontSizeAuto() { + return getGaugeStyle() != GaugeStyle.THERMOMETER; + } + protected boolean hasLabelPosition(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ - case THERMOMETER: - return true; - default: - return false; - } + return getGaugeStyle() == GaugeStyle.THERMOMETER; } protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component); } - - protected Component[][] getLabelStyleComponents(Plot plot) { - return new Component[][]{ - new Component[]{textFontPane,null}, - }; - } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index b774de89ea..c506d89ea1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -11,6 +11,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; @@ -58,13 +59,20 @@ public class VanChartPlotLabelDetailPane extends BasicPane { public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) { this.parent = parent; this.plot = plot; + initLabelDetailPane(plot); + } + protected void initLabelDetailPane (Plot plot) { this.setLayout(new BorderLayout()); initToolTipContentPane(plot); JPanel contentPane = createLabelPane(plot); this.add(contentPane,BorderLayout.CENTER); } + public Plot getPlot() { + return plot; + } + //默认从factory中取 protected void initToolTipContentPane(Plot plot) { dataLabelContentPane = PlotFactory.createPlotLabelContentPane(plot, parent, VanChartPlotLabelDetailPane.this); @@ -85,7 +93,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(hasLabelPosition(plot)){ return new Component[][]{ new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelPositionPane(new double[]{p,p,p}, columnSize, plot),null}, + new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null}, }; } else { @@ -112,7 +120,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); } - private TwoTuple getPositionNamesAndValues() { + protected TwoTuple getPositionNamesAndValues() { if (plot instanceof VanChartLabelPositionPlot) { String[] names = ((VanChartLabelPositionPlot) plot).getLabelLocationNameArray(); @@ -130,33 +138,33 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return null; } - private JPanel createLabelPositionPane(double[] row, double[] col, Plot plot) { + protected JPanel createLabelPositionPane(String title, Plot plot) { if (getPositionNamesAndValues() == null) { return new JPanel(); } - autoAdjust = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); + autoAdjust = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); JPanel panel = new JPanel(new BorderLayout()); positionPane = new JPanel(); - checkPositionPane(); + checkPositionPane(title); panel.add(positionPane, BorderLayout.CENTER); if (plot.isSupportLeadLine()) { - tractionLine = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); + tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); tractionLinePane = TableLayout4VanChartHelper.createGapTableLayoutPane("", tractionLine); panel.add(tractionLinePane, BorderLayout.SOUTH); initPositionListener(); } else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) { - panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); + panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); } return panel; } - private void checkPositionPane() { + protected void checkPositionPane(String title) { if (positionPane == null) { return; } @@ -176,7 +184,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { Component[][] comps = new Component[2][2]; comps[0] = new Component[]{null, null}; - comps[1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), SwingConstants.LEFT), position}; + comps[1] = new Component[]{new UILabel(title, SwingConstants.LEFT), position}; double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; @@ -193,7 +201,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); } @@ -207,14 +215,14 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane =initTextFontPane(); initStyleListener(); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getLabelStyleComponents(plot),row,col); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } protected ChartTextAttrPane initTextFontPane () { @@ -222,7 +230,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ new Component[]{null, null}, - new Component[]{null, fontNameComboBox}, + new Component[]{null, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } @@ -230,7 +238,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected Component[][] getLabelStyleComponents(Plot plot) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ new Component[]{null,null}, new Component[]{text,style}, @@ -249,7 +257,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel createBackgroundColorPane() { backgroundColor = new ColorSelectBox(100); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor); } protected String title4PopupWindow() { @@ -264,7 +272,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { checkPositionEnabled(); } - private void checkStyleUse() { + protected void checkStyleUse() { textFontPane.setVisible(style.getSelectedIndex() == 1); textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); } @@ -277,9 +285,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane { tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE); } - public void populate(AttrLabelDetail detail) { - checkPositionPane(); + protected void checkPane(){ + checkPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")); + } + public void populate(AttrLabelDetail detail) { + checkPane(); dataLabelContentPane.populateBean(detail.getContent()); if(position != null){ position.setSelectedItem(detail.getPosition()); @@ -306,7 +317,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(position != null && position.getSelectedItem() != null){ detail.setPosition(position.getSelectedItem()); - + } else if(position != null){ position.setSelectedItem(detail.getPosition()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index 47b205f85f..9b912ee9f7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java @@ -23,7 +23,7 @@ import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.van.chart.custom.style.VanChartCustomStylePane; -import com.fr.van.chart.designer.PlotFactory; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane; import com.fr.van.chart.designer.component.VanChartBeautyPane; @@ -112,7 +112,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP JPanel panel = new JPanel(new BorderLayout()); stylePane = createStylePane(); setColorPaneContent(panel); - JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color"), panel); + JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel.getComponentCount() == 0 ? null : colorPane; } @@ -127,13 +127,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //趋势线 protected JPanel createTrendLinePane() { trendLinePane = new VanChartTrendLinePane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TrendLine"), trendLinePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_TrendLine"), trendLinePane); } //线 protected JPanel createLineTypePane() { lineTypePane = getLineTypePane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line"), lineTypePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Line"), lineTypePane); } protected VanChartLineTypePane getLineTypePane() { @@ -143,26 +143,26 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //标记点类型 protected JPanel createMarkerPane() { markerPane = new VanChartMarkerPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); } //填充颜色 protected JPanel createAreaFillColorPane() { areaSeriesFillColorPane = new VanChartAreaSeriesFillColorPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area"), areaSeriesFillColorPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Area"), areaSeriesFillColorPane); } //边框(默认没有圆角) protected JPanel createBorderPane() { borderPane = createDiffBorderPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); } //半径界面 - protected JPanel createRadiusPane() { + protected JPanel createRadiusPane(String title) { radiusPane = initRadiusPane(); - radiusPaneWithTitle = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set"), radiusPane); + radiusPaneWithTitle = TableLayout4VanChartHelper.createGapTableLayoutPane(title, radiusPane); return ((VanChartPlot) plot).isInCustom() ? null : radiusPaneWithTitle; } @@ -175,7 +175,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP checkLarge(); } }); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), largeDataModelGroup); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Large_Model"), largeDataModelGroup); return createLargeDataModelPane(panel); } @@ -197,12 +197,12 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } protected JPanel createLargeDataModelPane(JPanel jPanel) { - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Data"), jPanel); + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Large_Data"), jPanel); return panel; } protected UIButtonGroup createLargeDataModelGroup() { - String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}; + String[] strings = new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}; DataProcessor[] values = new DataProcessor[]{new LargeDataModel(), new NormalDataModel()}; return new UIButtonGroup(strings, values); } @@ -240,7 +240,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //不透明度 protected JPanel createAlphaPane() { transparent = new UINumberDragPane(0, 100); - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); } //堆积和坐标轴设置(自定义柱形图等用到) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java index e3f45a9c0a..1c3ed4aa53 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java @@ -4,7 +4,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; @@ -52,7 +52,7 @@ public class VanChartPlotTooltipPane extends BasicPane { } protected void addComponents(Plot plot) { - isTooltipShow = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); + isTooltipShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); tooltipPane = createTooltipPane(plot); double p = TableLayout.PREFERRED; @@ -96,8 +96,8 @@ public class VanChartPlotTooltipPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{tooltipContentPane,null}, new Component[]{createLabelStylePane(),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{createDisplayStrategy(plot),null}, }; return components; @@ -109,25 +109,25 @@ public class VanChartPlotTooltipPane extends BasicPane { } protected JPanel createLabelStylePane() { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"),Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane = new ChartTextAttrPane() { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ new Component[]{null, null}, - new Component[]{null, fontNameComboBox}, + new Component[]{null, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), style); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Character"), style); JPanel panel1 = new JPanel(new BorderLayout()); panel1.add(panel, BorderLayout.CENTER); panel1.add(textFontPane, BorderLayout.SOUTH); initStyleListener(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel1); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel1); } @@ -142,8 +142,8 @@ public class VanChartPlotTooltipPane extends BasicPane { protected JPanel createDisplayStrategy(Plot plot) { showAllSeries = new UICheckBox(getShowAllSeriesLabelText()); - followMouse = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Follow_Mouse")}); + followMouse = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"), + Toolkit.i18nText("Fine-Design_Chart_Not_Follow_Mouse")}); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -151,17 +151,17 @@ public class VanChartPlotTooltipPane extends BasicPane { double[] rowSize = { p,p,p}; Component[][] components = new Component[3][2]; components[0] = new Component[]{null,null}; - components[1] = new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Prompt_Box")), UIComponentUtils.wrapWithBorderLayoutPane(followMouse)}; + components[1] = new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Prompt_Box")), UIComponentUtils.wrapWithBorderLayoutPane(followMouse)}; if(plot.isSupportTooltipSeriesType() && hasTooltipSeriesType()){ components[2] = new Component[]{showAllSeries,null}; } JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); } protected String getShowAllSeriesLabelText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_All_Series"); + return Toolkit.i18nText("Fine-Design_Chart_Show_All_Series"); }; protected boolean hasTooltipSeriesType() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index 1f705c9c94..cc912cf3fa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -12,6 +12,7 @@ import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWithOutImageAndShadow; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithMapZoom; +import com.fr.design.i18n.Toolkit; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -51,8 +52,8 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith } private JPanel createDrillToolsPane() { - openOrClose = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - JPanel openOrClosePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Drill_Dir"), openOrClose); + openOrClose = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); + JPanel openOrClosePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Drill_Dir"), openOrClose); textAttrPane = new ChartTextAttrPane() { @Override @@ -68,7 +69,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith @Override protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{getFontNameComboBox()}, new Component[]{buttonPane} }; } @@ -83,9 +84,9 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith double[] rowSize = {p, p, p, p, p, p}; Component[][] components = new Component[][]{ new Component[]{null}, - new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)}, - new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane)}, - new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Select_Color"), selectBackgroundPane)}, + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)}, + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane)}, + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Select_Color"), selectBackgroundPane)}, new Component[]{catalogSuperLink} }; drillPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -101,7 +102,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith } }); - JPanel panel1 = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Drill"), panel); + JPanel panel1 = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Drill"), panel); panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel1; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 79509aee25..564f45f9a3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -2,8 +2,10 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -11,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithFormula import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane; import com.fr.design.style.color.ColorSelectBox; import com.fr.general.ComparatorUtils; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.attr.GaugeDetailStyle; import com.fr.plugin.chart.base.AttrLabel; @@ -46,6 +49,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { private UIColorPickerPane colorPickerPane; + private UISpinner thermometerWidth; + private UINumberDragPane chutePercent; + public VanChartGaugeSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } @@ -66,15 +72,15 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { } private JPanel createGaugeLayoutPane() { - gaugeLayout = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")}); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation"),gaugeLayout); + gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")}); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation"),gaugeLayout); gaugeLayout.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { changeLabelPosition(); } }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); } private void changeLabelPosition() { @@ -104,10 +110,10 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel centerPanel = TableLayoutHelper.createTableLayoutPane(getDiffComponentsWithGaugeStyle(), row, col); panel.add(centerPanel, BorderLayout.CENTER); if(rotate != null){ - JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate); + JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate); panel.add(panel1, BorderLayout.NORTH); } - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } private Component[][] getDiffComponentsWithGaugeStyle() { @@ -119,21 +125,24 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null, null}, getPaneBackgroundColor(), getInnerPaneBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, + getChutePercent() }; case SLOT: return new Component[][]{ new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, + getChutePercent() }; case THERMOMETER: return new Component[][]{ new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Length_Set")), null}, + getThermometerWidth() }; default: return new Component[][]{ @@ -142,48 +151,58 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { getHingeBackgroundColor(), getNeedleColor(), getPaneBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} }; } } private Component[] getHingeColor() { hingeColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor}; } private Component[] getHingeBackgroundColor() { hingeBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor}; } private Component[] getNeedleColor() { needleColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor}; } private Component[] getPaneBackgroundColor() { paneBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor}; } private Component[] getSlotBackgroundColor() { slotBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; + } + + private Component[] getThermometerWidth() { + thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10); + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; + } + + private Component[] getChutePercent() { + chutePercent = new UINumberDragPane(0, 100, 1); + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent}; } private void initRotate() { - rotate = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AntiClockWise"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ClockWise")}); + rotate = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_AntiClockWise"), Toolkit.i18nText("Fine-Design_Chart_ClockWise")}); } private Component[] getInnerPaneBackgroundColor() { innerPaneBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor}; } private JPanel createGaugeBandsPane() { colorPickerPane = new ColorPickerPaneWithFormula(parentPane, "meterString"); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane); } @@ -218,6 +237,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(innerPaneBackgroundColor != null){ innerPaneBackgroundColor.setSelectObject(detailStyle.getInnerPaneBackgroundColor()); } + if(thermometerWidth != null){ + thermometerWidth.setValue(detailStyle.getThermometerWidth()); + } + if(chutePercent != null){ + chutePercent.populateBean(detailStyle.getChutePercent()); + } colorPickerPane.populateBean(detailStyle.getHotAreaColor()); } @@ -256,6 +281,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(innerPaneBackgroundColor != null){ detailStyle.setInnerPaneBackgroundColor(innerPaneBackgroundColor.getSelectObject()); } + if(thermometerWidth != null){ + detailStyle.setThermometerWidth(thermometerWidth.getValue()); + } + if(chutePercent != null){ + detailStyle.setChutePercent(chutePercent.updateBean()); + } colorPickerPane.updateBean(detailStyle.getHotAreaColor()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index 0ec79c3b8a..2169c4a20c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -8,6 +8,7 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -53,21 +54,21 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { startAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); endAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); innerRadius = new UISpinner(0, 100, 1, 0); - supportRotation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); + supportRotation = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Angle")),startAngle}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Inner_Radius")),innerRadius}, - new Component[]{createRadiusPane(),null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation")),supportRotation} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Start_Angle")),startAngle}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Radius")),innerRadius}, + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")),null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Rotation")),supportRotation} }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } public void populateBean(Plot plot) {