KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ide > sunresources > wizards > JMSWizardVisualPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * JMSWizardVisualPanel.java
21  *
22  * Created on November 17, 2003, 11:23 AM
23  */

24
25 package org.netbeans.modules.j2ee.sun.ide.sunresources.wizards;
26
27 import java.util.Vector JavaDoc;
28 import org.openide.util.NbBundle;
29 import java.util.ResourceBundle JavaDoc;
30 import java.util.ArrayList JavaDoc;
31 import javax.swing.event.ChangeListener JavaDoc;
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 /**
39  *
40  * @author nityad
41  */

42 public class JMSWizardVisualPanel extends javax.swing.JPanel JavaDoc implements ChangeListener JavaDoc, WizardConstants{
43     
44     protected ResourceBundle JavaDoc bundle = NbBundle.getBundle("org.netbeans.modules.j2ee.sun.ide.sunresources.wizards.Bundle"); //NOI18N
45

46     protected final JMSWizardPanel panel;
47     protected ResourceConfigHelper helper;
48     
49     protected Field fields[] = null;
50     protected FieldGroup[] groups;
51            
52     protected ArrayList JavaDoc beans = new ArrayList JavaDoc();
53     protected boolean createNewResource = false;
54     private FieldGroup adminObjPropGroup;
55     
56       /** Creates new form JMSWizardVisualPanel */
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); //NOI18N
62

63         initComponents();
64         refreshFields();
65         
66         setName(NbBundle.getMessage(JMSWizardVisualPanel.class, "LBL_GeneralAttributes_JMS")); //NOI18N
67
}
68     
69     /** This method is called from within the constructor to
70      * initialize the form.
71      * WARNING: Do NOT modify this code. The content of this method is
72      * always regenerated by the Form Editor.
73      */

74     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
75
private void initComponents() {
76         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
77
78         buttonGroup1 = new javax.swing.ButtonGroup JavaDoc();
79         jPanel3 = new javax.swing.JPanel JavaDoc();
80         chooseResLabel = new javax.swing.JLabel JavaDoc();
81         queueConnectionRadioButton = new javax.swing.JRadioButton JavaDoc();
82         topicConnectionRadioButton = new javax.swing.JRadioButton JavaDoc();
83         queueRadioButton = new javax.swing.JRadioButton JavaDoc();
84         topicRadioButton = new javax.swing.JRadioButton JavaDoc();
85         adObjLabel = new javax.swing.JLabel JavaDoc();
86         connLabel = new javax.swing.JLabel JavaDoc();
87         connectionFactoryRadioButton = new javax.swing.JRadioButton JavaDoc();
88         jTextArea1 = new javax.swing.JTextArea JavaDoc();
89         jPanel2 = new javax.swing.JPanel JavaDoc();
90         jndiNameField = new javax.swing.JTextField JavaDoc();
91         enabledComboBox = new javax.swing.JComboBox JavaDoc();
92         descField = new javax.swing.JTextField JavaDoc();
93         jndiNameLabel = new javax.swing.JLabel JavaDoc();
94         enabledLabel = new javax.swing.JLabel JavaDoc();
95         descLabel = new javax.swing.JLabel JavaDoc();
96
97         setLayout(new java.awt.GridBagLayout JavaDoc());
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 JavaDoc());
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 JavaDoc();
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 JavaDoc(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 JavaDoc() {
119             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
120                 queueConnectionRadioButtonActionPerformed(evt);
121             }
122         });
123
124         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(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 JavaDoc() {
138             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
139                 topicConnectionRadioButtonActionPerformed(evt);
140             }
141         });
142
143         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(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 JavaDoc() {
156             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
157                 queueRadioButtonActionPerformed(evt);
158             }
159         });
160
161         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(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 JavaDoc() {
174             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
175                 topicRadioButtonActionPerformed(evt);
176             }
177         });
178
179         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(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 JavaDoc();
191         gridBagConstraints.gridx = 0;
192         gridBagConstraints.gridy = 1;
193         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
194         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc();
200         gridBagConstraints.gridx = 0;
201         gridBagConstraints.gridy = 4;
202         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
203         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc() {
212             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
213                 connectionFactoryRadioButtonActionPerformed(evt);
214             }
215         });
216
217         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(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 JavaDoc();
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 JavaDoc();
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 JavaDoc());
254
255         jndiNameField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
256             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
257                 jndiNameFieldActionPerformed(evt);
258             }
259         });
260         jndiNameField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
261             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
262                 jndiNameFieldKeyReleased(evt);
263             }
264         });
265
266         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
267         gridBagConstraints.gridx = 1;
268         gridBagConstraints.gridy = 0;
269         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
270         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc() {
277             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
278                 enabledComboBoxActionPerformed(evt);
279             }
280         });
281
282         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
283         gridBagConstraints.gridx = 1;
284         gridBagConstraints.gridy = 1;
285         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
286         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc() {
292             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
293                 descFieldActionPerformed(evt);
294             }
295         });
296         descField.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
297             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
298                 descFieldKeyReleased(evt);
299             }
300         });
301
302         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(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 JavaDoc();
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 JavaDoc(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 JavaDoc();
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 JavaDoc(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 JavaDoc();
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 JavaDoc(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 JavaDoc();
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     }// </editor-fold>//GEN-END:initComponents
360

361     private void connectionFactoryRadioButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_connectionFactoryRadioButtonActionPerformed
362
this.helper.getData().setString(__ResType, bundle.getString("LBL_Connector_ConnectionFactory")); //NOI18N
363
this.helper.getData().setProperties(new Vector JavaDoc());
364         this.panel.fireChange(evt.getSource());
365     }//GEN-LAST:event_connectionFactoryRadioButtonActionPerformed
366

367     private void topicConnectionRadioButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_topicConnectionRadioButtonActionPerformed
368
this.helper.getData().setString(__ResType, bundle.getString("LBL_Connector_TopicConnectionFactory")); //NOI18N
369
this.helper.getData().setProperties(new Vector JavaDoc());
370         this.panel.fireChange(evt.getSource());
371     }//GEN-LAST:event_topicConnectionRadioButtonActionPerformed
372

373     private void queueConnectionRadioButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_queueConnectionRadioButtonActionPerformed
374
this.helper.getData().setString(__ResType, bundle.getString("LBL_Connector_QueueConnectionFactory")); //NOI18N
375
this.helper.getData().setProperties(new Vector JavaDoc());
376         this.panel.fireChange(evt.getSource());
377     }//GEN-LAST:event_queueConnectionRadioButtonActionPerformed
378

379     private void topicRadioButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_topicRadioButtonActionPerformed
380
this.helper.getData().setString(__ResType, bundle.getString("LBL_AdminObject_Topic")); //NOI18N
381
setPropsForAdminObj();
382         this.panel.fireChange(evt.getSource());
383     }//GEN-LAST:event_topicRadioButtonActionPerformed
384

385     private void queueRadioButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_queueRadioButtonActionPerformed
386
this.helper.getData().setString(__ResType, bundle.getString("LBL_AdminObject_Queue")); //NOI18N
387
setPropsForAdminObj();
388         this.panel.fireChange(evt.getSource());
389     }//GEN-LAST:event_queueRadioButtonActionPerformed
390

391     private void descFieldKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_descFieldKeyReleased
392
ResourceConfigData data = this.helper.getData();
393         String JavaDoc value = data.getString(__Description);
394         String JavaDoc newValue = descField.getText();
395         if (!value.equals(newValue)) {
396             this.helper.getData().setString(__Description, newValue);
397         }
398         this.panel.fireChange(evt.getSource());
399     }//GEN-LAST:event_descFieldKeyReleased
400

401     private void descFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_descFieldActionPerformed
402
ResourceConfigData data = this.helper.getData();
403         String JavaDoc value = data.getString(__Description);
404         String JavaDoc 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     }//GEN-LAST:event_descFieldActionPerformed
414

415         
416     private void enabledComboBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_enabledComboBoxActionPerformed
417
String JavaDoc newValue = (String JavaDoc)enabledComboBox.getSelectedItem();
418         this.helper.getData().setString(__Enabled, newValue);
419     }//GEN-LAST:event_enabledComboBoxActionPerformed
420

421     private void jndiNameFieldKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_jndiNameFieldKeyReleased
422
ResourceConfigData data = this.helper.getData();
423         String JavaDoc value = data.getString(__JndiName);
424         String JavaDoc newValue = jndiNameField.getText();
425         if (!value.equals(newValue)) {
426             this.helper.getData().setString(__JndiName, newValue);
427         }
428         this.panel.fireChange(evt.getSource());
429     }//GEN-LAST:event_jndiNameFieldKeyReleased
430

431     private void jndiNameFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jndiNameFieldActionPerformed
432
ResourceConfigData data = this.helper.getData();
433         String JavaDoc value = data.getString(__JndiName);
434         String JavaDoc 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     }//GEN-LAST:event_jndiNameFieldActionPerformed
444

445     public void stateChanged(javax.swing.event.ChangeEvent JavaDoc e) {
446     }
447     
448      public void refreshFields() {
449         ResourceConfigData data = this.helper.getData();
450         String JavaDoc jndiNameVal = (String JavaDoc)jndiNameField.getText();
451         String JavaDoc descVal = (String JavaDoc)descField.getText();
452         String JavaDoc enabledVal = (String JavaDoc)enabledComboBox.getSelectedItem();
453         
454         fields = groups[0].getField();
455         for(int j=0; j<fields.length; j++){
456             String JavaDoc fieldName = fields[j].getName();
457             Object JavaDoc value = data.get(fieldName);
458             if (value == null) {
459                 value = FieldHelper.getDefaultValue(fields[j]);
460                 data.set(fieldName, value);
461             }
462             
463             String JavaDoc defValue = (String JavaDoc)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)) ){ //NOI18N
470
String JavaDoc 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 JavaDoc isResTypeSelected = this.helper.getData().getString(__ResType);
482         if(isResTypeSelected == null || isResTypeSelected.trim().equals("") ){//NOI18N
483
this.queueRadioButton.setSelected(true);
484             this.helper.getData().setString(__ResType, bundle.getString("LBL_AdminObject_Queue")); //NOI18N
485
setPropsForAdminObj();
486         }
487      }
488      
489      public JMSWizardVisualPanel setFirstTime(boolean first) {
490          //this.firstTime = first;
491
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 JavaDoc tags[] = FieldHelper.getTags(fields[j]);
499                  for (int h = 0; h < tags.length; h++) {
500                      enabledComboBox.addItem(tags[h]);
501                  }
502              }
503          }//for
504
}
505      
506      public void setHelper(ResourceConfigHelper helper){
507          this.helper = helper;
508          this.helper.getData().setString("jndi-name", helper.getData().getTargetFile()); //NOI18N
509
refreshFields();
510      }
511      
512      private void setPropsForAdminObj() {
513         ResourceConfigData data = this.helper.getData();
514         data.setProperties(new Vector JavaDoc());
515         data.addProperty(__AdminObjPropertyName, ""); //NOI18N
516
}
517      
518     // Variables declaration - do not modify//GEN-BEGIN:variables
519
private javax.swing.JLabel JavaDoc adObjLabel;
520     private javax.swing.ButtonGroup JavaDoc buttonGroup1;
521     private javax.swing.JLabel JavaDoc chooseResLabel;
522     private javax.swing.JLabel JavaDoc connLabel;
523     private javax.swing.JRadioButton JavaDoc connectionFactoryRadioButton;
524     private javax.swing.JTextField JavaDoc descField;
525     private javax.swing.JLabel JavaDoc descLabel;
526     private javax.swing.JComboBox JavaDoc enabledComboBox;
527     private javax.swing.JLabel JavaDoc enabledLabel;
528     private javax.swing.JPanel JavaDoc jPanel2;
529     private javax.swing.JPanel JavaDoc jPanel3;
530     private javax.swing.JTextArea JavaDoc jTextArea1;
531     private javax.swing.JTextField JavaDoc jndiNameField;
532     private javax.swing.JLabel JavaDoc jndiNameLabel;
533     private javax.swing.JRadioButton JavaDoc queueConnectionRadioButton;
534     private javax.swing.JRadioButton JavaDoc queueRadioButton;
535     private javax.swing.JRadioButton JavaDoc topicConnectionRadioButton;
536     private javax.swing.JRadioButton JavaDoc topicRadioButton;
537     // End of variables declaration//GEN-END:variables
538

539 }
540
Popular Tags