From be32292bbdd72bddee878276498eb0f3fabcf0e9 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Thu, 8 Jun 2017 21:48:58 +0800 Subject: [PATCH] alphafine bug fix --- .../alphafine/component/AlphaFineDialog.java | 6 ++---- .../alphafine/component/AlphaFinePane.java | 16 +++++++++++----- designer/src/com/fr/start/Designer.java | 2 +- .../actions/help/alphafine/AlphaFineAction.java | 9 +++++++-- .../help/alphafine/AlphaFineContext.java | 17 ++++++++++++----- .../help/alphafine/AlphaFineListener.java | 1 + .../actions/help/alphafine/RemindPane.java | 2 +- 7 files changed, 35 insertions(+), 18 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 81188d9f4e..1b975f948f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -122,8 +122,6 @@ public class AlphaFineDialog extends UIDialog { searchTextField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { -// lastUpdateTime = System.currentTimeMillis(); -// waitingForSearch = true; doSearch(searchTextField.getText()); } }); @@ -590,7 +588,7 @@ public class AlphaFineDialog extends UIDialog { if (SwingUtilities.isLeftMouseButton(k)) { Point p = k.getLocationOnScreen(); Rectangle dialogRectangle = AlphaFineDialog.this.getBounds(); - Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize()); + Rectangle paneRectangle = new Rectangle(AlphaFinePane.getAlphaFinePane().getLocationOnScreen(), AlphaFinePane.getAlphaFinePane().getSize()); if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !forceOpen) { AlphaFineDialog.this.dispose(); forceOpen = false; @@ -614,7 +612,7 @@ public class AlphaFineDialog extends UIDialog { KeyEvent e = (KeyEvent) event; KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e); KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore(); - if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString())) { + if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFinePane.getAlphaFinePane().isVisible()) { doClickAction(); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java index 754ceab1c9..3d4173bc5c 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java @@ -1,12 +1,12 @@ package com.fr.design.mainframe.alphafine.component; -import com.fr.base.BaseUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineContext; import com.fr.design.actions.help.alphafine.AlphaFineListener; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.general.IOUtils; import com.fr.general.Inter; import javax.swing.*; @@ -20,7 +20,7 @@ import java.awt.event.ActionListener; public class AlphaFinePane extends BasicPane { private static AlphaFinePane alphaFinePane; - public static AlphaFinePane createAlphaFinePane() { + public static AlphaFinePane getAlphaFinePane() { if (alphaFinePane == null) { alphaFinePane = new AlphaFinePane(); } @@ -32,8 +32,8 @@ public class AlphaFinePane extends BasicPane { Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK); } UIButton refreshButton = new UIButton(); - refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); - refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Alphafine")); + refreshButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); + refreshButton.setToolTipText(Inter.getLocText("AlphaFine")); refreshButton.set4ToolbarButton(); this.add(refreshButton); refreshButton.addActionListener(new ActionListener() { @@ -42,11 +42,17 @@ public class AlphaFinePane extends BasicPane { AlphaFineHelper.showAlphaFineDialog(false); } }); - AlphaFineContext.addAlphafineContextListener(new AlphaFineListener() { + AlphaFineContext.addAlphaFineListener(new AlphaFineListener() { @Override public void showDialog() { AlphaFineHelper.showAlphaFineDialog(true); } + + @Override + public void setEnable(boolean isEnable) { + alphaFinePane.setVisible(isEnable); + + } }); } diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index 276c11b96f..b6855fdb01 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -346,7 +346,7 @@ public class Designer extends BaseDesigner { * @return 面板组件 */ public Component createAlphafinePane() { - return AlphaFinePane.createAlphaFinePane(); + return AlphaFinePane.getAlphaFinePane(); } diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java index ea10361b1d..221354108f 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java @@ -1,5 +1,6 @@ package com.fr.design.actions.help.alphafine; +import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -49,11 +50,15 @@ public class AlphaFineAction extends UpdateAction { final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final AlphaFineConfigPane alphaFineConfigPane = new AlphaFineConfigPane(); - alphaFineConfigPane.populate(DesignerEnvManager.getEnvManager().getAlphaFineConfigManager()); + final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); + if (!FRContext.isChineseEnv()) { + manager.setSearchOnLine(false); + } + alphaFineConfigPane.populate(manager); DialogActionListener dialogActionListener = new DialogActionAdapter() { public void doOk() { alphaFineConfigPane.update(); - designerFrame.refreshToolbar(); + AlphaFineContext.fireAlphaFineEnable(manager.isEnabled()); } }; BasicDialog basicDialog = alphaFineConfigPane.showMediumWindow(designerFrame, dialogActionListener); diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java index ef14b0753e..77ff93c1d7 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java @@ -7,23 +7,30 @@ import java.util.List; * Created by XiaXiang on 2017/5/27. */ public class AlphaFineContext { - private static List fireLoginContextListener = new ArrayList(); + private static List fireAlphaFineListener = new ArrayList(); /** * 触发AlphaFine弹窗 */ - public static void fireAlphaFineContextListener() { - for (AlphaFineListener l : fireLoginContextListener) { + public static void fireAlphaFineShowDialog() { + for (AlphaFineListener l : fireAlphaFineListener) { l.showDialog(); } } + public static void fireAlphaFineEnable(boolean isEnable) { + for (AlphaFineListener l : fireAlphaFineListener) { + l.setEnable(isEnable); + } + } + /** * 添加一个弹出AlphaFine的监听事件 * * @param l AlphaFine框弹出监听事件 */ - public static void addAlphafineContextListener(AlphaFineListener l) { - fireLoginContextListener.add(l); + public static void addAlphaFineListener(AlphaFineListener l) { + fireAlphaFineListener.add(l); } + } diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java index c7c5931266..b11696640d 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java @@ -5,4 +5,5 @@ package com.fr.design.actions.help.alphafine; */ public interface AlphaFineListener { void showDialog(); + void setEnable(boolean isEnable); } diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java b/designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java index acecfb08be..dce47b97a2 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java @@ -63,7 +63,7 @@ public class RemindPane extends JPanel { public void mousePressed(MouseEvent e) { manager.setOperateCount(0); dialog.dispose(); - AlphaFineContext.fireAlphaFineContextListener(); + AlphaFineContext.fireAlphaFineShowDialog(); } });