Browse Source

bug fix 设置的搜索

master
XiaXiang 8 years ago
parent
commit
160acaec73
  1. 7
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 6
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  3. 19
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java

7
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -231,6 +231,13 @@ public class AlphaFineDialog extends UIDialog {
searchResultList.repaint(); searchResultList.repaint();
validate(); validate();
repaint(); repaint();
/**
* 默认选中第1项第0项为title
*/
if (searchResultList.getModel().getSize() > 0) {
searchResultList.setSelectedIndex(1);
}
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());

6
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()) { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) {
List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) { for (UpdateActionModel updateActionModel : updateActions) {
if (updateActionModel.getActionName() != null) { if (updateActionModel.getActionName() != null && updateActionModel.getParentName() != null) {
StringBuffer buffer = new StringBuffer(); if (updateActionModel.getSearchKey().toLowerCase().contains(searchText.toLowerCase()) ) {
buffer.append(updateActionModel.getActionName()).append(updateActionModel.getParentName()).append(updateActionModel.getSearchKey());
if (buffer.toString().toLowerCase().contains(searchText.toLowerCase()) ) {
filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction())); filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction()));
} }
} }

19
designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java

@ -1,6 +1,8 @@
package com.fr.design.mainframe.toolbar; package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction; 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. * Created by XiaXiang on 2017/5/24.
@ -10,6 +12,7 @@ import com.fr.design.actions.UpdateAction;
* action对象 * action对象
*/ */
public class UpdateActionModel { public class UpdateActionModel {
private static final String SEPARATOR = "/";
private String parentName; private String parentName;
private String actionName; private String actionName;
private String relatedKey; private String relatedKey;
@ -20,7 +23,21 @@ public class UpdateActionModel {
this.parentName = parentName; this.parentName = parentName;
this.action = action; this.action = action;
this.actionName = action.getName(); 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();
} }
/** /**

Loading…
Cancel
Save