001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: /*
042: * JMSWizardVisualPanel.java
043: *
044: * Created on November 17, 2003, 11:23 AM
045: */
046:
047: package org.netbeans.modules.j2ee.sun.ide.sunresources.wizards;
048:
049: import java.util.Vector;
050: import org.openide.util.NbBundle;
051: import java.util.ResourceBundle;
052: import java.util.ArrayList;
053: import javax.swing.event.ChangeListener;
054:
055: import org.netbeans.modules.j2ee.sun.sunresources.beans.Field;
056: import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldGroup;
057: import org.netbeans.modules.j2ee.sun.sunresources.beans.WizardConstants;
058: import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldHelper;
059:
060: /**
061: *
062: * @author nityad
063: */
064: public class JMSWizardVisualPanel extends javax.swing.JPanel implements
065: ChangeListener, WizardConstants {
066:
067: protected ResourceBundle bundle = NbBundle
068: .getBundle("org.netbeans.modules.j2ee.sun.ide.sunresources.wizards.Bundle"); //NOI18N
069:
070: protected final JMSWizardPanel panel;
071: protected ResourceConfigHelper helper;
072:
073: protected Field fields[] = null;
074: protected FieldGroup[] groups;
075:
076: protected ArrayList beans = new ArrayList();
077: protected boolean createNewResource = false;
078: private FieldGroup adminObjPropGroup;
079:
080: /** Creates new form JMSWizardVisualPanel */
081: public JMSWizardVisualPanel(JMSWizardPanel panel,
082: FieldGroup[] groups) {
083: this .panel = panel;
084: this .helper = panel.getHelper();
085: this .groups = groups;
086: this .adminObjPropGroup = panel.getFieldGroup(__Properties2); //NOI18N
087:
088: initComponents();
089: refreshFields();
090:
091: setName(NbBundle.getMessage(JMSWizardVisualPanel.class,
092: "LBL_GeneralAttributes_JMS")); //NOI18N
093: }
094:
095: /** This method is called from within the constructor to
096: * initialize the form.
097: * WARNING: Do NOT modify this code. The content of this method is
098: * always regenerated by the Form Editor.
099: */
100: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
101: private void initComponents() {
102: java.awt.GridBagConstraints gridBagConstraints;
103:
104: buttonGroup1 = new javax.swing.ButtonGroup();
105: jPanel3 = new javax.swing.JPanel();
106: chooseResLabel = new javax.swing.JLabel();
107: queueConnectionRadioButton = new javax.swing.JRadioButton();
108: topicConnectionRadioButton = new javax.swing.JRadioButton();
109: queueRadioButton = new javax.swing.JRadioButton();
110: topicRadioButton = new javax.swing.JRadioButton();
111: adObjLabel = new javax.swing.JLabel();
112: connLabel = new javax.swing.JLabel();
113: connectionFactoryRadioButton = new javax.swing.JRadioButton();
114: jTextArea1 = new javax.swing.JTextArea();
115: jPanel2 = new javax.swing.JPanel();
116: jndiNameField = new javax.swing.JTextField();
117: enabledComboBox = new javax.swing.JComboBox();
118: descField = new javax.swing.JTextField();
119: jndiNameLabel = new javax.swing.JLabel();
120: enabledLabel = new javax.swing.JLabel();
121: descLabel = new javax.swing.JLabel();
122:
123: setLayout(new java.awt.GridBagLayout());
124:
125: getAccessibleContext()
126: .setAccessibleName(
127: java.util.ResourceBundle
128: .getBundle(
129: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
130: .getString("LBL_GeneralAttributes_JMS"));
131: getAccessibleContext()
132: .setAccessibleDescription(
133: java.util.ResourceBundle
134: .getBundle(
135: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
136: .getString("jms-resource_Description"));
137: jPanel3.setLayout(new java.awt.GridBagLayout());
138:
139: chooseResLabel
140: .setText(java.util.ResourceBundle
141: .getBundle(
142: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
143: .getString("LBL_resource-type"));
144: chooseResLabel.setFocusable(false);
145: gridBagConstraints = new java.awt.GridBagConstraints();
146: gridBagConstraints.gridx = 0;
147: gridBagConstraints.gridy = 0;
148: gridBagConstraints.gridwidth = 2;
149: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
150: gridBagConstraints.weightx = 1.0;
151: gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 0);
152: jPanel3.add(chooseResLabel, gridBagConstraints);
153: chooseResLabel
154: .getAccessibleContext()
155: .setAccessibleDescription(
156: java.util.ResourceBundle
157: .getBundle(
158: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
159: .getString("ToolTip_resource-type"));
160:
161: buttonGroup1.add(queueConnectionRadioButton);
162: queueConnectionRadioButton
163: .setMnemonic(java.util.ResourceBundle
164: .getBundle(
165: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
166: .getString(
167: "LBL_Connector_QueueConnectionFactory_Mnemonic")
168: .charAt(0));
169: queueConnectionRadioButton
170: .setText(java.util.ResourceBundle
171: .getBundle(
172: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
173: .getString(
174: "LBL_Connector_QueueConnectionFactory"));
175: queueConnectionRadioButton
176: .addActionListener(new java.awt.event.ActionListener() {
177: public void actionPerformed(
178: java.awt.event.ActionEvent evt) {
179: queueConnectionRadioButtonActionPerformed(evt);
180: }
181: });
182:
183: gridBagConstraints = new java.awt.GridBagConstraints();
184: gridBagConstraints.gridx = 1;
185: gridBagConstraints.gridy = 5;
186: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
187: gridBagConstraints.ipadx = 3;
188: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
189: gridBagConstraints.insets = new java.awt.Insets(0, 30, 0, 30);
190: jPanel3.add(queueConnectionRadioButton, gridBagConstraints);
191: queueConnectionRadioButton
192: .getAccessibleContext()
193: .setAccessibleDescription(
194: java.util.ResourceBundle
195: .getBundle(
196: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
197: .getString(
198: "ToolTip_Connector_QueueConnectionFactory"));
199:
200: buttonGroup1.add(topicConnectionRadioButton);
201: topicConnectionRadioButton
202: .setMnemonic(java.util.ResourceBundle
203: .getBundle(
204: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
205: .getString(
206: "LBL_Connector_TopicConnectionFactory_Mnemonic")
207: .charAt(0));
208: topicConnectionRadioButton
209: .setText(java.util.ResourceBundle
210: .getBundle(
211: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
212: .getString(
213: "LBL_Connector_TopicConnectionFactory"));
214: topicConnectionRadioButton
215: .addActionListener(new java.awt.event.ActionListener() {
216: public void actionPerformed(
217: java.awt.event.ActionEvent evt) {
218: topicConnectionRadioButtonActionPerformed(evt);
219: }
220: });
221:
222: gridBagConstraints = new java.awt.GridBagConstraints();
223: gridBagConstraints.gridx = 1;
224: gridBagConstraints.gridy = 6;
225: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
226: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
227: gridBagConstraints.insets = new java.awt.Insets(0, 30, 0, 30);
228: jPanel3.add(topicConnectionRadioButton, gridBagConstraints);
229: topicConnectionRadioButton
230: .getAccessibleContext()
231: .setAccessibleDescription(
232: java.util.ResourceBundle
233: .getBundle(
234: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
235: .getString(
236: "ToolTip_Connector_TopicConnectionFactory"));
237:
238: buttonGroup1.add(queueRadioButton);
239: queueRadioButton
240: .setMnemonic(java.util.ResourceBundle
241: .getBundle(
242: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
243: .getString("LBL_AdminObject_Queue_Mnemonic")
244: .charAt(0));
245: queueRadioButton
246: .setText(java.util.ResourceBundle
247: .getBundle(
248: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
249: .getString("LBL_AdminObject_Queue"));
250: queueRadioButton
251: .addActionListener(new java.awt.event.ActionListener() {
252: public void actionPerformed(
253: java.awt.event.ActionEvent evt) {
254: queueRadioButtonActionPerformed(evt);
255: }
256: });
257:
258: gridBagConstraints = new java.awt.GridBagConstraints();
259: gridBagConstraints.gridx = 1;
260: gridBagConstraints.gridy = 2;
261: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
262: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
263: gridBagConstraints.insets = new java.awt.Insets(0, 30, 0, 30);
264: jPanel3.add(queueRadioButton, gridBagConstraints);
265: queueRadioButton
266: .getAccessibleContext()
267: .setAccessibleDescription(
268: java.util.ResourceBundle
269: .getBundle(
270: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
271: .getString("ToolTip_AdminObject_Queue"));
272:
273: buttonGroup1.add(topicRadioButton);
274: topicRadioButton
275: .setMnemonic(java.util.ResourceBundle
276: .getBundle(
277: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
278: .getString("LBL_AdminObject_Topic_Mnemonic")
279: .charAt(0));
280: topicRadioButton
281: .setText(java.util.ResourceBundle
282: .getBundle(
283: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
284: .getString("LBL_AdminObject_Topic"));
285: topicRadioButton
286: .addActionListener(new java.awt.event.ActionListener() {
287: public void actionPerformed(
288: java.awt.event.ActionEvent evt) {
289: topicRadioButtonActionPerformed(evt);
290: }
291: });
292:
293: gridBagConstraints = new java.awt.GridBagConstraints();
294: gridBagConstraints.gridx = 1;
295: gridBagConstraints.gridy = 3;
296: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
297: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
298: gridBagConstraints.insets = new java.awt.Insets(0, 30, 10, 30);
299: jPanel3.add(topicRadioButton, gridBagConstraints);
300: topicRadioButton
301: .getAccessibleContext()
302: .setAccessibleDescription(
303: java.util.ResourceBundle
304: .getBundle(
305: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
306: .getString("ToolTip_AdminObject_Topic"));
307:
308: adObjLabel
309: .setText(java.util.ResourceBundle
310: .getBundle(
311: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
312: .getString("LBL_jms-admin-object"));
313: adObjLabel.setFocusable(false);
314: gridBagConstraints = new java.awt.GridBagConstraints();
315: gridBagConstraints.gridx = 0;
316: gridBagConstraints.gridy = 1;
317: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
318: gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
319: jPanel3.add(adObjLabel, gridBagConstraints);
320: adObjLabel
321: .getAccessibleContext()
322: .setAccessibleDescription(
323: java.util.ResourceBundle
324: .getBundle(
325: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
326: .getString(
327: "jms-admin-object_Description"));
328:
329: connLabel
330: .setText(java.util.ResourceBundle
331: .getBundle(
332: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
333: .getString("LBL_jms-connector"));
334: gridBagConstraints = new java.awt.GridBagConstraints();
335: gridBagConstraints.gridx = 0;
336: gridBagConstraints.gridy = 4;
337: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
338: gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
339: jPanel3.add(connLabel, gridBagConstraints);
340: connLabel
341: .getAccessibleContext()
342: .setAccessibleDescription(
343: java.util.ResourceBundle
344: .getBundle(
345: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
346: .getString("jms-connector_Description"));
347:
348: buttonGroup1.add(connectionFactoryRadioButton);
349: connectionFactoryRadioButton
350: .setMnemonic(java.util.ResourceBundle
351: .getBundle(
352: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
353: .getString(
354: "LBL_Connector_ConnectionFactory_Mnemonic")
355: .charAt(0));
356: connectionFactoryRadioButton
357: .setText(java.util.ResourceBundle
358: .getBundle(
359: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
360: .getString("LBL_Connector_ConnectionFactory"));
361: connectionFactoryRadioButton
362: .setToolTipText(java.util.ResourceBundle
363: .getBundle(
364: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
365: .getString(
366: "ToolTip_Connector_ConnectionFactory"));
367: connectionFactoryRadioButton
368: .addActionListener(new java.awt.event.ActionListener() {
369: public void actionPerformed(
370: java.awt.event.ActionEvent evt) {
371: connectionFactoryRadioButtonActionPerformed(evt);
372: }
373: });
374:
375: gridBagConstraints = new java.awt.GridBagConstraints();
376: gridBagConstraints.gridx = 1;
377: gridBagConstraints.gridy = 7;
378: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
379: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
380: gridBagConstraints.insets = new java.awt.Insets(0, 30, 10, 30);
381: jPanel3.add(connectionFactoryRadioButton, gridBagConstraints);
382: connectionFactoryRadioButton
383: .getAccessibleContext()
384: .setAccessibleDescription(
385: java.util.ResourceBundle
386: .getBundle(
387: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
388: .getString(
389: "ToolTip_Connector_ConnectionFactory"));
390:
391: gridBagConstraints = new java.awt.GridBagConstraints();
392: gridBagConstraints.gridx = 0;
393: gridBagConstraints.gridy = 2;
394: gridBagConstraints.gridwidth = 2;
395: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
396: gridBagConstraints.weightx = 1.0;
397: gridBagConstraints.weighty = 0.1;
398: add(jPanel3, gridBagConstraints);
399: jPanel3
400: .getAccessibleContext()
401: .setAccessibleName(
402: java.util.ResourceBundle
403: .getBundle(
404: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
405: .getString("LBL_GeneralAttributes_JMS"));
406: jPanel3
407: .getAccessibleContext()
408: .setAccessibleDescription(
409: java.util.ResourceBundle
410: .getBundle(
411: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
412: .getString("jms-resource_Description"));
413:
414: jTextArea1.setEditable(false);
415: jTextArea1.setLineWrap(true);
416: jTextArea1
417: .setText(java.util.ResourceBundle
418: .getBundle(
419: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
420: .getString("jms-resource_Description"));
421: jTextArea1.setFocusable(false);
422: jTextArea1.setOpaque(false);
423: gridBagConstraints = new java.awt.GridBagConstraints();
424: gridBagConstraints.gridx = 0;
425: gridBagConstraints.gridy = 0;
426: gridBagConstraints.gridwidth = 2;
427: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
428: gridBagConstraints.weightx = 1.0;
429: gridBagConstraints.weighty = 0.5;
430: add(jTextArea1, gridBagConstraints);
431: jTextArea1
432: .getAccessibleContext()
433: .setAccessibleName(
434: java.util.ResourceBundle
435: .getBundle(
436: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
437: .getString("LBL_GeneralAttributes_JMS"));
438: jTextArea1
439: .getAccessibleContext()
440: .setAccessibleDescription(
441: java.util.ResourceBundle
442: .getBundle(
443: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
444: .getString("jms-resource_Description"));
445:
446: jPanel2.setLayout(new java.awt.GridBagLayout());
447:
448: jndiNameField
449: .addActionListener(new java.awt.event.ActionListener() {
450: public void actionPerformed(
451: java.awt.event.ActionEvent evt) {
452: jndiNameFieldActionPerformed(evt);
453: }
454: });
455: jndiNameField.addKeyListener(new java.awt.event.KeyAdapter() {
456: public void keyReleased(java.awt.event.KeyEvent evt) {
457: jndiNameFieldKeyReleased(evt);
458: }
459: });
460:
461: gridBagConstraints = new java.awt.GridBagConstraints();
462: gridBagConstraints.gridx = 1;
463: gridBagConstraints.gridy = 0;
464: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
465: gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
466: jPanel2.add(jndiNameField, gridBagConstraints);
467: jndiNameField
468: .getAccessibleContext()
469: .setAccessibleName(
470: java.util.ResourceBundle
471: .getBundle(
472: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
473: .getString("LBL_jndi-name"));
474: jndiNameField
475: .getAccessibleContext()
476: .setAccessibleDescription(
477: java.util.ResourceBundle
478: .getBundle(
479: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
480: .getString("ToolTip_jndi-name"));
481:
482: initFields();
483: enabledComboBox
484: .addActionListener(new java.awt.event.ActionListener() {
485: public void actionPerformed(
486: java.awt.event.ActionEvent evt) {
487: enabledComboBoxActionPerformed(evt);
488: }
489: });
490:
491: gridBagConstraints = new java.awt.GridBagConstraints();
492: gridBagConstraints.gridx = 1;
493: gridBagConstraints.gridy = 1;
494: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
495: gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
496: jPanel2.add(enabledComboBox, gridBagConstraints);
497: enabledComboBox
498: .getAccessibleContext()
499: .setAccessibleName(
500: java.util.ResourceBundle
501: .getBundle(
502: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
503: .getString("LBL_enabled"));
504: enabledComboBox
505: .getAccessibleContext()
506: .setAccessibleDescription(
507: java.util.ResourceBundle
508: .getBundle(
509: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
510: .getString("ToolTip_enabled"));
511:
512: descField
513: .addActionListener(new java.awt.event.ActionListener() {
514: public void actionPerformed(
515: java.awt.event.ActionEvent evt) {
516: descFieldActionPerformed(evt);
517: }
518: });
519: descField.addKeyListener(new java.awt.event.KeyAdapter() {
520: public void keyReleased(java.awt.event.KeyEvent evt) {
521: descFieldKeyReleased(evt);
522: }
523: });
524:
525: gridBagConstraints = new java.awt.GridBagConstraints();
526: gridBagConstraints.gridx = 1;
527: gridBagConstraints.gridy = 2;
528: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
529: gridBagConstraints.weightx = 1.0;
530: gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
531: jPanel2.add(descField, gridBagConstraints);
532: descField
533: .getAccessibleContext()
534: .setAccessibleName(
535: java.util.ResourceBundle
536: .getBundle(
537: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
538: .getString("LBL_description"));
539: descField
540: .getAccessibleContext()
541: .setAccessibleDescription(
542: java.util.ResourceBundle
543: .getBundle(
544: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
545: .getString("ToolTip_description"));
546:
547: jndiNameLabel
548: .setDisplayedMnemonic(java.util.ResourceBundle
549: .getBundle(
550: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
551: .getString("LBL_jndi-name_Mnemonic").charAt(0));
552: jndiNameLabel.setLabelFor(jndiNameField);
553: jndiNameLabel
554: .setText(java.util.ResourceBundle
555: .getBundle(
556: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
557: .getString("LBL_jndi-name"));
558: gridBagConstraints = new java.awt.GridBagConstraints();
559: gridBagConstraints.gridx = 0;
560: gridBagConstraints.gridy = 0;
561: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
562: gridBagConstraints.weightx = 1.0;
563: gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
564: jPanel2.add(jndiNameLabel, gridBagConstraints);
565: jndiNameLabel
566: .getAccessibleContext()
567: .setAccessibleDescription(
568: java.util.ResourceBundle
569: .getBundle(
570: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
571: .getString("ToolTip_jndi-name"));
572:
573: enabledLabel
574: .setDisplayedMnemonic(java.util.ResourceBundle
575: .getBundle(
576: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
577: .getString("LBL_enabled_Mnemonic").charAt(0));
578: enabledLabel.setLabelFor(enabledComboBox);
579: enabledLabel
580: .setText(java.util.ResourceBundle
581: .getBundle(
582: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
583: .getString("LBL_enabled"));
584: gridBagConstraints = new java.awt.GridBagConstraints();
585: gridBagConstraints.gridx = 0;
586: gridBagConstraints.gridy = 1;
587: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
588: gridBagConstraints.weightx = 1.0;
589: gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
590: jPanel2.add(enabledLabel, gridBagConstraints);
591: enabledLabel
592: .getAccessibleContext()
593: .setAccessibleDescription(
594: java.util.ResourceBundle
595: .getBundle(
596: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
597: .getString("ToolTip_enabled"));
598:
599: descLabel
600: .setDisplayedMnemonic(java.util.ResourceBundle
601: .getBundle(
602: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
603: .getString("LBL_description_Mnemonic")
604: .charAt(0));
605: descLabel.setLabelFor(descField);
606: descLabel
607: .setText(java.util.ResourceBundle
608: .getBundle(
609: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
610: .getString("LBL_description"));
611: gridBagConstraints = new java.awt.GridBagConstraints();
612: gridBagConstraints.gridx = 0;
613: gridBagConstraints.gridy = 2;
614: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
615: gridBagConstraints.weightx = 1.0;
616: gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
617: jPanel2.add(descLabel, gridBagConstraints);
618: descLabel
619: .getAccessibleContext()
620: .setAccessibleDescription(
621: java.util.ResourceBundle
622: .getBundle(
623: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
624: .getString("ToolTip_description"));
625:
626: gridBagConstraints = new java.awt.GridBagConstraints();
627: gridBagConstraints.gridx = 0;
628: gridBagConstraints.gridy = 1;
629: gridBagConstraints.gridwidth = 2;
630: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
631: gridBagConstraints.weightx = 1.0;
632: gridBagConstraints.weighty = 0.3;
633: add(jPanel2, gridBagConstraints);
634: jPanel2
635: .getAccessibleContext()
636: .setAccessibleName(
637: java.util.ResourceBundle
638: .getBundle(
639: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
640: .getString("LBL_GeneralAttributes_JMS"));
641: jPanel2
642: .getAccessibleContext()
643: .setAccessibleDescription(
644: java.util.ResourceBundle
645: .getBundle(
646: "org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle")
647: .getString("jms-resource_Description"));
648:
649: }// </editor-fold>//GEN-END:initComponents
650:
651: private void connectionFactoryRadioButtonActionPerformed(
652: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectionFactoryRadioButtonActionPerformed
653: this .helper.getData().setString(__ResType,
654: bundle.getString("LBL_Connector_ConnectionFactory")); //NOI18N
655: this .helper.getData().setProperties(new Vector());
656: this .panel.fireChange(evt.getSource());
657: }//GEN-LAST:event_connectionFactoryRadioButtonActionPerformed
658:
659: private void topicConnectionRadioButtonActionPerformed(
660: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_topicConnectionRadioButtonActionPerformed
661: this .helper
662: .getData()
663: .setString(
664: __ResType,
665: bundle
666: .getString("LBL_Connector_TopicConnectionFactory")); //NOI18N
667: this .helper.getData().setProperties(new Vector());
668: this .panel.fireChange(evt.getSource());
669: }//GEN-LAST:event_topicConnectionRadioButtonActionPerformed
670:
671: private void queueConnectionRadioButtonActionPerformed(
672: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queueConnectionRadioButtonActionPerformed
673: this .helper
674: .getData()
675: .setString(
676: __ResType,
677: bundle
678: .getString("LBL_Connector_QueueConnectionFactory")); //NOI18N
679: this .helper.getData().setProperties(new Vector());
680: this .panel.fireChange(evt.getSource());
681: }//GEN-LAST:event_queueConnectionRadioButtonActionPerformed
682:
683: private void topicRadioButtonActionPerformed(
684: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_topicRadioButtonActionPerformed
685: this .helper.getData().setString(__ResType,
686: bundle.getString("LBL_AdminObject_Topic")); //NOI18N
687: setPropsForAdminObj();
688: this .panel.fireChange(evt.getSource());
689: }//GEN-LAST:event_topicRadioButtonActionPerformed
690:
691: private void queueRadioButtonActionPerformed(
692: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queueRadioButtonActionPerformed
693: this .helper.getData().setString(__ResType,
694: bundle.getString("LBL_AdminObject_Queue")); //NOI18N
695: setPropsForAdminObj();
696: this .panel.fireChange(evt.getSource());
697: }//GEN-LAST:event_queueRadioButtonActionPerformed
698:
699: private void descFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_descFieldKeyReleased
700: ResourceConfigData data = this .helper.getData();
701: String value = data.getString(__Description);
702: String newValue = descField.getText();
703: if (!value.equals(newValue)) {
704: this .helper.getData().setString(__Description, newValue);
705: }
706: this .panel.fireChange(evt.getSource());
707: }//GEN-LAST:event_descFieldKeyReleased
708:
709: private void descFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_descFieldActionPerformed
710: ResourceConfigData data = this .helper.getData();
711: String value = data.getString(__Description);
712: String newValue = descField.getText();
713: if (!value.equals(newValue)) {
714: this .helper.getData().setString(__Description, newValue);
715: this .panel.fireChange(evt.getSource());
716: }
717:
718: if ((this .getRootPane().getDefaultButton() != null)
719: && (this .getRootPane().getDefaultButton().isEnabled())) {
720: this .getRootPane().getDefaultButton().doClick();
721: }
722: }//GEN-LAST:event_descFieldActionPerformed
723:
724: private void enabledComboBoxActionPerformed(
725: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enabledComboBoxActionPerformed
726: String newValue = (String) enabledComboBox.getSelectedItem();
727: this .helper.getData().setString(__Enabled, newValue);
728: }//GEN-LAST:event_enabledComboBoxActionPerformed
729:
730: private void jndiNameFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jndiNameFieldKeyReleased
731: ResourceConfigData data = this .helper.getData();
732: String value = data.getString(__JndiName);
733: String newValue = jndiNameField.getText();
734: if (!value.equals(newValue)) {
735: this .helper.getData().setString(__JndiName, newValue);
736: }
737: this .panel.fireChange(evt.getSource());
738: }//GEN-LAST:event_jndiNameFieldKeyReleased
739:
740: private void jndiNameFieldActionPerformed(
741: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jndiNameFieldActionPerformed
742: ResourceConfigData data = this .helper.getData();
743: String value = data.getString(__JndiName);
744: String newValue = jndiNameField.getText();
745: if (!value.equals(newValue)) {
746: this .helper.getData().setString(__JndiName, newValue);
747: this .panel.fireChange(evt.getSource());
748: }
749:
750: if ((this .getRootPane().getDefaultButton() != null)
751: && (this .getRootPane().getDefaultButton().isEnabled())) {
752: this .getRootPane().getDefaultButton().doClick();
753: }
754: }//GEN-LAST:event_jndiNameFieldActionPerformed
755:
756: public void stateChanged(javax.swing.event.ChangeEvent e) {
757: }
758:
759: public void refreshFields() {
760: ResourceConfigData data = this .helper.getData();
761: String jndiNameVal = (String) jndiNameField.getText();
762: String descVal = (String) descField.getText();
763: String enabledVal = (String) enabledComboBox.getSelectedItem();
764:
765: fields = groups[0].getField();
766: for (int j = 0; j < fields.length; j++) {
767: String fieldName = fields[j].getName();
768: Object value = data.get(fieldName);
769: if (value == null) {
770: value = FieldHelper.getDefaultValue(fields[j]);
771: data.set(fieldName, value);
772: }
773:
774: String defValue = (String) value;
775: if (FieldHelper.isList(fields[j])) {
776: if (!enabledVal.equals(defValue)) {
777: enabledComboBox.setSelectedItem(defValue);
778: }
779: } else {
780: if (fieldName.equals("jndi-name")
781: && (!jndiNameVal.equals(defValue))) { //NOI18N
782: String targetFile = data.getTargetFile();
783: if (targetFile != null) {
784: jndiNameField.setText(targetFile);
785: } else
786: jndiNameField.setText(defValue);
787: } else if (!jndiNameVal.equals(defValue)) {
788: descField.setText(defValue);
789: }
790: }
791: }
792:
793: String isResTypeSelected = this .helper.getData().getString(
794: __ResType);
795: if (isResTypeSelected == null
796: || isResTypeSelected.trim().equals("")) {//NOI18N
797: this .queueRadioButton.setSelected(true);
798: this .helper.getData().setString(__ResType,
799: bundle.getString("LBL_AdminObject_Queue")); //NOI18N
800: setPropsForAdminObj();
801: }
802: }
803:
804: public JMSWizardVisualPanel setFirstTime(boolean first) {
805: //this.firstTime = first;
806: return this ;
807: }
808:
809: private void initFields() {
810: fields = groups[0].getField();
811: for (int j = 0; j < fields.length; j++) {
812: if (FieldHelper.isList(fields[j])) {
813: String tags[] = FieldHelper.getTags(fields[j]);
814: for (int h = 0; h < tags.length; h++) {
815: enabledComboBox.addItem(tags[h]);
816: }
817: }
818: }//for
819: }
820:
821: public void setHelper(ResourceConfigHelper helper) {
822: this .helper = helper;
823: this .helper.getData().setString("jndi-name",
824: helper.getData().getTargetFile()); //NOI18N
825: refreshFields();
826: }
827:
828: private void setPropsForAdminObj() {
829: ResourceConfigData data = this .helper.getData();
830: data.setProperties(new Vector());
831: data.addProperty(__AdminObjPropertyName, ""); //NOI18N
832: }
833:
834: // Variables declaration - do not modify//GEN-BEGIN:variables
835: private javax.swing.JLabel adObjLabel;
836: private javax.swing.ButtonGroup buttonGroup1;
837: private javax.swing.JLabel chooseResLabel;
838: private javax.swing.JLabel connLabel;
839: private javax.swing.JRadioButton connectionFactoryRadioButton;
840: private javax.swing.JTextField descField;
841: private javax.swing.JLabel descLabel;
842: private javax.swing.JComboBox enabledComboBox;
843: private javax.swing.JLabel enabledLabel;
844: private javax.swing.JPanel jPanel2;
845: private javax.swing.JPanel jPanel3;
846: private javax.swing.JTextArea jTextArea1;
847: private javax.swing.JTextField jndiNameField;
848: private javax.swing.JLabel jndiNameLabel;
849: private javax.swing.JRadioButton queueConnectionRadioButton;
850: private javax.swing.JRadioButton queueRadioButton;
851: private javax.swing.JRadioButton topicConnectionRadioButton;
852: private javax.swing.JRadioButton topicRadioButton;
853: // End of variables declaration//GEN-END:variables
854:
855: }
|