From 160acaec730b3ae1fbda0f9146239b5255d808de Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Mon, 5 Jun 2017 10:08:25 +0800 Subject: [PATCH] =?UTF-8?q?bug=20fix=20=E8=AE=BE=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineDialog.java | 7 +++++++ .../search/manager/ActionSearchManager.java | 6 ++---- .../mainframe/toolbar/UpdateActionModel.java | 19 ++++++++++++++++++- 3 files changed, 27 insertions(+), 5 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 71d46deb1..7eb3d1d7e 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -231,6 +231,13 @@ public class AlphaFineDialog extends UIDialog { searchResultList.repaint(); validate(); repaint(); + /** + * 默认选中第1项,第0项为title + */ + if (searchResultList.getModel().getSize() > 0) { + searchResultList.setSelectedIndex(1); + } + } } catch (InterruptedException e) { FRLogger.getLogger().error(e.getMessage()); diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index 04b631652..232d14000 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -38,10 +38,8 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); for (UpdateActionModel updateActionModel : updateActions) { - if (updateActionModel.getActionName() != null) { - StringBuffer buffer = new StringBuffer(); - buffer.append(updateActionModel.getActionName()).append(updateActionModel.getParentName()).append(updateActionModel.getSearchKey()); - if (buffer.toString().toLowerCase().contains(searchText.toLowerCase()) ) { + if (updateActionModel.getActionName() != null && updateActionModel.getParentName() != null) { + if (updateActionModel.getSearchKey().toLowerCase().contains(searchText.toLowerCase()) ) { filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction())); } } diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java index 4884f0f95..fb1fdc1ee 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe.toolbar; import com.fr.design.actions.UpdateAction; +import com.fr.stable.pinyin.PinyinFormat; +import com.fr.stable.pinyin.PinyinHelper; /** * Created by XiaXiang on 2017/5/24. @@ -10,6 +12,7 @@ import com.fr.design.actions.UpdateAction; * action对象 */ public class UpdateActionModel { + private static final String SEPARATOR = "/"; private String parentName; private String actionName; private String relatedKey; @@ -20,7 +23,21 @@ public class UpdateActionModel { this.parentName = parentName; this.action = action; this.actionName = action.getName(); - this.searchKey = action.getSearchText(); + setSearchKey(parentName, action); + } + + /** + * 获取搜索关键字,包括上级菜单名,菜单名,以及对应打开面板的所有文字信息(使其能够支持模糊搜索) + * @param parentName + * @param action + */ + private void setSearchKey(String parentName, UpdateAction action) { + StringBuffer buffer = new StringBuffer(); + buffer.append(parentName).append(PinyinHelper.convertToPinyinString(parentName, SEPARATOR, PinyinFormat.WITHOUT_TONE)) + .append(PinyinHelper.getShortPinyin(parentName)) + .append(actionName).append(PinyinHelper.convertToPinyinString(actionName, SEPARATOR, PinyinFormat.WITHOUT_TONE)) + .append(PinyinHelper.getShortPinyin(actionName)).append(action.getSearchText()); + this.searchKey = buffer.toString(); } /**