|
|
@ -7,17 +7,16 @@ import com.fr.data.impl.storeproc.StoreProcedure; |
|
|
|
import com.fr.data.operator.DataOperator; |
|
|
|
import com.fr.data.operator.DataOperator; |
|
|
|
import com.fr.design.data.DesignTableDataManager; |
|
|
|
import com.fr.design.data.DesignTableDataManager; |
|
|
|
import com.fr.design.data.datapane.preview.PreviewTablePane; |
|
|
|
import com.fr.design.data.datapane.preview.PreviewTablePane; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
|
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
|
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.gui.iprogressbar.AutoProgressBar; |
|
|
|
import com.fr.design.gui.iprogressbar.AutoProgressBar; |
|
|
|
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; |
|
|
|
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; |
|
|
|
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.JOptionPane; |
|
|
|
import javax.swing.JFrame; |
|
|
|
import javax.swing.SwingWorker; |
|
|
|
import javax.swing.SwingWorker; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
@ -50,7 +49,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { |
|
|
|
private AutoProgressBar connectionBar; |
|
|
|
private AutoProgressBar connectionBar; |
|
|
|
private ProcedureDataModel[] dataModels; |
|
|
|
private ProcedureDataModel[] dataModels; |
|
|
|
private SwingWorker worker; |
|
|
|
private SwingWorker worker; |
|
|
|
private BasicDialog dialog; |
|
|
|
|
|
|
|
private int previewModel; |
|
|
|
private int previewModel; |
|
|
|
|
|
|
|
|
|
|
|
public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) { |
|
|
|
public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) { |
|
|
@ -71,19 +69,8 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { |
|
|
|
if (needLoad) { |
|
|
|
if (needLoad) { |
|
|
|
setWorker(); |
|
|
|
setWorker(); |
|
|
|
} |
|
|
|
} |
|
|
|
dialog = PreviewTablePane.getInstance().getDialog(); |
|
|
|
loadingBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { |
|
|
|
dialog.addDialogActionListener(new DialogActionAdapter() { |
|
|
|
|
|
|
|
public void doOk() { |
|
|
|
|
|
|
|
getWorker().cancel(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void doCancel() { |
|
|
|
|
|
|
|
getWorker().cancel(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
loadingBar = new AutoProgressBar(dialog, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { |
|
|
|
|
|
|
|
public void doMonitorCanceled() { |
|
|
|
public void doMonitorCanceled() { |
|
|
|
getDialog().setVisible(false); |
|
|
|
|
|
|
|
getWorker().cancel(true); |
|
|
|
getWorker().cancel(true); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -103,7 +90,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { |
|
|
|
return columnNameList; |
|
|
|
return columnNameList; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!createStore(false)) { |
|
|
|
if (!createStore(false)) { |
|
|
|
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData")); |
|
|
|
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData")); |
|
|
|
return new ArrayList<String>(); |
|
|
|
return new ArrayList<String>(); |
|
|
|
} |
|
|
|
} |
|
|
|
columnNameList = Arrays.asList(procedureDataModel.getColumnName()); |
|
|
|
columnNameList = Arrays.asList(procedureDataModel.getColumnName()); |
|
|
@ -169,16 +156,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void previewData(final int previewModel) { |
|
|
|
public void previewData(final int previewModel) { |
|
|
|
this.previewModel = previewModel; |
|
|
|
this.previewModel = previewModel; |
|
|
|
new SwingWorker() { |
|
|
|
connectionBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) { |
|
|
|
|
|
|
|
|
|
|
|
protected Object doInBackground() throws Exception { |
|
|
|
|
|
|
|
loadingBar.close(); |
|
|
|
|
|
|
|
PreviewTablePane.resetPreviewTable(); |
|
|
|
|
|
|
|
dialog.setVisible(true); |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}.execute(); |
|
|
|
|
|
|
|
connectionBar = new AutoProgressBar(dialog, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) { |
|
|
|
|
|
|
|
public void doMonitorCanceled() { |
|
|
|
public void doMonitorCanceled() { |
|
|
|
connectionBar.close(); |
|
|
|
connectionBar.close(); |
|
|
|
worker.cancel(true); |
|
|
|
worker.cancel(true); |
|
|
@ -190,13 +168,13 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { |
|
|
|
private void setWorker() { |
|
|
|
private void setWorker() { |
|
|
|
worker = new SwingWorker<Void, Void>() { |
|
|
|
worker = new SwingWorker<Void, Void>() { |
|
|
|
protected Void doInBackground() throws Exception { |
|
|
|
protected Void doInBackground() throws Exception { |
|
|
|
|
|
|
|
loadingBar.close(); |
|
|
|
|
|
|
|
PreviewTablePane.resetPreviewTable(); |
|
|
|
connectionBar.start(); |
|
|
|
connectionBar.start(); |
|
|
|
boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection()); |
|
|
|
boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection()); |
|
|
|
if (!status) { |
|
|
|
if (!status) { |
|
|
|
connectionBar.close(); |
|
|
|
connectionBar.close(); |
|
|
|
// bug 61345 预览失败时,关闭窗口
|
|
|
|
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); |
|
|
|
dialog.setVisible(false); |
|
|
|
|
|
|
|
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
connectionBar.close(); |
|
|
|
connectionBar.close(); |
|
|
|
storeProcedure.resetDataModelList(); |
|
|
|
storeProcedure.resetDataModelList(); |
|
|
@ -208,7 +186,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { |
|
|
|
try { |
|
|
|
try { |
|
|
|
get(); |
|
|
|
get(); |
|
|
|
loadingBar.close(); |
|
|
|
loadingBar.close(); |
|
|
|
dialog.setVisible(false); |
|
|
|
|
|
|
|
switch (previewModel) { |
|
|
|
switch (previewModel) { |
|
|
|
case StoreProcedureDataWrapper.PREVIEW_ALL: |
|
|
|
case StoreProcedureDataWrapper.PREVIEW_ALL: |
|
|
|
PreviewTablePane.previewStoreDataWithAllDs(dataModels); |
|
|
|
PreviewTablePane.previewStoreDataWithAllDs(dataModels); |
|
|
@ -228,10 +205,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private BasicDialog getDialog() { |
|
|
|
|
|
|
|
return this.dialog; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SwingWorker getWorker() { |
|
|
|
private SwingWorker getWorker() { |
|
|
|
return this.worker; |
|
|
|
return this.worker; |
|
|
|
} |
|
|
|
} |
|
|
|