1 19 20 package org.netbeans.modules.j2ee.ejbcore.ejb.wizard.entity; 21 22 import java.awt.event.ActionEvent ; 23 import java.awt.event.ActionListener ; 24 import javax.swing.SwingUtilities ; 25 import javax.swing.event.ChangeListener ; 26 import javax.swing.event.DocumentEvent ; 27 import javax.swing.event.DocumentListener ; 28 30 35 public class EntityEJBWizardPanel extends javax.swing.JPanel { 36 37 private final ChangeListener listener; 38 39 40 public EntityEJBWizardPanel(ChangeListener changeListener) { 41 this.listener = changeListener; 42 initComponents(); 43 44 localCheckBox.addActionListener(new ActionListener () { 45 public void actionPerformed(ActionEvent actionEvent) { 46 listener.stateChanged(null); 47 } 48 }); 49 50 remoteCheckBox.addActionListener(new ActionListener () { 51 public void actionPerformed(ActionEvent actionEvent) { 52 listener.stateChanged(null); 53 } 54 }); 55 56 primaryKeyTextField.getDocument().addDocumentListener(new DocumentListener () { 57 public void changedUpdate(DocumentEvent documentEvent) { 58 listener.stateChanged(null); 59 } 60 public void insertUpdate(DocumentEvent documentEvent) { 61 listener.stateChanged(null); 62 } 63 public void removeUpdate(DocumentEvent documentEvent) { 64 listener.stateChanged(null); 65 } 66 }); 67 68 jButton1.setVisible(false); 70 71 } 72 73 public boolean isCMP() { 74 return cmpButton.isSelected(); 75 } 76 77 82 private void initComponents() { 84 java.awt.GridBagConstraints gridBagConstraints; 85 86 persistenceGroup = new javax.swing.ButtonGroup (); 87 persistenceTypeLabel = new javax.swing.JLabel (); 88 cmpButton = new javax.swing.JRadioButton (); 89 bmpButton = new javax.swing.JRadioButton (); 90 createInterfaceLabel = new javax.swing.JLabel (); 91 remoteCheckBox = new javax.swing.JCheckBox (); 92 localCheckBox = new javax.swing.JCheckBox (); 93 jLabel1 = new javax.swing.JLabel (); 94 primaryKeyTextField = new javax.swing.JTextField (); 95 jButton1 = new javax.swing.JButton (); 96 97 setLayout(new java.awt.GridBagLayout ()); 98 99 org.openide.awt.Mnemonics.setLocalizedText(persistenceTypeLabel, org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_PersistenceType")); gridBagConstraints = new java.awt.GridBagConstraints (); 101 gridBagConstraints.gridy = 1; 102 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 103 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 104 add(persistenceTypeLabel, gridBagConstraints); 105 106 persistenceGroup.add(cmpButton); 107 cmpButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Container").charAt(0)); 108 cmpButton.setSelected(true); 109 cmpButton.setText(org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Container")); gridBagConstraints = new java.awt.GridBagConstraints (); 111 gridBagConstraints.gridy = 2; 112 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 113 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 114 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 115 gridBagConstraints.weightx = 1.0; 116 gridBagConstraints.insets = new java.awt.Insets (0, 15, 0, 0); 117 add(cmpButton, gridBagConstraints); 118 java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle"); cmpButton.getAccessibleContext().setAccessibleName(bundle.getString("LBL_Container")); cmpButton.getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_Container")); 122 persistenceGroup.add(bmpButton); 123 bmpButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Bean").charAt(0)); 124 bmpButton.setText(org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Bean")); gridBagConstraints = new java.awt.GridBagConstraints (); 126 gridBagConstraints.gridy = 3; 127 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 128 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 129 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 130 gridBagConstraints.insets = new java.awt.Insets (0, 15, 0, 0); 131 add(bmpButton, gridBagConstraints); 132 bmpButton.getAccessibleContext().setAccessibleName(bundle.getString("LBL_Bean")); bmpButton.getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_Bean")); 135 org.openide.awt.Mnemonics.setLocalizedText(createInterfaceLabel, org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Interface")); gridBagConstraints = new java.awt.GridBagConstraints (); 137 gridBagConstraints.gridy = 4; 138 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 139 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 140 gridBagConstraints.insets = new java.awt.Insets (15, 0, 0, 0); 141 add(createInterfaceLabel, gridBagConstraints); 142 143 remoteCheckBox.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Remote").charAt(0)); 144 remoteCheckBox.setText(org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Remote")); gridBagConstraints = new java.awt.GridBagConstraints (); 146 gridBagConstraints.gridy = 5; 147 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 148 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 149 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 150 gridBagConstraints.insets = new java.awt.Insets (0, 15, 0, 0); 151 add(remoteCheckBox, gridBagConstraints); 152 remoteCheckBox.getAccessibleContext().setAccessibleName(bundle.getString("LBL_Remote")); remoteCheckBox.getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_Remote")); 155 localCheckBox.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Local").charAt(0)); 156 localCheckBox.setSelected(true); 157 localCheckBox.setText(org.openide.util.NbBundle.getMessage(EntityEJBWizardPanel.class, "LBL_Local")); gridBagConstraints = new java.awt.GridBagConstraints (); 159 gridBagConstraints.gridy = 6; 160 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 161 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 162 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 163 gridBagConstraints.weightx = 1.0; 164 gridBagConstraints.weighty = 1.0; 165 gridBagConstraints.insets = new java.awt.Insets (0, 15, 0, 0); 166 add(localCheckBox, gridBagConstraints); 167 localCheckBox.getAccessibleContext().setAccessibleName(bundle.getString("LBL_Local")); localCheckBox.getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_Local")); 170 jLabel1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_PrimaryKey").charAt(0)); 171 jLabel1.setLabelFor(primaryKeyTextField); 172 jLabel1.setText(org.openide.util.NbBundle.getBundle(EntityEJBWizardPanel.class).getString("LBL_PrimaryKeyClass")); gridBagConstraints = new java.awt.GridBagConstraints (); 174 gridBagConstraints.gridy = 0; 175 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 176 gridBagConstraints.insets = new java.awt.Insets (0, 0, 8, 8); 177 add(jLabel1, gridBagConstraints); 178 179 primaryKeyTextField.setText("java.lang.Long"); 180 gridBagConstraints = new java.awt.GridBagConstraints (); 181 gridBagConstraints.gridx = 1; 182 gridBagConstraints.gridy = 0; 183 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 184 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 185 gridBagConstraints.weightx = 1.0; 186 gridBagConstraints.insets = new java.awt.Insets (0, 0, 8, 8); 187 add(primaryKeyTextField, gridBagConstraints); 188 primaryKeyTextField.getAccessibleContext().setAccessibleName(bundle.getString("ACS_PrimaryKeyField")); primaryKeyTextField.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_PrimaryKeyField")); 191 jButton1.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbcore/ejb/wizard/entity/Bundle").getString("MN_Browse").charAt(0)); 192 jButton1.setText("..."); 193 jButton1.addActionListener(new java.awt.event.ActionListener () { 194 public void actionPerformed(java.awt.event.ActionEvent evt) { 195 jButton1ActionPerformed(evt); 196 } 197 }); 198 gridBagConstraints = new java.awt.GridBagConstraints (); 199 gridBagConstraints.gridx = 2; 200 gridBagConstraints.gridy = 0; 201 gridBagConstraints.insets = new java.awt.Insets (0, 0, 8, 0); 202 add(jButton1, gridBagConstraints); 203 jButton1.getAccessibleContext().setAccessibleName(bundle.getString("ACS_BrowsePK")); jButton1.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_BrowsePK")); } 207 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { SwingUtilities.invokeLater (new Runnable () { 209 public void run() { 210 } 213 }); 214 } 216 217 private javax.swing.JRadioButton bmpButton; 219 private javax.swing.JRadioButton cmpButton; 220 private javax.swing.JLabel createInterfaceLabel; 221 private javax.swing.JButton jButton1; 222 private javax.swing.JLabel jLabel1; 223 private javax.swing.JCheckBox localCheckBox; 224 private javax.swing.ButtonGroup persistenceGroup; 225 private javax.swing.JLabel persistenceTypeLabel; 226 private javax.swing.JTextField primaryKeyTextField; 227 private javax.swing.JCheckBox remoteCheckBox; 228 230 public boolean isRemote() { 231 return remoteCheckBox.isSelected(); 232 } 233 234 public boolean isLocal() { 235 return localCheckBox.isSelected(); 236 } 237 238 public String getPrimaryKeyClassName() { 239 return primaryKeyTextField.getText(); 240 } 241 242 } 243 | Popular Tags |