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

📄 importwizardcard2.java

📁 一个OR Mapping 工具
💻 JAVA
字号:
package org.dbgen.view;import java.awt.*;import java.awt.event.*;import java.sql.*;import javax.swing.*;import javax.swing.event.*;import org.dbgen.*;import org.dbgen.gui.*;import org.dbgen.support.StringHelper;/** * This class was generated by a SmartGuide. * */public class ImportWizardCard2 extends javax.swing.JPanel implements WizardCard, ActionListener, ListSelectionListener {  org.dbgen.view.TextField fieldDriverField = null;  org.dbgen.view.TextField fieldUrlField = null;  org.dbgen.view.TextField fieldPasswordField = null;  org.dbgen.view.TextField fieldUsernameField = null;  protected static final int DRIVER_FIELD = 1;  protected static final int URL_FIELD = 2;  boolean fieldDriverLoaded = false;  org.dbgen.support.DbAccess fieldDBA = null;  JComboBox fieldCatalogComboBox = null;  JList fieldTableList = null;  MetaImporter fieldImporter = null;  DefaultListModel fieldListModel = null;  /**   * ImportWizardCard1 constructor comment.   */  public ImportWizardCard2() {    super();    initialize();  }  /**   * This method was created by a SmartGuide.   * @param event ActionEvent   */  public void actionPerformed(ActionEvent event) {    MetaImporter importer = getImporter();    /* If there is more than one item in the combo box, then     * we are sure that we have at least one or more catalogs     * schemas.  Otherwise, just don't set the catalog/schema     * property and we will use NULL to find table names.     */    if (getCatalogComboBox().getItemCount() > 0)    {      if (importer.getUseSchema())      {        importer.setSchema((String) getCatalogComboBox().getSelectedItem());      }      else      {        importer.setCatalog((String) getCatalogComboBox().getSelectedItem());      }    }    String[] tableNames = importer.getTableNames();    DefaultListModel model = getListModel();    model.removeAllElements();    if (tableNames == null)    {      CommonDialog.showError(this, "Error Message", "There is no table defined in this catalog.");    }    else    {      for (int i = 0; i < tableNames.length; i++)      {        model.addElement(tableNames[i]);      }    }    return;  }  /**   * This method was created by a SmartGuide.   * @param wizard org.dbgen.gui.Wizard   */  public void cardShown(Wizard wizard) {    ImportWizardCard1 jdbcCard = (ImportWizardCard1) wizard.getPreviousCard();    setImporter(new MetaImporter(jdbcCard.getDBA()));    String[] catalogNames = getImporter().getCatalogNames();    getCatalogComboBox().removeAllItems();    for (int i = 0; i < catalogNames.length; i++)    {      getCatalogComboBox().addItem(catalogNames[i]);    }    if (getImporter().getUseSchema())      CommonDialog.showInformation(this, "Importer Information", "Your database doesn't seem to support getCatalog().\nI am trying to use getSchema() instead.");    Wizard.findWizard(this).setMessage("Please select a catalog and click FINISH button.");    return;  }  /**   * This method was created by a SmartGuide.   * @return boolean   */  public boolean enableFinishButton() {    Object[] tableNames = getTableList().getSelectedValues();    return (tableNames.length > 0);  }  /**   * This method was created by a SmartGuide.   * @return boolean   */  public boolean enableNextButton() {    return false;  }  /**   * This method was created by a SmartGuide.   * @return java.lang.String   */  public String getCardName() {    return "Import Wizard Card #2";  }  /**   * Gets the catalogComboBox property (javax.swing.JComboBox) value.   * @return The catalogComboBox property value.   */  public JComboBox getCatalogComboBox() {    /* Returns the catalogComboBox property value. */    if (fieldCatalogComboBox == null) {      try {        fieldCatalogComboBox = new JComboBox();      } catch (Throwable exception) {        System.err.println("Exception creating catalogComboBox property.");      }    };    return fieldCatalogComboBox;  }  /**   * Gets the importer property (org.dbgen.MetaImporter) value.   * @return The importer property value.   * @see #setImporter   */  public MetaImporter getImporter() {    /* Returns the importer property value. */    if (fieldImporter == null) {      try {        fieldImporter = new MetaImporter(null);      } catch (Throwable exception) {        System.err.println("Exception creating importer property.");      }    };    return fieldImporter;  }  /**   * Gets the listModel property (javax.swing.DefaultListModel) value.   * @return The listModel property value.   */  public DefaultListModel getListModel() {    /* Returns the listModel property value. */    if (fieldListModel == null) {      try {        fieldListModel = new DefaultListModel();      } catch (Throwable exception) {        System.err.println("Exception creating listModel property.");      }    };    return fieldListModel;  }  /**   * This method was created by a SmartGuide.   * @return java.awt.Dimension   */  public Dimension getMinimumSizeOld() {    return new Dimension(400, 200);  }  /**   * Gets the tableList property (javax.swing.JList) value.   * @return The tableList property value.   */  public JList getTableList() {    /* Returns the tableList property value. */    if (fieldTableList == null) {      try {        fieldTableList = new JList(getListModel());      } catch (Throwable exception) {        System.err.println("Exception creating tableList property.");      }    };    return fieldTableList;  }  /**   * This method was created by a SmartGuide.   */  public void initialize() {    setLayout(new GridBagLayout());    GridBagConstraints gbc = new GridBagConstraints();    Insets insets = new Insets(5, 5, 5, 5);    int row = 1;    Util.addgbc2(this, new JLabel("Please select a catalog/database below:"), gbc, row++, 1, 2, 1, 0f, 0f, GridBagConstraints.BOTH, GridBagConstraints.WEST, insets);    Util.addgbc2(this, new JLabel("Catalog:"), gbc, row, 1, 1, 1, 0f, 0f, GridBagConstraints.NONE, GridBagConstraints.WEST, insets);    Util.addgbc2(this, getCatalogComboBox(), gbc, row++, 2, 1, 1, 0f, 0f, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, insets);    Util.addgbc2(this, new JLabel("Table List:"), gbc, row++, 1, 2, 1, 0f, 0f, GridBagConstraints.NONE, GridBagConstraints.WEST, insets);    Util.addgbc2(this, new JScrollPane(getTableList()), gbc, row++, 1, 2, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER, insets);    getCatalogComboBox().addActionListener(this);    getTableList().addListSelectionListener(this);    return;  }  /**   * This method was created by a SmartGuide.   * @return boolean   */  public boolean proceedNext() {    return false;  }  /**   * Sets the importer property (org.dbgen.MetaImporter) value.   * @param importer The new value for the property.   * @see #getImporter   */  public void setImporter(MetaImporter importer) {    fieldImporter = importer;    return;  }  /**   * This method was created by a SmartGuide.   * @param event ListSelectionEvent   */  public void valueChanged(ListSelectionEvent event) {    Wizard.findWizard(this).updateSensitivities();    return;  }}

⌨️ 快捷键说明

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