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); } /** 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) {