diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java index 1a6a62747..6fe79189c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java @@ -1,7 +1,6 @@ package com.fr.design.data.datapane.management.search; import com.fr.data.TableDataSource; -import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.DesignModelAdapter; import com.fr.design.data.datapane.TableDataTree; import com.fr.design.data.datapane.TableDataTreePane; @@ -10,11 +9,7 @@ import com.fr.design.data.datapane.management.search.event.TreeSearchStatusChang import com.fr.design.data.datapane.management.search.searcher.TableDataSearchMode; import com.fr.design.data.datapane.management.search.searcher.TableDataTreeSearcher; import com.fr.design.data.datapane.management.search.searcher.TreeSearchStatus; -import com.fr.design.data.datapane.management.search.time.TableDataSearchTimer; import com.fr.design.data.datapane.management.search.view.TreeSearchRendererHelper; -import com.fr.design.data.tabledata.wrapper.TableDataWrapper; -import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; -import com.fr.general.NameObject; import com.fr.stable.StringUtils; import javax.swing.SwingUtilities; @@ -137,8 +132,6 @@ public class TableDataTreeSearchManager { setTreeSearchStatus(TreeSearchStatus.SEARCHING); rendererHelper.replaceTreeRenderer(getCurrentTableDataTree(), searchText); count = new AtomicInteger(treeSearcher.getAllWrappersSize()); - // 计时开始 - TableDataSearchTimer.getInstance().startClock(); treeSearcher.startSearch(searchText); } @@ -176,7 +169,6 @@ public class TableDataTreeSearchManager { */ public void stopSearch() { setTreeSearchStatus(TreeSearchStatus.SEARCH_STOPPED); - TableDataSearchTimer.getInstance().stopClock(); count = null; treeSearcher.stopSearch(); } @@ -186,7 +178,6 @@ public class TableDataTreeSearchManager { */ public void completeSearch() { setTreeSearchStatus(TreeSearchStatus.SEARCH_COMPLETED); - TableDataSearchTimer.getInstance().stopClock(); count = null; treeSearcher.completeSearch(); } @@ -196,7 +187,6 @@ public class TableDataTreeSearchManager { */ public void restoreToolBarAndTreePane() { setTreeSearchStatus(TreeSearchStatus.NOT_IN_SEARCH_MODE); - TableDataSearchTimer.getInstance().stopClock(); if (treeSearcher != null) { treeSearcher.afterSearch(); } @@ -211,7 +201,6 @@ public class TableDataTreeSearchManager { */ public void restoreTreePane() { setTreeSearchStatus(TreeSearchStatus.SEARCH_NOT_BEGIN); - TableDataSearchTimer.getInstance().stopClock(); lastSearchText = null; if (rendererHelper != null) { rendererHelper.restore(getCurrentTableDataTree()); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchTask.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchTask.java index ded7b27fd..2ab51f6a2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchTask.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchTask.java @@ -1,10 +1,8 @@ package com.fr.design.data.datapane.management.search.control.common; -import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; import com.fr.design.data.datapane.management.search.control.TreeSearchCallback; import com.fr.design.data.datapane.management.search.control.TreeSearchResult; import com.fr.design.data.datapane.management.search.control.TreeSearchTask; -import com.fr.design.data.datapane.management.search.searcher.TreeSearchStatus; import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.log.FineLoggerFactory; @@ -70,6 +68,10 @@ public class TableDataSearchTask implements TreeSearchTask { String tableDataName = tableDataWrapper.getTableDataName(); boolean isTableDataNameMatch = isMatchSearch(tableDataName, searchText); List columnNameList = tableDataWrapper.calculateColumnNameList(); + // 没取到列名的话,代表取数那边出错了,就不添加数据集了 + if (columnNameList.size() == 0) { + return new TableDataSearchResult.Builder().buildSuccess(false).build(); + } boolean isColumnMatch = columnNameList.stream().anyMatch(columnName -> isMatchSearch(columnName, searchText)); return new TableDataSearchResult.Builder() .buildSuccess(true) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimer.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimer.java deleted file mode 100644 index 63f041359..000000000 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fr.design.data.datapane.management.search.time; - -import com.fr.concurrent.NamedThreadFactory; -import com.fr.general.ComparatorUtils; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -/** - * 搜索任务定时器 - * - * @author Yvan - */ -public class TableDataSearchTimer { - - /** - * 定时器 - */ - private static ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(TableDataSearchTimer.class)); - - /** - * 定时任务 - */ - private TableDataSearchTimerTask timeTask; - - /** - * 最大单次startSearch的时间 - */ - public static final long MAX_SEARCH_TIME = 5000; - - private TableDataSearchTimer() { - } - - private static class Holder { - private static final TableDataSearchTimer INSTANCE = new TableDataSearchTimer(); - } - - public static TableDataSearchTimer getInstance() { - return Holder.INSTANCE; - } - - public void startClock() { - this.timeTask = new TableDataSearchTimerTask(); - scheduler.schedule(timeTask, MAX_SEARCH_TIME, TimeUnit.MILLISECONDS); - } - - public void stopClock() { - this.timeTask = null; - } - - public void shutdown() { - scheduler.shutdown(); - } - - /** - * 判断是不是当前的Timer中的task,为了避免shutdownNow()之后原task仍在执行,可能会 - * @param task - * @return - */ - public boolean isCurrentTask(TableDataSearchTimerTask task) { - return ComparatorUtils.equals(this.timeTask, task); - } -} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimerTask.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimerTask.java deleted file mode 100644 index 27b074f7e..000000000 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimerTask.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.design.data.datapane.management.search.time; - -import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; -import com.fr.design.data.datapane.management.search.searcher.TreeSearchStatus; - -/** - * @author Yvan - */ -public class TableDataSearchTimerTask implements Runnable { - - public TableDataSearchTimerTask() { - } - - @Override - public void run() { - // 最大单次搜索时间过后,将结束搜索 - if (TableDataTreeSearchManager.getInstance().getTreeSearchStatus() == TreeSearchStatus.SEARCHING && - TableDataSearchTimer.getInstance().isCurrentTask(this)) { - TableDataTreeSearchManager.getInstance().completeSearch(); - } - } -}