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

📄 importexportxmlpanel.java

📁 eq跨平台查询工具源码 eq跨平台查询工具源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * ImportExportXMLPanel.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.gui.browser.ColumnData;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 ImportExportXMLPanel 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 ImportExportXMLPanel_1 firstPanel;        /** The second panel displayed */    private ImportExportPanel_2 secondPanel;        /** The third panel displayed */    private ImportExportPanel_3 thirdPanel;        /** The fourth panel displayed - export */    private ExportXMLPanel_4 fourthPanel_ex;        /** The fourth panel displayed - import */    private ImportXMLPanel_4 fourthPanel_im;        /** The fifth panel displayed */    private ImportExportXMLPanel_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 selection model */    private TransferXMLWizardModel model;    public ImportExportXMLPanel(ActionContainer parent, int transferType) {        this(parent, transferType, null, null, null);    }        public ImportExportXMLPanel(ActionContainer parent,                                 int transferType,                                DatabaseConnection databaseConnection,                                String schemaName,                                String tableName) {        this.transferType = transferType;                model = new TransferXMLWizardModel();        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, 350);        // set the help action        setHelpAction(ActionBuilder.get("help-command"), "import-export");                firstPanel = new ImportExportXMLPanel_1(this);        model.addPanel(firstPanel);        prepare();    }        /**     * Returns the transfer format - XML, CSV etc.     */    public int getTransferFormat() {        return XML;    }    /**     * Returns whether to trim whitespace on column data values.     *     * @return true | false     */    public boolean trimWhitespace() {        return false;    }    /**     * 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 fifthPanel.parseDateValues();    }    /** <p>Whether the table name is an attribute     *  within the XML document.     *     *  @return whether the table name is an attribute     */    public boolean hasTableNameAsAttribute() {        return fourthPanel_im.hasTableNameAsAttribute();    }        /**     * Returns whether to include column names.     *     * @return true | false     */    public boolean includeColumnNames() {        return true;    }    public JDialog getDialog() {        if (parent.isDialog()) {            return (JDialog)parent;        }        return null;    }    /**      * 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 void doImport() {        Log.info("Beginning data import process");        processCancelled = false;        setNextButtonEnabled(false);        setCancelButtonEnabled(false);        setBackButtonEnabled(false);        worker = new ImportXMLWorker(this, progressPanel);    }        /** <p>Begins an export process. */    public void doExport() {        Log.info("Beginning data export process");        processCancelled = false;        setNextButtonEnabled(false);        setCancelButtonEnabled(false);        setBackButtonEnabled(false);        worker = new ExportXMLWorker(this, progressPanel);    }        /** <p>Retrieves the selected tables for this process.     *     *  @return the selected table names     */

⌨️ 快捷键说明

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