From 99fddf29b413cdf876a28a7ab0d82eef839474f2 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Fri, 7 Jul 2017 13:41:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?alphafine=20=E4=BF=AE=E6=94=B9=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86=E5=BC=B9=E5=87=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/AlphaFineHelper.java | 15 +++++++--- .../alphafine/component/AlphaFineDialog.java | 28 +++++++++++++++++-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 559631885..178c6d7e3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -21,15 +21,22 @@ import java.util.List; public class AlphaFineHelper { public static final NoResultModel NO_RESULT_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_AlphaFine_NoResult")); public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_ConnectionFailed")); + private static AlphaFineDialog alphaFineDialog; /** * 弹出alphafine搜索面板 */ public static void showAlphaFineDialog(boolean forceOpen) { - AlphaFineDialog dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen); - final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); - manager.setNeedRemind(false); - dialog.setVisible(true); + if (alphaFineDialog == null) { + alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen); + alphaFineDialog.setVisible(true); + final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); + manager.setNeedRemind(false); + } else { + alphaFineDialog.setVisible(!alphaFineDialog.isVisible()); + } + + } 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 13d083176..0abb29a75 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -69,6 +69,7 @@ public class AlphaFineDialog extends UIDialog { private static final String DS_NAME = "dsname=\""; private static final String PLUGIN_MARK_SHORT = "k:4 "; private static final String PLUGIN_MARK = "k:shop "; + private static final String PLACE_HOLDER = "AlphaFine"; private AlphaFineTextField searchTextField; private UIButton closeButton; @@ -171,7 +172,7 @@ public class AlphaFineDialog extends UIDialog { * 初始化输入框 */ private void initSearchTextField() { - searchTextField = new AlphaFineTextField("AlphaFine"); + searchTextField = new AlphaFineTextField(PLACE_HOLDER); initTextFieldKeyListener(); searchTextField.setFont(AlphaFineConstants.GREATER_FONT); searchTextField.setBackground(Color.white); @@ -235,7 +236,30 @@ public class AlphaFineDialog extends UIDialog { } boolean isNeedSearch(String text) { - return ComparatorUtils.equals("AlphaFine", text) || text.contains("'"); + return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'"); + } + + @Override + public void setVisible(boolean isVisible) { + if (!isVisible) { + dispose(); + return; + } + super.setVisible(isVisible); + } + + @Override + public void dispose() { + resetDialog(); + super.dispose(); + } + + /** + * 重置搜索框 + */ + private void resetDialog() { + removeSearchResult(); + searchTextField.setText(null); } /** From 88813c4862de401a6beffee059a888d6b08bcac6 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Fri, 7 Jul 2017 13:55:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9C=89=E6=8F=92=E4=BB=B6=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E6=97=B6=EF=BC=8Calphafine=E6=90=9C=E7=B4=A2=E6=A1=86?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/DesignerFrame.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index 61113b593..91f9c12fb 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -200,9 +200,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } }); refreshNorthEastPane(northEastPane, ad); - if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { - northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); - } return northEastPane; } @@ -214,6 +211,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta processor = new DefaultTitlePlace(); } processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane()); + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { + northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); + } } public DesignerFrame(ToolBarMenuDock ad) {