Browse Source

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

zheng-1641779399395
Henry.Wang 3 years ago
parent
commit
bdb220adc5
  1. 25
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  2. 21
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

25
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() {
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<StoreProcedure> imp
this.storeProcedureWorkerListener = null;
}
private StoreProcedure updateBeanWithOutExecute() {
String dbName = connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
@ -266,16 +266,16 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
return sp;
}
@Override
public StoreProcedure updateBean() {
final StoreProcedure sp = updateBeanWithOutExecute();
if (updateWorker != null) {
updateWorker.cancel(true);
}
updateWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
@ -284,7 +284,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
sp.refreshDataModelListAndResultNames(dataModels);
return null;
}
@Override
public void done() {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
@ -293,7 +293,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
fireDSChanged();
}
};
updateWorker.execute();
return sp;
}
@ -359,17 +359,20 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> 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);
}
}

21
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);
}

Loading…
Cancel
Save