From 7a61b9b28d575f739fadd2fa75f792576ae86ce4 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 1 Apr 2022 18:26:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-68727=20=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E9=9B=86=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91=E6=90=9C=E7=B4=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=88=97=E6=9C=AA=E5=8A=A0=E8=BD=BD=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=EF=BC=8C=E8=AF=A5=E6=95=B0=E6=8D=AE=E9=9B=86=E6=9C=AA?= =?UTF-8?q?=E8=A2=AB=E6=90=9C=E7=B4=A2=20=E3=80=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E3=80=91=E6=B5=8B=E8=AF=95=E7=94=A8sleep?= =?UTF-8?q?=E6=9D=A5=E6=A8=A1=E6=8B=9F=E5=8F=96=E6=95=B0=E6=85=A2=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E5=8F=96=E5=88=97=E5=90=8D=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=BC=9A=E9=80=A0=E6=88=90=E4=B8=80=E4=BA=9B=E5=A5=87=E6=80=AA?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=911.=E5=9B=A0=E4=B8=BA=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=88=97=E5=90=8D=E9=87=8C=E5=81=9A=E4=BA=86=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86=EF=BC=8C=E6=89=80=E4=BB=A5=E8=B7=9F?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=B2=9F=E9=80=9A=E5=90=8E=E7=A1=AE=E5=AE=9A?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=B8=BA=E5=88=97=E5=90=8D=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=B0=B1=E4=B8=8D=E5=B1=95=E7=A4=BA=E6=95=B4?= =?UTF-8?q?=E4=B8=AA=E6=95=B0=E6=8D=AE=E9=9B=86=E8=8A=82=E7=82=B9=E4=BA=86?= =?UTF-8?q?=EF=BC=9B2.=E4=BA=A7=E5=93=81=E8=AE=A9=E6=8A=8A=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E6=90=9C=E7=B4=A2=E6=97=B6=E9=97=B4=E7=9A=84=E9=99=90?= =?UTF-8?q?=E5=88=B6=E5=8E=BB=E6=8E=89=20=E3=80=90review=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E3=80=91=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/TableDataTreeSearchManager.java | 11 ---- .../control/common/TableDataSearchTask.java | 6 +- .../search/time/TableDataSearchTimer.java | 64 ------------------- .../search/time/TableDataSearchTimerTask.java | 22 ------- 4 files changed, 4 insertions(+), 99 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimer.java delete mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimerTask.java 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 1a6a627474..6fe79189c8 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 ded7b27fd5..2ab51f6a27 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 63f041359d..0000000000 --- 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 27b074f7e3..0000000000 --- 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(); - } - } -} From 68a134524b80de65cd6b546fd1f9827c90d12b70 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 1 Apr 2022 18:37:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-66457=20=E5=8E=9F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E7=AE=A1=E7=90=86=E4=BC=98=E5=8C=96=20=E3=80=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E8=B7=9F=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E7=A1=AE=E5=AE=9A=E4=BA=86=E5=9C=A8=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E4=B8=AD=E5=81=9A=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E7=9A=84=E7=BC=96=E8=BE=91=E3=80=81=E5=88=A0=E9=99=A4=E3=80=81?= =?UTF-8?q?=E7=B2=98=E8=B4=B4=E6=97=B6=EF=BC=8C=E9=9C=80=E8=A6=81=E4=B8=AD?= =?UTF-8?q?=E6=96=AD=E6=90=9C=E7=B4=A2=EF=BC=8C=E5=B1=95=E7=A4=BA=E5=8E=9F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E6=A0=91=20=E3=80=90=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E7=BC=96=E8=BE=91=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E3=80=81=E7=B2=98=E8=B4=B4=E5=A4=84=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=B7=B3=E5=87=BA=E6=90=9C=E7=B4=A2=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20=E3=80=90review=E5=BB=BA=E8=AE=AE=E3=80=91=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/TableDataTreePane.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index d8f0dbd8ca..06d086aeff 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -385,6 +385,10 @@ public class TableDataTreePane extends BasicTableDataTreePane { */ @Override public void dgEdit(final AbstractTableDataPane tableDataPane, String originalName, boolean isUpdate) { + // 编辑时如果正在搜索,跳回原树 + if (TableDataTreeSearchManager.getInstance().isInSearchMode()) { + TableDataTreeSearchManager.getInstance().outOfSearchMode(); + } tableDataPane.addStoreProcedureWorkerListener(new StoreProcedureWorkerListener() { public void fireDoneAction() { if (tableDataTree.getSelectionPath() == null) { @@ -1031,6 +1035,10 @@ public class TableDataTreePane extends BasicTableDataTreePane { @Override public void doOk() { Object[] selectedValues = checkBoxList.getSelectedValues(); + // 删除时如果正在搜索,跳回原树 + if (TableDataTreeSearchManager.getInstance().isInSearchMode()) { + TableDataTreeSearchManager.getInstance().outOfSearchMode(); + } for (Object toRemove : selectedValues) { doRemove((NameObject) toRemove); } @@ -1092,6 +1100,10 @@ public class TableDataTreePane extends BasicTableDataTreePane { @Override public void actionPerformed(ActionEvent e) { + // 粘贴时如果正在搜索,跳回原树 + if (TableDataTreeSearchManager.getInstance().isInSearchMode()) { + TableDataTreeSearchManager.getInstance().outOfSearchMode(); + } Map dataWrapperMap = TableDataTreeClipboard.getInstance().takeFromClip(); for (Map.Entry dataWrapperEntry : dataWrapperMap.entrySet()) { // 处理数据集名称