From bdb220adc5cba2be71d6e77b24a44329ffba3cde Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 20 Jul 2021 16:50:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-55428=20=E8=AE=BE=E8=AE=A1=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF-=E9=A2=84=E8=A7=88=E5=8A=A0=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=BE=83=E9=95=BF=E7=9A=84=E5=AD=98=E5=82=A8=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E6=97=B6=EF=BC=8C=E5=8A=A0=E8=BD=BD=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E4=BD=8D=E7=BD=AE=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/ProcedureDataPane.java | 25 +++++++++++-------- .../wrapper/StoreProcedureDataWrapper.java | 21 ++++++++++++++-- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index d0bc499a2..f1d2433db 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -158,7 +158,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp private JToolBar creatToolBar() { ToolBarDef toolBarDef = new ToolBarDef(); - toolBarDef.addShortCut(new PreviewAction()); + toolBarDef.addShortCut(new PreviewAction(this)); toolBarDef.addShortCut(new RefreshAction()); toolBarDef.addShortCut(SeparatorDef.DEFAULT); isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); @@ -243,7 +243,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp this.storeProcedureWorkerListener = null; } - + private StoreProcedure updateBeanWithOutExecute() { String dbName = connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); @@ -266,16 +266,16 @@ public class ProcedureDataPane extends AbstractTableDataPane imp return sp; } - + @Override public StoreProcedure updateBean() { - + final StoreProcedure sp = updateBeanWithOutExecute(); if (updateWorker != null) { updateWorker.cancel(true); } updateWorker = new SwingWorker() { - + @Override protected Void doInBackground() throws Exception { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); @@ -284,7 +284,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp sp.refreshDataModelListAndResultNames(dataModels); return null; } - + @Override public void done() { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); @@ -293,7 +293,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp fireDSChanged(); } }; - + updateWorker.execute(); return sp; } @@ -359,17 +359,20 @@ public class ProcedureDataPane extends AbstractTableDataPane imp } private class PreviewAction extends UpdateAction { - public PreviewAction() { + ProcedureDataPane procedureDataPane; + + public PreviewAction(ProcedureDataPane procedureDataPane) { this.setName(PREVIEW_BUTTON); this.setMnemonic('P'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); + this.procedureDataPane = procedureDataPane; } @Override public void actionPerformed(ActionEvent evt) { - StoreProcedure sp = updateBeanWithOutExecute(); - StoreProcedureDataWrapper storeProcedureDataWrappe = new StoreProcedureDataWrapper(sp, StringUtils.EMPTY, queryText.getText()); - storeProcedureDataWrappe.previewData(StoreProcedureDataWrapper.PREVIEW_ALL); + StoreProcedure sp = updateBeanWithOutExecute(); + StoreProcedureDataWrapper storeProcedureDataWrapper = new StoreProcedureDataWrapper(this.procedureDataPane, sp, StringUtils.EMPTY, queryText.getText()); + storeProcedureDataWrapper.previewData(StoreProcedureDataWrapper.PREVIEW_ALL); } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java index 17fbf5788..f03a17c3f 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java @@ -18,6 +18,7 @@ import com.fr.log.FineLoggerFactory; import javax.swing.Icon; import javax.swing.JFrame; import javax.swing.SwingWorker; +import java.awt.Component; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -52,7 +53,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { private int previewModel; public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) { - this(storeProcedure, storeprocedureName, dsName, true); + this(null, storeProcedure, storeprocedureName, dsName, true); } @@ -62,6 +63,19 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { * @param storeprocedureName 存储过程的名字(某些情况下可以为空) */ public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { + this(null, storeProcedure, storeprocedureName, dsName, needLoad); + } + + public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName) { + this(component, storeProcedure, storeprocedureName, dsName, true); + } + + /** + * @param dsName 存储过程一个返回数据集的名字 + * @param storeProcedure 存储过程 + * @param storeprocedureName 存储过程的名字(某些情况下可以为空) + */ + public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { this.dsName = dsName; this.storeProcedure = storeProcedure; this.storeProcedure.setCalculating(false); @@ -69,7 +83,10 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { if (needLoad) { setWorker(); } - loadingBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { + if (component == null) { + component = new JFrame(); + } + loadingBar = new AutoProgressBar(component, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { public void doMonitorCanceled() { getWorker().cancel(true); } From 1a11b638bede58a7cab0641fb3d2903b519ba1eb Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 20 Jul 2021 16:56:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-55428=20=E8=AE=BE=E8=AE=A1=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF-=E9=A2=84=E8=A7=88=E5=8A=A0=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=BE=83=E9=95=BF=E7=9A=84=E5=AD=98=E5=82=A8=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E6=97=B6=EF=BC=8C=E5=8A=A0=E8=BD=BD=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E4=BD=8D=E7=BD=AE=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wrapper/StoreProcedureDataWrapper.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java index f03a17c3f..08274fd71 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java @@ -56,12 +56,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { this(null, storeProcedure, storeprocedureName, dsName, true); } - - /** - * @param dsName 存储过程一个返回数据集的名字 - * @param storeProcedure 存储过程 - * @param storeprocedureName 存储过程的名字(某些情况下可以为空) - */ public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { this(null, storeProcedure, storeprocedureName, dsName, needLoad); } @@ -69,12 +63,14 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName) { this(component, storeProcedure, storeprocedureName, dsName, true); } - + /** - * @param dsName 存储过程一个返回数据集的名字 - * @param storeProcedure 存储过程 - * @param storeprocedureName 存储过程的名字(某些情况下可以为空) - */ + * @param: component loadingBar的父弹框(如果不设置父弹框的话,可能出现loadingBar隐藏在一个弹框后的情况) + * @param: storeProcedure 存储过程 + * @param: storeprocedureName 存储过程的名字(某些情况下可以为空) + * @param: dsName 存储过程一个返回数据集的名字 + * @param: needLoad 是否要加载 + **/ public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { this.dsName = dsName; this.storeProcedure = storeProcedure;