Browse Source

Merge pull request #938 in BA/design from ~XIAOXIA/design:9.0 to 9.0

* commit '842f691442c61e472ad7e5327ab35031a8e3cd39':
  bug fix遍历问题
  bug fix
  bug fix
  reformat
  bug fix 去重
  alphafine 猜您喜欢和本地常用去重
master
superman 8 years ago
parent
commit
d2de164e77
  1. 2
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  2. 22
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  3. 11
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java

2
designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java

@ -41,7 +41,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
public static ActionModel getModelFromCloud(String actionName) { public static ActionModel getModelFromCloud(String actionName) {
List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) { for (UpdateActionModel updateActionModel : updateActions) {
if (ComparatorUtils.equals(actionName, updateActionModel.getClassName()) && updateActionModel.getAction().isEnabled()) { if (ComparatorUtils.equals(actionName, updateActionModel.getClassName())) {
return new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction()); return new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction());
} }
} }

22
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -4,7 +4,9 @@ import com.fr.base.FRContext;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
@ -25,10 +27,7 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* Created by XiaXiang on 2017/5/15. * Created by XiaXiang on 2017/5/15.
@ -223,11 +222,20 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
if (ComparatorUtils.equals(key, searchText)) { if (ComparatorUtils.equals(key, searchText)) {
recentModelList = recentKVModelMap.get(searchText); recentModelList = recentKVModelMap.get(searchText);
int size = recentModelList.size(); List<AlphaCellModel> resultModelList = new ArrayList<>(recentModelList);
Iterator<AlphaCellModel> modelIterator = resultModelList.iterator();
while (modelIterator.hasNext()) {
AlphaCellModel model = modelIterator.next();
if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) {
modelIterator.remove();
}
}
int size = resultModelList.size();
if (size > MAX_SIZE) { if (size > MAX_SIZE) {
return recentModelList.subList(size - MAX_SIZE, size); return resultModelList.subList(size - MAX_SIZE, size);
} }
return recentModelList; return resultModelList;
} }
} }
return recentModelList; return recentModelList;

11
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java

@ -2,7 +2,9 @@ package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
@ -15,6 +17,7 @@ import com.fr.json.JSONObject;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
@ -66,6 +69,14 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error("recommend search error! :" + e.getMessage()); FRLogger.getLogger().error("recommend search error! :" + e.getMessage());
} }
Iterator<AlphaCellModel> modelIterator = recommendModelList.iterator();
while (modelIterator.hasNext()) {
AlphaCellModel model = modelIterator.next();
if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) {
modelIterator.remove();
}
}
if (recommendModelList.size() > 0) { if (recommendModelList.size() > 0) {
modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false)); modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false));
modelList.addAll(recommendModelList); modelList.addAll(recommendModelList);

Loading…
Cancel
Save