Browse Source

Pull request #8382: REPORT-68405 【迭代】【数据集管理优化】显示检索完成了,但是结果为空,实际有结果

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

* commit '915fe860cc643f9f042f65c9f8d338774792f3d0':
  REPORT-68405 【迭代】【数据集管理优化】显示检索完成了,但是结果为空,实际有结果 【问题原因】1.状态跳转时,结果集被重置了,所以显示无结果;2.之前没搞明白的count减到0过快的原因搞清楚了,是因为预加载任务回调忘了重写done方法了 【改动思路】1.将重置放到搜索开始前;2.预加载任务回调处理;3.部分代码质量问题 【review建议】无
feature/x
Yvan 3 years ago
parent
commit
d154e26956
  1. 13
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java
  2. 4
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchCallBack.java
  3. 6
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/pre/TableDataPreSearchCallBack.java
  4. 10
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/searcher/TableDataTreeSearcher.java
  5. 4
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/searcher/TreeSearchStatus.java

13
designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java

@ -136,7 +136,7 @@ public class TableDataTreeSearchManager {
} }
setTreeSearchStatus(TreeSearchStatus.SEARCHING); setTreeSearchStatus(TreeSearchStatus.SEARCHING);
rendererHelper.replaceTreeRenderer(getCurrentTableDataTree(), searchText); rendererHelper.replaceTreeRenderer(getCurrentTableDataTree(), searchText);
count = new AtomicInteger(treeSearcher.getNotCalculatedSetsSize()); count = new AtomicInteger(treeSearcher.getAllWrappersSize());
// 计时开始 // 计时开始
TableDataSearchTimer.getInstance().startClock(); TableDataSearchTimer.getInstance().startClock();
treeSearcher.startSearch(searchText); treeSearcher.startSearch(searchText);
@ -192,17 +192,24 @@ public class TableDataTreeSearchManager {
} }
/** /**
* 切换回工具栏 * 切换回工具栏恢复数据集树UI
*/ */
public void restoreToolBarAndTreePane() { public void restoreToolBarAndTreePane() {
setTreeSearchStatus(TreeSearchStatus.NOT_IN_SEARCH_MODE); setTreeSearchStatus(TreeSearchStatus.NOT_IN_SEARCH_MODE);
if (treeSearcher != null) { if (treeSearcher != null) {
treeSearcher.afterSearch(); treeSearcher.afterSearch();
} }
restoreTreePane(); lastSearchText = null;
if (rendererHelper != null) {
rendererHelper.restore(getCurrentTableDataTree());
}
} }
/**
* 恢复数据集树UI
*/
public void restoreTreePane() { public void restoreTreePane() {
setTreeSearchStatus(TreeSearchStatus.SEARCH_NOT_BEGIN);
lastSearchText = null; lastSearchText = null;
if (rendererHelper != null) { if (rendererHelper != null) {
rendererHelper.restore(getCurrentTableDataTree()); rendererHelper.restore(getCurrentTableDataTree());

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

@ -38,8 +38,8 @@ public class TableDataSearchCallBack implements TreeSearchCallback {
return; return;
} }
TableDataTreeSearchManager.getInstance().updateTableDataTree(); TableDataTreeSearchManager.getInstance().updateTableDataTree();
// todo 没想清楚为啥会这么快结束,暂时取消搜索计数 // 搜索计数
// TableDataTreeSearchManager.getInstance().decreaseCount(); TableDataTreeSearchManager.getInstance().decreaseCount();
}); });
} }

6
designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/pre/TableDataPreSearchCallBack.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.management.search.control.pre; package com.fr.design.data.datapane.management.search.control.pre;
import com.fr.design.data.datapane.management.search.control.TreeSearchResult;
import com.fr.design.data.datapane.management.search.control.common.TableDataSearchCallBack; import com.fr.design.data.datapane.management.search.control.common.TableDataSearchCallBack;
import com.fr.design.data.datapane.management.search.searcher.TableDataTreeSearcher; import com.fr.design.data.datapane.management.search.searcher.TableDataTreeSearcher;
@ -14,4 +15,9 @@ public class TableDataPreSearchCallBack extends TableDataSearchCallBack {
public TableDataPreSearchCallBack(TableDataTreeSearcher treeSearcher) { public TableDataPreSearchCallBack(TableDataTreeSearcher treeSearcher) {
super(treeSearcher); super(treeSearcher);
} }
@Override
public void done(TreeSearchResult treeSearchResult) {
// do nothing
}
} }

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

@ -45,8 +45,8 @@ public class TableDataTreeSearcher implements TreeSearcher {
return matchSets.isEmpty(); return matchSets.isEmpty();
} }
public int getNotCalculatedSetsSize() { public int getAllWrappersSize() {
return notCalculatedSets.size(); return allWrappers.size();
} }
public synchronized void addToCalculatedSets(List<String> tableDataNames) { public synchronized void addToCalculatedSets(List<String> tableDataNames) {
@ -55,7 +55,6 @@ public class TableDataTreeSearcher implements TreeSearcher {
if (tableDataWrapper == null) { if (tableDataWrapper == null) {
return; return;
} }
notCalculatedSets.remove(tableDataName);
calculatedSets.add(tableDataName); calculatedSets.add(tableDataName);
} }
} }
@ -111,6 +110,7 @@ public class TableDataTreeSearcher implements TreeSearcher {
@Override @Override
public void startSearch(String searchText) { public void startSearch(String searchText) {
reset();
for (String notCalculatedSet : notCalculatedSets) { for (String notCalculatedSet : notCalculatedSets) {
TableDataWrapper tableDataWrapper = allWrappers.get(notCalculatedSet); TableDataWrapper tableDataWrapper = allWrappers.get(notCalculatedSet);
if (TableDataTreeSearchManager.getInstance().getTreeSearchStatus() == TreeSearchStatus.SEARCHING) { if (TableDataTreeSearchManager.getInstance().getTreeSearchStatus() == TreeSearchStatus.SEARCHING) {
@ -121,12 +121,12 @@ public class TableDataTreeSearcher implements TreeSearcher {
@Override @Override
public void stopSearch() { public void stopSearch() {
reset();
} }
@Override @Override
public void completeSearch() { public void completeSearch() {
reset();
} }
private void reset() { private void reset() {

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

@ -5,8 +5,10 @@ package com.fr.design.data.datapane.management.search.searcher;
*/ */
public enum TreeSearchStatus { public enum TreeSearchStatus {
/**
* 非搜索模式
*/
NOT_IN_SEARCH_MODE, NOT_IN_SEARCH_MODE,
/** /**
* 搜索未开始 * 搜索未开始
*/ */

Loading…
Cancel
Save