From db1f70f307b741a6e170b52faf3b61625e8bbdfc Mon Sep 17 00:00:00 2001 From: momeak Date: Fri, 15 Sep 2017 10:02:55 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-4600=20=E6=97=A0=E6=B3=95=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E8=AE=BE=E7=BD=AE=E5=8D=95=E5=85=83=E6=A0=BC=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/style/FormatPane.java | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) 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 49f0ebd15..43fcd247f 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