⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 importexportexcelpanel.java

📁 eq跨平台查询工具源码 eq跨平台查询工具源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * ImportExportExcelPanel.java * * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. * */package org.executequery.gui.importexport;import java.awt.Dimension;import java.util.Vector;import javax.swing.JDialog;import javax.swing.JPanel;import org.executequery.ActiveComponent;import org.executequery.GUIUtilities;import org.underworldlabs.swing.wizard.DefaultWizardProcessModel;import org.underworldlabs.swing.wizard.WizardProcessPanel;import org.executequery.databasemediators.DatabaseConnection;import org.executequery.databasemediators.MetaDataValues;import org.executequery.gui.*;import org.executequery.util.Log;import org.underworldlabs.swing.actions.ActionBuilder;/* ---------------------------------------------------------- * CVS NOTE: Changes to the CVS repository prior to the  *           release of version 3.0.0beta1 has meant a  *           resetting of CVS revision numbers. * ---------------------------------------------------------- *//** * * @author   Takis Diakoumis * @version  $Revision: 1.8 $ * @date     $Date: 2006/09/13 15:15:09 $ */public class ImportExportExcelPanel extends WizardProcessPanel                                    implements ImportExportProcess,                                               ActiveComponent {        /** The dimension of each child panel */    private Dimension childDim;        /** The object to retrieve table details */    private MetaDataValues metaData;        /** The worker that will run the process */    private ImportExportWorker worker;        /** The first panel displayed */    private ImportExportExcelPanel_1 firstPanel;        /** The second panel displayed */    private ImportExportPanel_2 secondPanel;        /** The third panel displayed */    private ImportExportPanel_3 thirdPanel;        /** The fourth panel displayed - export */    private ImportExportExcelPanel_4 fourthPanel;        /** The fourth panel displayed - import */    private ImportXMLPanel_4 fourthPanel_im;        /** The fifth panel displayed */    private ImportExportExcelPanel_5 fifthPanel;        /** The sixth panel displayed */    //  private ImportExportXMLPanel_6 sixthPanel;    /** The progress panel */    private ImportExportProgressPanel progressPanel;        /** The type of transfer - import/export */    private int transferType;        /** Whether the process was cancelled */    private boolean processCancelled;        /** Whether a transfer is currently underway */    private boolean processing;        /** the parent container */    private ActionContainer parent;    /** the wizard model */    private TransferExcelWizardModel model;        public ImportExportExcelPanel(ActionContainer parent, int transferType) {        this(parent, transferType, null, null, null);    }        public ImportExportExcelPanel(ActionContainer parent,                                   int transferType,                                  DatabaseConnection databaseConnection,                                  String schemaName,                                  String tableName) {        this.transferType = transferType;        model = new TransferExcelWizardModel();        setModel(model);        this.parent = parent;        try {            jbInit();        } catch(Exception e) {            e.printStackTrace();        }                if (databaseConnection != null) {            firstPanel.setDatabaseConnection(databaseConnection);            next();                        if (schemaName != null) {                secondPanel.setSelectedSchema(schemaName);                if (tableName != null) {                    secondPanel.setSelectedTable(tableName);                    secondPanel.selectAllAvailable();                }            }        }    }        private void jbInit() throws Exception {        metaData = new MetaDataValues();        childDim = new Dimension(525, 340);                // set the help action        setHelpAction(ActionBuilder.get("help-command"), "export-excel");               firstPanel = new ImportExportExcelPanel_1(this);        model.addPanel(firstPanel);        prepare();    }        /**     * Returns the transfer format - XML, CSV etc.     */    public int getTransferFormat() {        return EXCEL;    }    /**     * Releases database resources before closing.     */    public void cleanup() {        metaData.closeConnection();    }    public String getSchemaName() {        return secondPanel.getSelectedSchema();    }        /** <p>Cancels the current in-process transfer */    public void cancelTransfer() {        processCancelled = true;    }        /** <p>Return whether this process is an     *  import or export process.     *     *  @return <code>ImportExportProcess.IMPORT |     *          ImportExportProcess.EXPORT</code>     */    public int getTransferType() {        return transferType;    }        /** <p>Retrieves the selected rollback size for     *  the transfer.     *     *  @return the rollback size     */    public int getRollbackSize() {        return fifthPanel.getRollbackSize();    }        /** <p>Retrieves the action on an error occuring     *  during the import/export process.     *     *  @return the action on error -<br>either:     *          <code>ImportExportProcess.LOG_AND_CONTINUE</code> or     *          <code>ImportExportProcess.STOP_TRANSFER</code>     */    public int getOnError() {        return fifthPanel.getOnError();    }        /** <p>Retrieves the date format for date fields     *  contained within the data file/database table.     *     *  @return the date format (ie. ddMMyyy)     */    public String getDateFormat() {        return fifthPanel.getDateFormat();    }    /**     * Returns whether to parse date values.     *     * @return true | false     */    public boolean parseDateValues() {        return false;    }    /**      * Retrieves the selected type of delimiter within     * the file to be used with this process.     *     * @return the selected delimiter     */    public char getDelimiter() {        return 0;    }    public void setProcessComplete(boolean success) {        setButtonsEnabled(true);        setNextButtonEnabled(false);        setBackButtonEnabled(true);        setCancelButtonEnabled(true);        if (success) {            setCancelButtonText("Finish");        }        processing  = false;            }        public JDialog getDialog() {        if (parent.isDialog()) {            return (JDialog)parent;        }        return null;    }    public void doImport() {}        /** <p>Begins an export process. */    public void doExport() {        Log.info("Beginning data export process");        processCancelled = false;        setNextButtonEnabled(false);        setCancelButtonEnabled(false);        setBackButtonEnabled(false);        worker = new ExportExcelWorker(this, progressPanel);    }        /** <p>Retrieves the selected tables for this process.     *     *  @return the selected table names     */    public String[] getSelectedTables() {        return secondPanel.getSelectedTables();    }        /** <p>Retrieves the table name for this process in     *  the case of a single table import/export.     *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -