1 19 24 25 package org.netbeans.modules.j2ee.sun.ide.sunresources.wizards; 26 27 import java.util.Vector ; 28 import org.openide.util.NbBundle; 29 import java.util.ResourceBundle ; 30 import java.util.ArrayList ; 31 import javax.swing.event.ChangeListener ; 32 33 import org.netbeans.modules.j2ee.sun.sunresources.beans.Field; 34 import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldGroup; 35 import org.netbeans.modules.j2ee.sun.sunresources.beans.WizardConstants; 36 import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldHelper; 37 38 42 public class JMSWizardVisualPanel extends javax.swing.JPanel implements ChangeListener , WizardConstants{ 43 44 protected ResourceBundle bundle = NbBundle.getBundle("org.netbeans.modules.j2ee.sun.ide.sunresources.wizards.Bundle"); 46 protected final JMSWizardPanel panel; 47 protected ResourceConfigHelper helper; 48 49 protected Field fields[] = null; 50 protected FieldGroup[] groups; 51 52 protected ArrayList beans = new ArrayList (); 53 protected boolean createNewResource = false; 54 private FieldGroup adminObjPropGroup; 55 56 57 public JMSWizardVisualPanel(JMSWizardPanel panel, FieldGroup[] groups) { 58 this.panel = panel; 59 this.helper = panel.getHelper(); 60 this.groups = groups; 61 this.adminObjPropGroup = panel.getFieldGroup(__Properties2); 63 initComponents(); 64 refreshFields(); 65 66 setName(NbBundle.getMessage(JMSWizardVisualPanel.class, "LBL_GeneralAttributes_JMS")); } 68 69 74 private void initComponents() { 76 java.awt.GridBagConstraints gridBagConstraints; 77 78 buttonGroup1 = new javax.swing.ButtonGroup (); 79 jPanel3 = new javax.swing.JPanel (); 80 chooseResLabel = new javax.swing.JLabel (); 81 queueConnectionRadioButton = new javax.swing.JRadioButton (); 82 topicConnectionRadioButton = new javax.swing.JRadioButton (); 83 queueRadioButton = new javax.swing.JRadioButton (); 84 topicRadioButton = new javax.swing.JRadioButton (); 85 adObjLabel = new javax.swing.JLabel (); 86 connLabel = new javax.swing.JLabel (); 87 connectionFactoryRadioButton = new javax.swing.JRadioButton (); 88 jTextArea1 = new javax.swing.JTextArea (); 89 jPanel2 = new javax.swing.JPanel (); 90 jndiNameField = new javax.swing.JTextField (); 91 enabledComboBox = new javax.swing.JComboBox (); 92 descField = new javax.swing.JTextField (); 93 jndiNameLabel = new javax.swing.JLabel (); 94 enabledLabel = new javax.swing.JLabel (); 95 descLabel = new javax.swing.JLabel (); 96 97 setLayout(new java.awt.GridBagLayout ()); 98 99 getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_GeneralAttributes_JMS")); 100 getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("jms-resource_Description")); 101 jPanel3.setLayout(new java.awt.GridBagLayout ()); 102 103 chooseResLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_resource-type")); 104 chooseResLabel.setFocusable(false); 105 gridBagConstraints = new java.awt.GridBagConstraints (); 106 gridBagConstraints.gridx = 0; 107 gridBagConstraints.gridy = 0; 108 gridBagConstraints.gridwidth = 2; 109 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 110 gridBagConstraints.weightx = 1.0; 111 gridBagConstraints.insets = new java.awt.Insets (10, 0, 10, 0); 112 jPanel3.add(chooseResLabel, gridBagConstraints); 113 chooseResLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_resource-type")); 114 115 buttonGroup1.add(queueConnectionRadioButton); 116 queueConnectionRadioButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_Connector_QueueConnectionFactory_Mnemonic").charAt(0)); 117 queueConnectionRadioButton.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_Connector_QueueConnectionFactory")); 118 queueConnectionRadioButton.addActionListener(new java.awt.event.ActionListener () { 119 public void actionPerformed(java.awt.event.ActionEvent evt) { 120 queueConnectionRadioButtonActionPerformed(evt); 121 } 122 }); 123 124 gridBagConstraints = new java.awt.GridBagConstraints (); 125 gridBagConstraints.gridx = 1; 126 gridBagConstraints.gridy = 5; 127 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 128 gridBagConstraints.ipadx = 3; 129 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 130 gridBagConstraints.insets = new java.awt.Insets (0, 30, 0, 30); 131 jPanel3.add(queueConnectionRadioButton, gridBagConstraints); 132 queueConnectionRadioButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_Connector_QueueConnectionFactory")); 133 134 buttonGroup1.add(topicConnectionRadioButton); 135 topicConnectionRadioButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_Connector_TopicConnectionFactory_Mnemonic").charAt(0)); 136 topicConnectionRadioButton.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_Connector_TopicConnectionFactory")); 137 topicConnectionRadioButton.addActionListener(new java.awt.event.ActionListener () { 138 public void actionPerformed(java.awt.event.ActionEvent evt) { 139 topicConnectionRadioButtonActionPerformed(evt); 140 } 141 }); 142 143 gridBagConstraints = new java.awt.GridBagConstraints (); 144 gridBagConstraints.gridx = 1; 145 gridBagConstraints.gridy = 6; 146 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 147 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 148 gridBagConstraints.insets = new java.awt.Insets (0, 30, 0, 30); 149 jPanel3.add(topicConnectionRadioButton, gridBagConstraints); 150 topicConnectionRadioButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_Connector_TopicConnectionFactory")); 151 152 buttonGroup1.add(queueRadioButton); 153 queueRadioButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_AdminObject_Queue_Mnemonic").charAt(0)); 154 queueRadioButton.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_AdminObject_Queue")); 155 queueRadioButton.addActionListener(new java.awt.event.ActionListener () { 156 public void actionPerformed(java.awt.event.ActionEvent evt) { 157 queueRadioButtonActionPerformed(evt); 158 } 159 }); 160 161 gridBagConstraints = new java.awt.GridBagConstraints (); 162 gridBagConstraints.gridx = 1; 163 gridBagConstraints.gridy = 2; 164 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 165 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 166 gridBagConstraints.insets = new java.awt.Insets (0, 30, 0, 30); 167 jPanel3.add(queueRadioButton, gridBagConstraints); 168 queueRadioButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_AdminObject_Queue")); 169 170 buttonGroup1.add(topicRadioButton); 171 topicRadioButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_AdminObject_Topic_Mnemonic").charAt(0)); 172 topicRadioButton.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_AdminObject_Topic")); 173 topicRadioButton.addActionListener(new java.awt.event.ActionListener () { 174 public void actionPerformed(java.awt.event.ActionEvent evt) { 175 topicRadioButtonActionPerformed(evt); 176 } 177 }); 178 179 gridBagConstraints = new java.awt.GridBagConstraints (); 180 gridBagConstraints.gridx = 1; 181 gridBagConstraints.gridy = 3; 182 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 183 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 184 gridBagConstraints.insets = new java.awt.Insets (0, 30, 10, 30); 185 jPanel3.add(topicRadioButton, gridBagConstraints); 186 topicRadioButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_AdminObject_Topic")); 187 188 adObjLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_jms-admin-object")); 189 adObjLabel.setFocusable(false); 190 gridBagConstraints = new java.awt.GridBagConstraints (); 191 gridBagConstraints.gridx = 0; 192 gridBagConstraints.gridy = 1; 193 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 194 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 195 jPanel3.add(adObjLabel, gridBagConstraints); 196 adObjLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("jms-admin-object_Description")); 197 198 connLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_jms-connector")); 199 gridBagConstraints = new java.awt.GridBagConstraints (); 200 gridBagConstraints.gridx = 0; 201 gridBagConstraints.gridy = 4; 202 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 203 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 204 jPanel3.add(connLabel, gridBagConstraints); 205 connLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("jms-connector_Description")); 206 207 buttonGroup1.add(connectionFactoryRadioButton); 208 connectionFactoryRadioButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_Connector_ConnectionFactory_Mnemonic").charAt(0)); 209 connectionFactoryRadioButton.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_Connector_ConnectionFactory")); 210 connectionFactoryRadioButton.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_Connector_ConnectionFactory")); 211 connectionFactoryRadioButton.addActionListener(new java.awt.event.ActionListener () { 212 public void actionPerformed(java.awt.event.ActionEvent evt) { 213 connectionFactoryRadioButtonActionPerformed(evt); 214 } 215 }); 216 217 gridBagConstraints = new java.awt.GridBagConstraints (); 218 gridBagConstraints.gridx = 1; 219 gridBagConstraints.gridy = 7; 220 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 221 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 222 gridBagConstraints.insets = new java.awt.Insets (0, 30, 10, 30); 223 jPanel3.add(connectionFactoryRadioButton, gridBagConstraints); 224 connectionFactoryRadioButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_Connector_ConnectionFactory")); 225 226 gridBagConstraints = new java.awt.GridBagConstraints (); 227 gridBagConstraints.gridx = 0; 228 gridBagConstraints.gridy = 2; 229 gridBagConstraints.gridwidth = 2; 230 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 231 gridBagConstraints.weightx = 1.0; 232 gridBagConstraints.weighty = 0.1; 233 add(jPanel3, gridBagConstraints); 234 jPanel3.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_GeneralAttributes_JMS")); 235 jPanel3.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("jms-resource_Description")); 236 237 jTextArea1.setEditable(false); 238 jTextArea1.setLineWrap(true); 239 jTextArea1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("jms-resource_Description")); 240 jTextArea1.setFocusable(false); 241 jTextArea1.setOpaque(false); 242 gridBagConstraints = new java.awt.GridBagConstraints (); 243 gridBagConstraints.gridx = 0; 244 gridBagConstraints.gridy = 0; 245 gridBagConstraints.gridwidth = 2; 246 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 247 gridBagConstraints.weightx = 1.0; 248 gridBagConstraints.weighty = 0.5; 249 add(jTextArea1, gridBagConstraints); 250 jTextArea1.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_GeneralAttributes_JMS")); 251 jTextArea1.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("jms-resource_Description")); 252 253 jPanel2.setLayout(new java.awt.GridBagLayout ()); 254 255 jndiNameField.addActionListener(new java.awt.event.ActionListener () { 256 public void actionPerformed(java.awt.event.ActionEvent evt) { 257 jndiNameFieldActionPerformed(evt); 258 } 259 }); 260 jndiNameField.addKeyListener(new java.awt.event.KeyAdapter () { 261 public void keyReleased(java.awt.event.KeyEvent evt) { 262 jndiNameFieldKeyReleased(evt); 263 } 264 }); 265 266 gridBagConstraints = new java.awt.GridBagConstraints (); 267 gridBagConstraints.gridx = 1; 268 gridBagConstraints.gridy = 0; 269 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 270 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 271 jPanel2.add(jndiNameField, gridBagConstraints); 272 jndiNameField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_jndi-name")); 273 jndiNameField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_jndi-name")); 274 275 initFields(); 276 enabledComboBox.addActionListener(new java.awt.event.ActionListener () { 277 public void actionPerformed(java.awt.event.ActionEvent evt) { 278 enabledComboBoxActionPerformed(evt); 279 } 280 }); 281 282 gridBagConstraints = new java.awt.GridBagConstraints (); 283 gridBagConstraints.gridx = 1; 284 gridBagConstraints.gridy = 1; 285 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 286 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 287 jPanel2.add(enabledComboBox, gridBagConstraints); 288 enabledComboBox.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_enabled")); 289 enabledComboBox.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_enabled")); 290 291 descField.addActionListener(new java.awt.event.ActionListener () { 292 public void actionPerformed(java.awt.event.ActionEvent evt) { 293 descFieldActionPerformed(evt); 294 } 295 }); 296 descField.addKeyListener(new java.awt.event.KeyAdapter () { 297 public void keyReleased(java.awt.event.KeyEvent evt) { 298 descFieldKeyReleased(evt); 299 } 300 }); 301 302 gridBagConstraints = new java.awt.GridBagConstraints (); 303 gridBagConstraints.gridx = 1; 304 gridBagConstraints.gridy = 2; 305 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 306 gridBagConstraints.weightx = 1.0; 307 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 308 jPanel2.add(descField, gridBagConstraints); 309 descField.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_description")); 310 descField.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_description")); 311 312 jndiNameLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_jndi-name_Mnemonic").charAt(0)); 313 jndiNameLabel.setLabelFor(jndiNameField); 314 jndiNameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_jndi-name")); 315 gridBagConstraints = new java.awt.GridBagConstraints (); 316 gridBagConstraints.gridx = 0; 317 gridBagConstraints.gridy = 0; 318 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 319 gridBagConstraints.weightx = 1.0; 320 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 321 jPanel2.add(jndiNameLabel, gridBagConstraints); 322 jndiNameLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_jndi-name")); 323 324 enabledLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_enabled_Mnemonic").charAt(0)); 325 enabledLabel.setLabelFor(enabledComboBox); 326 enabledLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_enabled")); 327 gridBagConstraints = new java.awt.GridBagConstraints (); 328 gridBagConstraints.gridx = 0; 329 gridBagConstraints.gridy = 1; 330 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 331 gridBagConstraints.weightx = 1.0; 332 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 333 jPanel2.add(enabledLabel, gridBagConstraints); 334 enabledLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_enabled")); 335 336 descLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_description_Mnemonic").charAt(0)); 337 descLabel.setLabelFor(descField); 338 descLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_description")); 339 gridBagConstraints = new java.awt.GridBagConstraints (); 340 gridBagConstraints.gridx = 0; 341 gridBagConstraints.gridy = 2; 342 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 343 gridBagConstraints.weightx = 1.0; 344 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 345 jPanel2.add(descLabel, gridBagConstraints); 346 descLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("ToolTip_description")); 347 348 gridBagConstraints = new java.awt.GridBagConstraints (); 349 gridBagConstraints.gridx = 0; 350 gridBagConstraints.gridy = 1; 351 gridBagConstraints.gridwidth = 2; 352 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 353 gridBagConstraints.weightx = 1.0; 354 gridBagConstraints.weighty = 0.3; 355 add(jPanel2, gridBagConstraints); 356 jPanel2.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("LBL_GeneralAttributes_JMS")); 357 jPanel2.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle").getString("jms-resource_Description")); 358 359 } 361 private void connectionFactoryRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { this.helper.getData().setString(__ResType, bundle.getString("LBL_Connector_ConnectionFactory")); this.helper.getData().setProperties(new Vector ()); 364 this.panel.fireChange(evt.getSource()); 365 } 367 private void topicConnectionRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { this.helper.getData().setString(__ResType, bundle.getString("LBL_Connector_TopicConnectionFactory")); this.helper.getData().setProperties(new Vector ()); 370 this.panel.fireChange(evt.getSource()); 371 } 373 private void queueConnectionRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { this.helper.getData().setString(__ResType, bundle.getString("LBL_Connector_QueueConnectionFactory")); this.helper.getData().setProperties(new Vector ()); 376 this.panel.fireChange(evt.getSource()); 377 } 379 private void topicRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { this.helper.getData().setString(__ResType, bundle.getString("LBL_AdminObject_Topic")); setPropsForAdminObj(); 382 this.panel.fireChange(evt.getSource()); 383 } 385 private void queueRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { this.helper.getData().setString(__ResType, bundle.getString("LBL_AdminObject_Queue")); setPropsForAdminObj(); 388 this.panel.fireChange(evt.getSource()); 389 } 391 private void descFieldKeyReleased(java.awt.event.KeyEvent evt) { ResourceConfigData data = this.helper.getData(); 393 String value = data.getString(__Description); 394 String newValue = descField.getText(); 395 if (!value.equals(newValue)) { 396 this.helper.getData().setString(__Description, newValue); 397 } 398 this.panel.fireChange(evt.getSource()); 399 } 401 private void descFieldActionPerformed(java.awt.event.ActionEvent evt) { ResourceConfigData data = this.helper.getData(); 403 String value = data.getString(__Description); 404 String newValue = descField.getText(); 405 if (!value.equals(newValue)) { 406 this.helper.getData().setString(__Description, newValue); 407 this.panel.fireChange(evt.getSource()); 408 } 409 410 if((this.getRootPane().getDefaultButton() != null) && (this.getRootPane().getDefaultButton().isEnabled())){ 411 this.getRootPane().getDefaultButton().doClick(); 412 } 413 } 415 416 private void enabledComboBoxActionPerformed(java.awt.event.ActionEvent evt) { String newValue = (String )enabledComboBox.getSelectedItem(); 418 this.helper.getData().setString(__Enabled, newValue); 419 } 421 private void jndiNameFieldKeyReleased(java.awt.event.KeyEvent evt) { ResourceConfigData data = this.helper.getData(); 423 String value = data.getString(__JndiName); 424 String newValue = jndiNameField.getText(); 425 if (!value.equals(newValue)) { 426 this.helper.getData().setString(__JndiName, newValue); 427 } 428 this.panel.fireChange(evt.getSource()); 429 } 431 private void jndiNameFieldActionPerformed(java.awt.event.ActionEvent evt) { ResourceConfigData data = this.helper.getData(); 433 String value = data.getString(__JndiName); 434 String newValue = jndiNameField.getText(); 435 if (!value.equals(newValue)) { 436 this.helper.getData().setString(__JndiName, newValue); 437 this.panel.fireChange(evt.getSource()); 438 } 439 440 if((this.getRootPane().getDefaultButton() != null) && (this.getRootPane().getDefaultButton().isEnabled())){ 441 this.getRootPane().getDefaultButton().doClick(); 442 } 443 } 445 public void stateChanged(javax.swing.event.ChangeEvent e) { 446 } 447 448 public void refreshFields() { 449 ResourceConfigData data = this.helper.getData(); 450 String jndiNameVal = (String )jndiNameField.getText(); 451 String descVal = (String )descField.getText(); 452 String enabledVal = (String )enabledComboBox.getSelectedItem(); 453 454 fields = groups[0].getField(); 455 for(int j=0; j<fields.length; j++){ 456 String fieldName = fields[j].getName(); 457 Object value = data.get(fieldName); 458 if (value == null) { 459 value = FieldHelper.getDefaultValue(fields[j]); 460 data.set(fieldName, value); 461 } 462 463 String defValue = (String )value; 464 if(FieldHelper.isList(fields[j])){ 465 if(! enabledVal.equals(defValue)){ 466 enabledComboBox.setSelectedItem(defValue); 467 } 468 }else{ 469 if(fieldName.equals("jndi-name") && (! jndiNameVal.equals(defValue)) ){ String targetFile = data.getTargetFile(); 471 if(targetFile != null){ 472 jndiNameField.setText(targetFile); 473 }else 474 jndiNameField.setText(defValue); 475 }else if(! jndiNameVal.equals(defValue)){ 476 descField.setText(defValue); 477 } 478 } 479 } 480 481 String isResTypeSelected = this.helper.getData().getString(__ResType); 482 if(isResTypeSelected == null || isResTypeSelected.trim().equals("") ){ this.queueRadioButton.setSelected(true); 484 this.helper.getData().setString(__ResType, bundle.getString("LBL_AdminObject_Queue")); setPropsForAdminObj(); 486 } 487 } 488 489 public JMSWizardVisualPanel setFirstTime(boolean first) { 490 return this; 492 } 493 494 private void initFields(){ 495 fields = groups[0].getField(); 496 for(int j=0; j<fields.length; j++){ 497 if(FieldHelper.isList(fields[j])){ 498 String tags[] = FieldHelper.getTags(fields[j]); 499 for (int h = 0; h < tags.length; h++) { 500 enabledComboBox.addItem(tags[h]); 501 } 502 } 503 } } 505 506 public void setHelper(ResourceConfigHelper helper){ 507 this.helper = helper; 508 this.helper.getData().setString("jndi-name", helper.getData().getTargetFile()); refreshFields(); 510 } 511 512 private void setPropsForAdminObj() { 513 ResourceConfigData data = this.helper.getData(); 514 data.setProperties(new Vector ()); 515 data.addProperty(__AdminObjPropertyName, ""); } 517 518 private javax.swing.JLabel adObjLabel; 520 private javax.swing.ButtonGroup buttonGroup1; 521 private javax.swing.JLabel chooseResLabel; 522 private javax.swing.JLabel connLabel; 523 private javax.swing.JRadioButton connectionFactoryRadioButton; 524 private javax.swing.JTextField descField; 525 private javax.swing.JLabel descLabel; 526 private javax.swing.JComboBox enabledComboBox; 527 private javax.swing.JLabel enabledLabel; 528 private javax.swing.JPanel jPanel2; 529 private javax.swing.JPanel jPanel3; 530 private javax.swing.JTextArea jTextArea1; 531 private javax.swing.JTextField jndiNameField; 532 private javax.swing.JLabel jndiNameLabel; 533 private javax.swing.JRadioButton queueConnectionRadioButton; 534 private javax.swing.JRadioButton queueRadioButton; 535 private javax.swing.JRadioButton topicConnectionRadioButton; 536 private javax.swing.JRadioButton topicRadioButton; 537 539 } 540 | Popular Tags |