Browse Source

REPORT-14569 10.0release的alphafine显示问题

定位到是多线程的bug,某些情况下list里放入了之前的线程搜索的结果。目前策略是各线程各自维护一个列表,获取结果后再赋给全局变量
bugfix/10.0
alex.sung 6 years ago
parent
commit
b2b2b66e51
  1. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  2. 68
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  3. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java

6
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -104,8 +104,10 @@ public class AlphaFineHelper {
List<AlphaCellModel> recentList = RecentSearchManager.getInstance().getRecentModelList(); List<AlphaCellModel> recentList = RecentSearchManager.getInstance().getRecentModelList();
List<AlphaCellModel> recommendList = RecommendSearchManager.getInstance().getRecommendModelList(); List<AlphaCellModel> recommendList = RecommendSearchManager.getInstance().getRecommendModelList();
SearchResult filterResult = new SearchResult(); SearchResult filterResult = new SearchResult();
filterResult.addAll(recentList); if(recentList != null && recommendList != null){
filterResult.addAll(recommendList); filterResult.addAll(recentList);
filterResult.addAll(recommendList);
}
return filterResult; return filterResult;
} }

68
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -489,21 +489,24 @@ public class AlphaFineDialog extends UIDialog {
* @param searchText * @param searchText
*/ */
private void dealWithSearchText(String searchText) { private void dealWithSearchText(String searchText) {
SearchListModel searchListModelTemp = new SearchListModel(new SearchResult());
searchResultList.setModel(searchListModelTemp);
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) { if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) {
buildActionList(new String[]{getStoreText(searchText)}); buildActionList(new String[]{getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { } else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) {
buildDocumentList(new String[]{getStoreText(searchText)}); buildDocumentList(new String[]{getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) { } else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) {
buildFileList(getStoreText(searchText), new String[]{getStoreText(searchText)}); buildFileList(getStoreText(searchText), new String[]{getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) { } else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) {
buildFileList(getStoreText(searchText), new String[]{searchText}); buildFileList(getStoreText(searchText), new String[]{searchText}, searchListModelTemp);
} else if (searchText.startsWith(DS_MARK)) { } else if (searchText.startsWith(DS_MARK)) {
buildFileList(getStoreText(searchText), new String[]{DS_NAME + getStoreText(searchText)}); buildFileList(getStoreText(searchText), new String[]{DS_NAME + getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { } else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) {
buildPluginList(new String[]{getStoreText(searchText)}); buildPluginList(new String[]{getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(SIMILAR_MARK)) { } else if (searchText.startsWith(SIMILAR_MARK)) {
buildSimilarList(new String[]{getStoreText(searchText)}); buildSimilarList(new String[]{getStoreText(searchText)}, searchListModelTemp);
} }
searchListModel = searchListModelTemp;
} }
/** /**
@ -535,51 +538,54 @@ public class AlphaFineDialog extends UIDialog {
* @param searchText * @param searchText
*/ */
private void doNormalSearch(String searchText) { private void doNormalSearch(String searchText) {
SearchListModel searchListModelTemp = new SearchListModel(new SearchResult());
searchResultList.setModel(searchListModelTemp);
if (segmentationResult != null) { if (segmentationResult != null) {
buildRecentList(segmentationResult); buildRecentList(segmentationResult, searchListModelTemp);
buildRecommendList(segmentationResult); buildRecommendList(segmentationResult, searchListModelTemp);
buildActionList(segmentationResult); buildActionList(segmentationResult, searchListModelTemp);
buildFileList(searchText, segmentationResult); buildFileList(searchText, segmentationResult, searchListModelTemp);
buildDocumentList(segmentationResult); buildDocumentList(segmentationResult, searchListModelTemp);
buildPluginList(segmentationResult); buildPluginList(segmentationResult, searchListModelTemp);
buildSimilarList(segmentationResult); buildSimilarList(segmentationResult, searchListModelTemp);
} }
searchListModel.addElement(new BottomModel()); searchListModelTemp.addElement(new BottomModel());
searchListModel = searchListModelTemp;
} }
private void buildDocumentList(final String[] searchText) { private void buildDocumentList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildFileList(String searchStr, final String[] searchText) { private void buildFileList(String searchStr, final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(FileSearchManager.getInstance().getLessSearchResult(searchStr, searchText)); addSearchResult(FileSearchManager.getInstance().getLessSearchResult(searchStr, searchText), searchListModelTemp);
} }
private void buildActionList(final String[] searchText) { private void buildActionList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildPluginList(final String[] searchText) { private void buildPluginList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildRecommendList(final String[] searchText) { private void buildRecommendList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildRecentList(final String[] searchText) { private void buildRecentList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildSimilarList(final String[] searchText) { private void buildSimilarList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(SimilarSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(SimilarSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private synchronized void addSearchResult(SearchResult searchResult) { private synchronized void addSearchResult(SearchResult searchResult, SearchListModel searchListModelTemp) {
for (AlphaCellModel object : searchResult) { for (AlphaCellModel object : searchResult) {
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModelTemp.addElement(object);
} }
} }

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java

@ -187,9 +187,11 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
public List<AlphaCellModel> getRecommendModelList() { public List<AlphaCellModel> getRecommendModelList() {
SearchResult result = new SearchResult(); SearchResult result = new SearchResult();
result.addAll(recommendModelList); if(recommendModelList != null){
result.addAll(modelList); result.addAll(recommendModelList);
result.addAll(moreModelList); result.addAll(modelList);
result.addAll(moreModelList);
}
return result; return result;
} }

Loading…
Cancel
Save