Browse Source

Pull request #8413: REPORT-69108 【迭代】【数据集管理优化】搜索过程中更新关键字,概率卡死

Merge in DESIGN/design from ~YVAN/design:feature/x to feature/x

* commit '6ff7fc5acd22958ce8d1016372464bde17027d8c':
  REPORT-69108 【迭代】【数据集管理优化】搜索过程中更新关键字,概率卡死 【问题原因】为输入框add的keyListener比remove的次数多,所以会累积性的重复添加监听,导致多次搜索后会多次触发,直到卡死 【改动思路】 1. 修改下remove和add的逻辑,只在初始化输入框时add一次;之前在这里remove那是刚写迭代的时候代码里需要把输入框清空,当时清空后逻辑有问题,所以就add+remove,后面那边清空的逻辑改好了,这里忘改回来了 2. 将计数提前,否则取数失败的任务不会计数 【review建议】无
feature/x
Yvan 3 years ago
parent
commit
1412900fd0
  1. 1
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/TreeSearchCallback.java
  2. 4
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchCallBack.java
  3. 7
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TreeSearchToolbarPane.java
  4. 3
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/searcher/TableDataTreeSearcher.java

1
designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/TreeSearchCallback.java

@ -1,6 +1,5 @@
package com.fr.design.data.datapane.management.search.control; package com.fr.design.data.datapane.management.search.control;
import com.fr.design.data.datapane.management.search.searcher.TreeSearcher;
/** /**
* 搜索任务回调 * 搜索任务回调

4
designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchCallBack.java

@ -24,6 +24,8 @@ public class TableDataSearchCallBack implements TreeSearchCallback {
if (TableDataTreeSearchManager.getInstance().getTreeSearchStatus() != TreeSearchStatus.SEARCHING) { if (TableDataTreeSearchManager.getInstance().getTreeSearchStatus() != TreeSearchStatus.SEARCHING) {
return; return;
} }
// 搜索计数
TableDataTreeSearchManager.getInstance().decreaseCount();
if (treeSearchResult.isSuccess()) { if (treeSearchResult.isSuccess()) {
// 添加结果 // 添加结果
addToTreeSearcher(treeSearchResult); addToTreeSearcher(treeSearchResult);
@ -38,8 +40,6 @@ public class TableDataSearchCallBack implements TreeSearchCallback {
return; return;
} }
TableDataTreeSearchManager.getInstance().updateTableDataTree(); TableDataTreeSearchManager.getInstance().updateTableDataTree();
// 搜索计数
TableDataTreeSearchManager.getInstance().decreaseCount();
}); });
} }

7
designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TreeSearchToolbarPane.java

@ -142,6 +142,7 @@ public class TreeSearchToolbarPane extends Panel implements TreeSearchStatusChan
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
} }
}); });
this.searchTextField.addKeyListener(enterPressed);
// 右侧返回图标 // 右侧返回图标
UILabel returnLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/clear")); UILabel returnLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/clear"));
returnLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Tree_Search_Return")); returnLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Tree_Search_Return"));
@ -178,12 +179,6 @@ public class TreeSearchToolbarPane extends Panel implements TreeSearchStatusChan
* 交换当前面板层级 * 交换当前面板层级
*/ */
public void switchPane(String name) { public void switchPane(String name) {
if (StringUtils.equals(name, TOOLBAR_PANE)) {
searchTextField.removeKeyListener(enterPressed);
searchTextField.setText(StringUtils.EMPTY);
} else if (StringUtils.equals(name, SEARCH_PANE)) {
searchTextField.addKeyListener(enterPressed);
}
cardLayout.show(contentPane, name); cardLayout.show(contentPane, name);
} }

3
designer-base/src/main/java/com/fr/design/data/datapane/management/search/searcher/TableDataTreeSearcher.java

@ -10,8 +10,6 @@ import com.fr.design.data.datapane.management.search.control.pre.TableDataPreSea
import com.fr.design.data.datapane.management.search.control.pre.TableDataPreSearchTask; import com.fr.design.data.datapane.management.search.control.pre.TableDataPreSearchTask;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -19,7 +17,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.function.Consumer;
/** /**
* @author Yvan * @author Yvan

Loading…
Cancel
Save