Browse Source

Pull request #5022: REPORT-55428 设计面板-预览加载时间较长的存储过程时,加载进度界面的位置不对

Merge in DESIGN/design from ~HENRY.WANG/design:release/10.0 to release/10.0

* commit '1a11b638bede58a7cab0641fb3d2903b519ba1eb':
  REPORT-55428 设计面板-预览加载时间较长的存储过程时,加载进度界面的位置不对
  REPORT-55428 设计面板-预览加载时间较长的存储过程时,加载进度界面的位置不对
zheng-1641779399395
Henry.Wang 3 years ago
parent
commit
7cd57e7efb
  1. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  2. 27
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

11
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -158,7 +158,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
private JToolBar creatToolBar() { private JToolBar creatToolBar() {
ToolBarDef toolBarDef = new ToolBarDef(); ToolBarDef toolBarDef = new ToolBarDef();
toolBarDef.addShortCut(new PreviewAction()); toolBarDef.addShortCut(new PreviewAction(this));
toolBarDef.addShortCut(new RefreshAction()); toolBarDef.addShortCut(new RefreshAction());
toolBarDef.addShortCut(SeparatorDef.DEFAULT); toolBarDef.addShortCut(SeparatorDef.DEFAULT);
isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData"));
@ -359,17 +359,20 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
} }
private class PreviewAction extends UpdateAction { private class PreviewAction extends UpdateAction {
public PreviewAction() { ProcedureDataPane procedureDataPane;
public PreviewAction(ProcedureDataPane procedureDataPane) {
this.setName(PREVIEW_BUTTON); this.setName(PREVIEW_BUTTON);
this.setMnemonic('P'); this.setMnemonic('P');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
this.procedureDataPane = procedureDataPane;
} }
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
StoreProcedure sp = updateBeanWithOutExecute(); StoreProcedure sp = updateBeanWithOutExecute();
StoreProcedureDataWrapper storeProcedureDataWrappe = new StoreProcedureDataWrapper(sp, StringUtils.EMPTY, queryText.getText()); StoreProcedureDataWrapper storeProcedureDataWrapper = new StoreProcedureDataWrapper(this.procedureDataPane, sp, StringUtils.EMPTY, queryText.getText());
storeProcedureDataWrappe.previewData(StoreProcedureDataWrapper.PREVIEW_ALL); storeProcedureDataWrapper.previewData(StoreProcedureDataWrapper.PREVIEW_ALL);
} }
} }

27
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.Icon;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.awt.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -52,16 +53,25 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
private int previewModel; private int previewModel;
public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) { public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) {
this(storeProcedure, storeprocedureName, dsName, true); this(null, storeProcedure, storeprocedureName, dsName, true);
} }
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: component loadingBar的父弹框如果不设置父弹框的话可能出现loadingBar隐藏在一个弹框后的情况
* @param storeProcedure 存储过程 * @param: storeProcedure 存储过程
* @param storeprocedureName 存储过程的名字(某些情况下可以为空) * @param: storeprocedureName 存储过程的名字(某些情况下可以为空)
*/ * @param: dsName 存储过程一个返回数据集的名字
public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) { * @param: needLoad 是否要加载
**/
public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) {
this.dsName = dsName; this.dsName = dsName;
this.storeProcedure = storeProcedure; this.storeProcedure = storeProcedure;
this.storeProcedure.setCalculating(false); this.storeProcedure.setCalculating(false);
@ -69,7 +79,10 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
if (needLoad) { if (needLoad) {
setWorker(); 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() { public void doMonitorCanceled() {
getWorker().cancel(true); getWorker().cancel(true);
} }

Loading…
Cancel
Save