diff --git a/designer/src/com/fr/design/present/CurrencyLinePane.java b/designer/src/com/fr/design/present/CurrencyLinePane.java index ab4af16450..60c96bd7c4 100644 --- a/designer/src/com/fr/design/present/CurrencyLinePane.java +++ b/designer/src/com/fr/design/present/CurrencyLinePane.java @@ -6,6 +6,7 @@ import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -33,8 +34,8 @@ public class CurrencyLinePane extends FurtherBasicBeanPane private static final int VS_NUM = 4; private static final int VG_NUM = 6; private static final Dimension NORMAL_DIMENSION = new Dimension(155, 20); - private UIBasicSpinner intPartSpinner; - private UIBasicSpinner deciPartSpinner; + private UISpinner intPartSpinner; + private UISpinner deciPartSpinner; private UITextField textField; private CurrencyLinePreviewPane CurrencyLinePreviewPane; private int intPart = 9; @@ -73,11 +74,11 @@ public class CurrencyLinePane extends FurtherBasicBeanPane protected void initComponents() { // 整数位选择 - intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1)); + intPartSpinner = new UISpinner(1, 20, 1, 9); intPartSpinner.setPreferredSize(NORMAL_DIMENSION); // 小数位选择 - deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1)); + deciPartSpinner = new UISpinner(1, 10, 1, 2); deciPartSpinner.setPreferredSize(NORMAL_DIMENSION); // 预览区域 textField = new UITextField(10); @@ -132,8 +133,8 @@ public class CurrencyLinePane extends FurtherBasicBeanPane */ public CurrencyLineAttr update() { CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); - currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); - currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); + currencylineAttr.setintPart((int) this.intPartSpinner.getValue()); + currencylineAttr.setdeciPart((int) this.deciPartSpinner.getValue()); return currencylineAttr; } @@ -225,8 +226,8 @@ public class CurrencyLinePane extends FurtherBasicBeanPane @Override public CurrencyLinePresent updateBean() { CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); - currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); - currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); + currencylineAttr.setintPart((int) this.intPartSpinner.getValue()); + currencylineAttr.setdeciPart((int) this.deciPartSpinner.getValue()); return new CurrencyLinePresent(currencylineAttr); } diff --git a/designer_base/src/com/fr/design/gui/imenu/UIMenuEastAttrItem.java b/designer_base/src/com/fr/design/gui/imenu/UIMenuEastAttrItem.java index 0df132caf4..e27446bec8 100644 --- a/designer_base/src/com/fr/design/gui/imenu/UIMenuEastAttrItem.java +++ b/designer_base/src/com/fr/design/gui/imenu/UIMenuEastAttrItem.java @@ -62,7 +62,7 @@ public class UIMenuEastAttrItem extends JMenuItem { if (menuItem.isOpaque()) { if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { - GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 0); + GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.POPUP_TITLE_BACKGROUND, 0); } else { GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.TOOLBARUI_BACKGROUND, 0); } @@ -70,7 +70,7 @@ public class UIMenuEastAttrItem extends JMenuItem { } else if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { - GUIPaintUtils.fillPaint((Graphics2D)g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); + GUIPaintUtils.fillPaint((Graphics2D)g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.POPUP_TITLE_BACKGROUND, 7); g.setColor(oldColor); } } @@ -95,7 +95,6 @@ public class UIMenuEastAttrItem extends JMenuItem { fm.getAscent() - 1); } } else { - menuItem.setForeground(isArmed() ? Color.white : Color.black); SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, -1, 0, textRect.y + fm.getAscent()); } diff --git a/designer_base/src/com/fr/design/gui/ispinner/UISpinnerUI.java b/designer_base/src/com/fr/design/gui/ispinner/UISpinnerUI.java index 3a333bbf1e..2c32a00aef 100644 --- a/designer_base/src/com/fr/design/gui/ispinner/UISpinnerUI.java +++ b/designer_base/src/com/fr/design/gui/ispinner/UISpinnerUI.java @@ -5,7 +5,9 @@ package com.fr.design.gui.ispinner; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.SpecialUIButton; +import com.fr.design.gui.ibutton.UIButton; import javax.swing.*; import javax.swing.plaf.ComponentUI; @@ -42,8 +44,8 @@ public class UISpinnerUI extends BasicSpinnerUI { } protected Component createPreviousButton() { - JButton b = new SpecialUIButton(new UISpinnerButtonUI(SwingConstants.SOUTH)); - +// JButton b = new SpecialUIButton(new UISpinnerButtonUI(SwingConstants.SOUTH)); + JButton b = new UIButton(UIConstants.ARROW_DOWN_ICON); b.putClientProperty("isSpinnerButton", Boolean.TRUE); b.setFocusable(false); b.addActionListener(PREVIOUS_BUTTON_HANDLER); @@ -53,8 +55,8 @@ public class UISpinnerUI extends BasicSpinnerUI { } protected Component createNextButton() { - JButton b = new SpecialUIButton(new UISpinnerButtonUI(SwingConstants.NORTH)); - +// JButton b = new SpecialUIButton(new UISpinnerButtonUI(SwingConstants.NORTH)); + JButton b = new UIButton(UIConstants.ARROW_UP_ICON); b.putClientProperty("isSpinnerButton", Boolean.TRUE); b.setFocusable(false); b.addActionListener(NEXT_BUTTON_HANDLER); diff --git a/designer_base/src/com/fr/design/gui/style/FormatPane.java b/designer_base/src/com/fr/design/gui/style/FormatPane.java index 49f0ebd159..43fcd247fa 100644 --- a/designer_base/src/com/fr/design/gui/style/FormatPane.java +++ b/designer_base/src/com/fr/design/gui/style/FormatPane.java @@ -9,6 +9,8 @@ import com.fr.data.core.FormatField.FormatContents; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; +import com.fr.design.event.GlobalNameListener; +import com.fr.design.event.GlobalNameObserver; import com.fr.design.gui.icombobox.TextFontComboBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; @@ -34,7 +36,7 @@ import java.text.SimpleDateFormat; * @author zhou * @since 2012-5-24上午10:57:00 */ -public class FormatPane extends AbstractBasicStylePane { +public class FormatPane extends AbstractBasicStylePane implements GlobalNameObserver { private static final long serialVersionUID = 724330854437726751L; private static final int LABLE_X = 4; @@ -61,7 +63,7 @@ public class FormatPane extends AbstractBasicStylePane { private FRFontPane frFontPane; private boolean isRightFormate; private boolean isDate = false; - private boolean isFormat = false; + private GlobalNameListener globalNameListener = null; /** * Constructor. @@ -87,13 +89,14 @@ public class FormatPane extends AbstractBasicStylePane { UIComboBoxRenderer render = createComBoxRender(); typeComboBox.setRenderer(render); typeComboBox.addItemListener(itemListener); + typeComboBox.setGlobalName("typeComboBox"); contentPane.add(sampleLabel, BorderLayout.NORTH); txtCenterPane = new JPanel(new BorderLayout()); textField = new TextFontComboBox(); -// textField.setItemArray(FormatField.getInstance().getFormatArray(getFormatContents())); textField.addItemListener(textFieldItemListener); textField.setEditable(true); + textField.setGlobalName("textField"); txtCenterPane.add(textField, BorderLayout.NORTH); contentPane.add(txtCenterPane, BorderLayout.CENTER); @@ -333,7 +336,6 @@ public class FormatPane extends AbstractBasicStylePane { centerPane.setPreferredSize(new Dimension(270, 65)); cardLayout.show(centerPane, "show"); } - isFormat = true; } } @@ -343,7 +345,6 @@ public class FormatPane extends AbstractBasicStylePane { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { - isFormat = true; refreshPreviewLabel(); } } @@ -355,7 +356,6 @@ public class FormatPane extends AbstractBasicStylePane { */ public void populateBean(Style style) { this.populateBean(style.getFormat()); - isFormat = false; this.frFontPane.populateBean(style.getFRFont()); } @@ -364,8 +364,7 @@ public class FormatPane extends AbstractBasicStylePane { * update */ public Style update(Style style) { - if (isFormat) { - isFormat = false; + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), "textField") || ComparatorUtils.equals(globalNameListener.getGlobalName(), "typeComboBox")) { return style.deriveFormat(this.update()); } else { return style.deriveFRFont(this.frFontPane.update(style.getFRFont())); @@ -424,4 +423,18 @@ public class FormatPane extends AbstractBasicStylePane { } } + @Override + public void registerNameListener(GlobalNameListener listener) { + globalNameListener = listener; + } + + @Override + public boolean shouldResponseNameListener() { + return false; + } + + @Override + public void setGlobalName(String name) { + + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index 1583ca7700..bccf3c8f86 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -8,6 +8,7 @@ import com.fr.design.gui.ibutton.UISliderButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.gui.ispinner.UISpinnerUI; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -132,6 +133,7 @@ public class JSliderPane extends JPanel { return new Point(event.getX(), event.getY() - TOOLTIP_Y); } }; + showValSpinner.setUI(new UISpinnerUI()); showValSpinner.setEnabled(true); showValSpinner.addChangeListener(showValSpinnerChangeListener); showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));