📄 generatewizardoptionscard.java
字号:
package org.dbgen.view;import javax.swing.*;import javax.swing.border.*;import java.awt.*;import java.awt.event.*;import org.dbgen.gui.*;/** * This class was generated by a SmartGuide. * */public class GenerateWizardOptionsCard extends JPanel implements org.dbgen.gui.WizardCard, java.awt.event.ActionListener { JCheckBox fieldGenDataClassCheckBox = null; JCheckBox fieldGenTestClassCheckBox = null; JCheckBox fieldGenCreateScriptCheckBox = null; JCheckBox fieldGenTableModelCheckBox = null; JCheckBox fieldGenTableModelJavaxCheckBox = null; JCheckBox fieldGenTableModelMainCheckBox = null; JComboBox fieldTargetDatabaseComboBox = null; /** * GenerateWizardOptionsCard constructor comment. */ public GenerateWizardOptionsCard() { super(); initialize(); } /** * actionPerformed method comment. */ public void actionPerformed(ActionEvent e) { if (e.getSource() == getGenTestClassCheckBox()) { Wizard wizard = Wizard.findWizard(this); wizard.updateSensitivities(); } } /** * cardShown method comment. */ public void cardShown(org.dbgen.gui.Wizard wizard) { GenerateWizardSelectTableCard card = (GenerateWizardSelectTableCard) wizard.getCards()[0]; int targetDatabase = card.getCurrentProject().getTargetDatabase(); if (targetDatabase > 0) { getTargetDatabaseComboBox().setSelectedIndex(targetDatabase-1); } } /** * enableFinishButton method comment. */ public boolean enableFinishButton() { if (getGenTestClassCheckBox().isSelected()) return false; else return true; } /** * enableNextButton method comment. */ public boolean enableNextButton() { if (getGenTestClassCheckBox().isSelected()) return true; else return false; } /** * getCardName method comment. */ public String getCardName() { return "Code Generation Options"; } /** * Gets the genCreateScriptCheckBox property (javax.swing.JCheckBox) value. * @return The genCreateScriptCheckBox property value. */ public JCheckBox getGenCreateScriptCheckBox() { /* Returns the genCreateScriptCheckBox property value. */ if (fieldGenCreateScriptCheckBox == null) { try { fieldGenCreateScriptCheckBox = new JCheckBox("Generate SQL CREATE Scripts"); } catch (Throwable exception) { System.err.println("Exception creating genCreateScriptCheckBox property."); } }; return fieldGenCreateScriptCheckBox; } /** * Gets the genDataClassCheckBox property (javax.swing.JCheckBox) value. * @return The genDataClassCheckBox property value. */ public JCheckBox getGenDataClassCheckBox() { /* Returns the genDataClassCheckBox property value. */ if (fieldGenDataClassCheckBox == null) { try { fieldGenDataClassCheckBox = new JCheckBox("Generate Data Classes", true); } catch (Throwable exception) { System.err.println("Exception creating genDataClassCheckBox property."); } }; return fieldGenDataClassCheckBox; } public JCheckBox getGenTableModelCheckBox() { /* Returns the genTableModelCheckBox property value. */ if (fieldGenTableModelCheckBox == null) { try { fieldGenTableModelCheckBox = new JCheckBox("Generate Table Model for Swing JTable"); } catch (Throwable exception) { System.err.println("Exception creating genTableModelCheckBox property."); } }; return fieldGenTableModelCheckBox; } public JCheckBox getGenTableModelJavaxCheckBox() { /* Returns the genTableModelJavaxCheckBox property value. */ if (fieldGenTableModelJavaxCheckBox == null) { try { fieldGenTableModelJavaxCheckBox = new JCheckBox("use javax Package"); fieldGenTableModelJavaxCheckBox.setEnabled(false); fieldGenTableModelJavaxCheckBox.setHorizontalAlignment(SwingConstants.LEFT); } catch (Throwable exception) { System.err.println("Exception creating genTableModelJavaxCheckBox property."); } }; return fieldGenTableModelJavaxCheckBox; } public JCheckBox getGenTableModelMainCheckBox() { /* Returns the genTableModelMainCheckBox property value. */ if (fieldGenTableModelMainCheckBox == null) { try { fieldGenTableModelMainCheckBox = new JCheckBox("with Main() Function"); fieldGenTableModelMainCheckBox.setEnabled(false); fieldGenTableModelMainCheckBox.setHorizontalAlignment(SwingConstants.LEFT); } catch (Throwable exception) { System.err.println("Exception creating genTableModelMainCheckBox property."); } }; return fieldGenTableModelMainCheckBox; } /** * Gets the genTestClassCheckBox property (javax.swing.JCheckBox) value. * @return The genTestClassCheckBox property value. */ public JCheckBox getGenTestClassCheckBox() { /* Returns the genTestClassCheckBox property value. */ if (fieldGenTestClassCheckBox == null) { try { fieldGenTestClassCheckBox = new JCheckBox("Generate Test Classes", true); } catch (Throwable exception) { System.err.println("Exception creating genTestClassCheckBox property."); } }; return fieldGenTestClassCheckBox; } /** * Gets the targetDatabaseComboBox property (javax.swing.JComboBox) value. * @return The targetDatabaseComboBox property value. */ public JComboBox getTargetDatabaseComboBox() { /* Returns the targetDatabaseComboBox property value. */ if (fieldTargetDatabaseComboBox == null) { try { fieldTargetDatabaseComboBox = new JComboBox(org.dbgen.DbGen.getSupportedDatabases()); } catch (Throwable exception) { System.err.println("Exception creating targetDatabaseComboBox property."); } }; return fieldTargetDatabaseComboBox; } /** * This method was created by a SmartGuide. */ public void initialize() { GridBagConstraints gbc = new GridBagConstraints(); Insets insets = new Insets(2, 2, 2, 2); int row = 1; JPanel optPanel = new JPanel(new GridLayout(0, 1)); optPanel.add(getGenDataClassCheckBox()); optPanel.add(getGenTestClassCheckBox()); optPanel.add(getGenCreateScriptCheckBox()); optPanel.add(getGenTableModelCheckBox()); JPanel tmPanel = new JPanel(new GridLayout(1,0)); tmPanel.setBorder( new EmptyBorder(0,20,0,40)); tmPanel.add( "West", getGenTableModelMainCheckBox()); tmPanel.add( "East", getGenTableModelJavaxCheckBox()); optPanel.add(tmPanel); optPanel.setBorder(new TitledBorder("Code Generation Options")); getGenTableModelCheckBox().addItemListener( new ItemListener() { public void itemStateChanged( ItemEvent ev ) { //System.out.println( getGenTableModelCheckBox().isSelected()); getGenTableModelJavaxCheckBox().setEnabled(getGenTableModelCheckBox().isSelected() ); getGenTableModelMainCheckBox().setEnabled(getGenTableModelCheckBox().isSelected() ); } } ); getGenTestClassCheckBox().addActionListener(this); JPanel dbPanel = new JPanel(new BorderLayout(5,5)); dbPanel.setBorder(new TitledBorder("Target Database")); JPanel dbTop = new JPanel(); JLabel label = new JLabel("Select Your Database:"); label.setBorder(new EmptyBorder(3, 3, 3, 3)); dbTop.setLayout(new BorderLayout(5, 5)); dbTop.add(BorderLayout.WEST, label); dbTop.add(BorderLayout.CENTER, getTargetDatabaseComboBox()); JTextArea dbDesc = new JTextArea(); dbDesc.setEnabled(false); dbDesc.setColumns(50); dbDesc.setLineWrap(true); dbDesc.setText("Note: DbGen actually works with all databases\naccessible from JDBC. However, the SQL CREATE\nscript is database dependent so the target database\nis needed to be known in advance."); dbPanel.add(BorderLayout.NORTH, dbTop); dbPanel.add(BorderLayout.CENTER, dbDesc); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(optPanel); add(Box.createVerticalStrut(5)); add(dbPanel); return; } /** * proceedNext method comment. */ public boolean proceedNext() { return true; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -