📄 importexportdelimitedpanel.java
字号:
} public void setProcessComplete(boolean success) { setButtonsFinished(success); } public void setButtonsFinished(boolean success) { setButtonsEnabled(true); setNextButtonEnabled(false); setBackButtonEnabled(true); setCancelButtonEnabled(true); if (success) { setCancelButtonText("Finish"); } processing = false; } /** <p>Begins an export process. */ public void doExport() { Log.info("Beginning data export process"); processCancelled = false; setNextButtonEnabled(false); setBackButtonEnabled(false); setCancelButtonEnabled(false); worker = new ExportDelimitedWorker(this, progressPanel); } /** <p>Cancels the current in-process transfer */ public void cancelTransfer() { Log.info("Process cancelled"); processCancelled = true; } /** <p>Returns the type of transfer - import or export. * * @return the transfer type - import/export */ public int getTransferType() { return transferType; } /** <p>Returns a <code>Vector</code> of <code> * DataTransferObject</code> objects containing * all relevant data for the process. * * @return a <code>Vector</code> of * <code>DataTransferObject</code> objects */ public Vector getDataFileVector() { return thirdPanel.getDataFileVector(); } /** * Returns the XML format style for an XML import/export. * Value of -1 is returned in this case. * * @return the XML format */ public int getXMLFormat() { return -1; } /** * Defines the action for the BACK button. */ private boolean doPrevious() { // make sure the cancel button says cancel setCancelButtonText("Cancel"); return true; } /** * Defines the action for the NEXT button. */ private boolean doNext() { JPanel nextPanel = null; int index = model.getSelectedIndex(); switch (index) { case 0: DatabaseConnection dc = getDatabaseConnection(); if (dc != null) { metaData.setDatabaseConnection(dc); } if (secondPanel == null) { secondPanel = new ImportExportPanel_2(this); } nextPanel = secondPanel; secondPanel.setListData(getTableTransferType()); break; case 1: if (!secondPanel.hasSelections()) { if (getTableTransferType() == ImportExportProcess.MULTIPLE_TABLE) { GUIUtilities.displayErrorMessage( "You must select at least one table"); } else if (getTableTransferType() == ImportExportProcess.SINGLE_TABLE) { GUIUtilities.displayErrorMessage( "You must select at least one column"); } return false; } if (thirdPanel == null) { thirdPanel = new ImportExportPanel_3(this); } else { thirdPanel.buildTable(); } nextPanel = thirdPanel; break; case 2: if (!thirdPanel.transferObjectsComplete()) { return false; } if (fourthPanel == null) { fourthPanel = new ImportExportDelimitedPanel_4(this); } nextPanel = fourthPanel; break; case 3: if (progressPanel == null) { progressPanel = new ImportExportProgressPanel(this); } processing = true; model.addPanel(progressPanel); if (transferType == ImportExportProcess.EXPORT) { doExport(); } else if (transferType == ImportExportProcess.IMPORT) { doImport(); } setButtonsEnabled(false); return true; } model.addPanel(nextPanel); return true; } /** * Stops the current process. */ public void stopTransfer() { setButtonsEnabled(true); if (processing) { worker.cancelTransfer(); setBackButtonEnabled(true); processCancelled = true; } } /** * Defines the action for the CANCEL button. */ public void cancel() { setButtonsEnabled(true); if (processing) { worker.cancelTransfer(); setBackButtonEnabled(true); processCancelled = true; } else { worker = null; parent.finished(); } } public JDialog getDialog() { if (parent.isDialog()) { return (JDialog)parent; } return null; } /** * Returns the type of transfer - single or multiple table. * * @return the type of transfer */ public int getTableTransferType() { return firstPanel.getSelection(); } /** * Returns the selected database connection properties object. * * @return the connection properties object */ public DatabaseConnection getDatabaseConnection() { return firstPanel.getDatabaseConnection(); } /** <p>Retrieves the size of the child panel * to be added to the main base panel. * * @return the size of the child panel */ public Dimension getChildDimension() { return childDim; } /** <p>Retrieves the <code>MetaDataValues</code> * object defined for this process. * * @return the <code>MetaDataValues</code> helper class */ public MetaDataValues getMetaDataUtility() { return metaData; } /** <p>Returns the type of multiple table * transfer - single or multiple file. * * @return the type of multiple table transfer */ public int getMutlipleTableTransferType() { return -1; } private class TransferDelimitedWizardModel extends DefaultWizardProcessModel { public TransferDelimitedWizardModel() { int type = getTransferType(); String firstTitle = "Database Connection and Export Type"; String fifthTitle = "Exporting Data..."; if (type == ImportExportProcess.IMPORT) { firstTitle = "Database Connection and Import Type"; fifthTitle = "Importing Data..."; } String[] titles = {firstTitle, "Table Selection", "Data File Selection", "Options", fifthTitle}; setTitles(titles); String[] steps = {"Select database connection and transfer type", "Select the tables/columns", type == ImportExportProcess.IMPORT ? "Select the data file(s) to import from" : "Select the data file(s) to export to", "Set any further transfer options", type == ImportExportProcess.IMPORT ? "Import the data" : "Export the data"}; setSteps(steps); } public boolean previous() { if (doPrevious()) { return super.previous(); } return false; } public boolean next() { if (doNext()) { return super.next(); } return false; } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -