KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > websphere6 > dd > loaders > ui > ReferencePanel


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 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ui;
20
21 import javax.swing.DefaultComboBoxModel JavaDoc;
22 import org.netbeans.modules.j2ee.websphere6.dd.beans.*;
23 import org.netbeans.modules.j2ee.websphere6.dd.loaders.webext.*;
24 import org.netbeans.modules.xml.multiview.*;
25 import org.netbeans.modules.xml.multiview.ui.*;
26
27 /**
28  *
29  * @author dlm198383
30  */

31 public class ReferencePanel extends javax.swing.JPanel JavaDoc implements DDXmiConstants{
32     CommonRef ref;
33
34
35     /** Creates new form PagePanel */
36     public ReferencePanel(CommonRef ref) {
37         this.ref=ref;
38         initComponents();
39         typeComboBox.setModel(new DefaultComboBoxModel JavaDoc(BINDING_REFERENCE_TYPES));
40         if(ref!=null) {
41             idField.setText(ref.getXmiId());
42             jndiNameField.setText(ref.getJndiName());
43             hrefField.setText(ref.getHref());
44             if(ref instanceof ResRefBindingsType) {
45                 typeComboBox.setSelectedIndex(0);
46             } else if(ref instanceof EjbRefBindingsType) {
47                 typeComboBox.setSelectedIndex(1);
48             } else if(ref instanceof ResEnvRefBindingsType) {
49                 typeComboBox.setSelectedIndex(2);
50             }
51             typeComboBox.setEnabled(false);
52         }
53         
54     }
55     
56     public ReferencePanel() {
57         initComponents();
58         typeComboBox.setModel(new DefaultComboBoxModel JavaDoc(BINDING_REFERENCE_TYPES));
59         typeComboBox.setEnabled(true);
60     }
61     
62     /** This method is called from within the constructor to
63      * initialize the form.
64      * WARNING: Do NOT modify this code. The content of this method is
65      * always regenerated by the Form Editor.
66      */

67     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
68
private void initComponents() {
69         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
70
71         idLabel = new javax.swing.JLabel JavaDoc();
72         jndiNameLabel = new javax.swing.JLabel JavaDoc();
73         hrefLabel = new javax.swing.JLabel JavaDoc();
74         idField = new javax.swing.JTextField JavaDoc();
75         jndiNameField = new javax.swing.JTextField JavaDoc();
76         hrefField = new javax.swing.JTextField JavaDoc();
77         jLabel1 = new javax.swing.JLabel JavaDoc();
78         typeComboBox = new javax.swing.JComboBox JavaDoc();
79
80         setLayout(new java.awt.GridBagLayout JavaDoc());
81
82         idLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
83         idLabel.setText("ID:");
84         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
85         gridBagConstraints.gridx = 0;
86         gridBagConstraints.gridy = 1;
87         gridBagConstraints.ipadx = 28;
88         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
89         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 20, 0, 5);
90         add(idLabel, gridBagConstraints);
91
92         jndiNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
93         jndiNameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_JNDI_Name"));
94         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
95         gridBagConstraints.gridx = 0;
96         gridBagConstraints.gridy = 2;
97         gridBagConstraints.ipadx = 14;
98         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
99         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 17, 0, 5);
100         add(jndiNameLabel, gridBagConstraints);
101
102         hrefLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
103         hrefLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_EjbJarId"));
104         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
105         gridBagConstraints.gridx = 0;
106         gridBagConstraints.gridy = 3;
107         gridBagConstraints.ipadx = 14;
108         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
109         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 17, 0, 5);
110         add(hrefLabel, gridBagConstraints);
111
112         idField.setColumns(20);
113         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
114         gridBagConstraints.gridx = 10;
115         gridBagConstraints.gridy = 1;
116         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
117         gridBagConstraints.weightx = 1.0;
118         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 10);
119         add(idField, gridBagConstraints);
120
121         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
122         gridBagConstraints.gridx = 10;
123         gridBagConstraints.gridy = 2;
124         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
125         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 10);
126         add(jndiNameField, gridBagConstraints);
127
128         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
129         gridBagConstraints.gridx = 10;
130         gridBagConstraints.gridy = 3;
131         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
132         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 10);
133         add(hrefField, gridBagConstraints);
134
135         jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_ReferenceType"));
136         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
137         gridBagConstraints.gridx = 0;
138         gridBagConstraints.gridy = 0;
139         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
140         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 17, 0, 5);
141         add(jLabel1, gridBagConstraints);
142
143         typeComboBox.setOpaque(false);
144         typeComboBox.setPreferredSize(new java.awt.Dimension JavaDoc(200, 22));
145         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
146         gridBagConstraints.gridx = 10;
147         gridBagConstraints.gridy = 0;
148         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
149         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 10);
150         add(typeComboBox, gridBagConstraints);
151
152     }// </editor-fold>//GEN-END:initComponents
153

154     
155     // Variables declaration - do not modify//GEN-BEGIN:variables
156
private javax.swing.JTextField JavaDoc hrefField;
157     private javax.swing.JLabel JavaDoc hrefLabel;
158     private javax.swing.JTextField JavaDoc idField;
159     private javax.swing.JLabel JavaDoc idLabel;
160     private javax.swing.JLabel JavaDoc jLabel1;
161     private javax.swing.JTextField JavaDoc jndiNameField;
162     private javax.swing.JLabel JavaDoc jndiNameLabel;
163     private javax.swing.JComboBox JavaDoc typeComboBox;
164     // End of variables declaration//GEN-END:variables
165
public javax.swing.JTextField JavaDoc getIdField() {
166         return idField;
167     }
168     public javax.swing.JTextField JavaDoc getJndiNameField() {
169         return jndiNameField;
170     }
171     public javax.swing.JTextField JavaDoc getHrefField() {
172         return hrefField;
173     }
174     public javax.swing.JComboBox JavaDoc getTypeComboBox() {
175         return typeComboBox;
176     }
177 }
178
Popular Tags