From 8c767f7aaaa7e57fa2cee96c3d7028de1d56f05f Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 27 Jun 2017 20:19:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F=20bug=20fi?= =?UTF-8?q?x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineDialog.java | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 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 4f2d9f0cd..7ee184f21 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -295,7 +295,7 @@ public class AlphaFineDialog extends UIDialog { @Override protected void done() { - if (!isCancelled()) { + if (!isCancelled() && getModel().getSize() > 0) { searchResultList.setSelectedIndex(0); showResult(searchResultList.getSelectedValue()); } @@ -311,9 +311,7 @@ public class AlphaFineDialog extends UIDialog { * @param searchText */ private void rebuildList(String searchText) { - searchResultList.resetSelectedIndex(); - searchListModel.removeAllElements(); - searchResultList.resetSelectedIndex(); + resetContainer(); if (searchText.startsWith(ADVANCED_SEARCH_MARK)) { if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) { storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); @@ -341,6 +339,17 @@ public class AlphaFineDialog extends UIDialog { } + /** + * 重置面板 + */ + private void resetContainer() { + searchResultList.resetSelectedIndex(); + searchListModel.removeAllElements(); + rightSearchResultPane.removeAll(); + rightSearchResultPane.validate(); + rightSearchResultPane.repaint(); + } + /** * 普通搜索 * @@ -569,9 +578,7 @@ public class AlphaFineDialog extends UIDialog { } }); } - - - + /** * 窗口拖拽 */ @@ -773,6 +780,11 @@ public class AlphaFineDialog extends UIDialog { this.storeText = storeText; } + + + //------------------------------------------------------ + //----------------------自定义list----------------------- + //------------------------------------------------------ /** * 自定义JList */ @@ -795,7 +807,7 @@ public class AlphaFineDialog extends UIDialog { */ @Override public void setSelectedIndex(int index) { - if (index >= 0 && index <= getModel().getSize()) { + if (index >=0 && checkSelectedIndex(index)) { int previousIndex = getSelectedIndex(); super.setSelectedIndex(index); AlphaCellModel cellModel = getSelectedValue(); @@ -811,6 +823,11 @@ public class AlphaFineDialog extends UIDialog { ensureIndexIsVisible(getSelectedIndex()); } + private boolean checkSelectedIndex(int index) { + int size = getModel().getSize(); + return size > 0 && index < size; + } + private void initListListener() { /** @@ -834,7 +851,7 @@ public class AlphaFineDialog extends UIDialog { public void mouseClicked(MouseEvent e) { int selectedIndex = getSelectedIndex(); AlphaCellModel selectedValue = getSelectedValue(); - if (e.getClickCount() == 2) { + if (e.getClickCount() == 2 && !selectedValue.hasNoResult()) { doNavigate(); saveHistory(selectedValue); } else if (e.getClickCount() == 1) {