KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ddloaders > web > multiview > EjbRefPanel


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 package org.netbeans.modules.j2ee.ddloaders.web.multiview;
21
22 /**
23  * EjbRefPanel.java
24  * Panel for adding/editing EJB references and/or EJB local references
25  *
26  * Created on April 13, 2005
27  * @author mkuchtiak
28  */

29 public class EjbRefPanel extends javax.swing.JPanel JavaDoc {
30
31     /** Creates new form ResRefPanel */
32     public EjbRefPanel() {
33         initComponents();
34         org.netbeans.modules.xml.multiview.Utils.makeTextAreaLikeTextField(descriptionTA, nameTF);
35     }
36
37     void setEjbName(String JavaDoc name) {
38         nameTF.setText(name);
39     }
40
41     void setBeanType(String JavaDoc value) {
42         beanTypeCB.setSelectedItem(value);
43     }
44     
45     void setInterfaceType(String JavaDoc value) {
46         interfaceTypeCB.setSelectedItem(value);
47     }
48     
49     void setHome(String JavaDoc value) {
50         homeTF.setText(value);
51     }
52     
53     void setInterface(String JavaDoc value) {
54         interfaceTF.setText(value);
55     }
56     
57     void setLink(String JavaDoc value) {
58         linkTF.setText(value);
59     }
60     
61     void setDescription(String JavaDoc value) {
62         descriptionTA.setText(value);
63     }
64     
65     String JavaDoc getEjbName() {
66         return nameTF.getText();
67     }
68     
69     String JavaDoc getBeanType() {
70         return (String JavaDoc)beanTypeCB.getSelectedItem();
71     }
72     
73     String JavaDoc getInterfaceType() {
74         return (String JavaDoc)interfaceTypeCB.getSelectedItem();
75     }
76     
77     String JavaDoc getHome() {
78         return homeTF.getText();
79     }
80
81     String JavaDoc getInterface() {
82         return interfaceTF.getText();
83     }
84     
85     String JavaDoc getLink() {
86         return linkTF.getText();
87     }
88     
89     String JavaDoc getDescription() {
90         return descriptionTA.getText();
91     }
92     
93     javax.swing.JTextField JavaDoc getNameTF() {
94         return nameTF;
95     }
96     
97     javax.swing.JTextField JavaDoc getHomeTF() {
98         return homeTF;
99     }
100     
101     javax.swing.JTextField JavaDoc getInterfaceTF() {
102         return interfaceTF;
103     }
104     
105     javax.swing.JComboBox JavaDoc getInterfaceTypeCB() {
106         return interfaceTypeCB;
107     }
108     
109     /** This method is called from within the constructor to
110      * initialize the form.
111      * WARNING: Do NOT modify this code. The content of this method is
112      * always regenerated by the Form Editor.
113      */

114     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
115
private void initComponents() {
116         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
117
118         buttonGroup1 = new javax.swing.ButtonGroup JavaDoc();
119         nameLabel = new javax.swing.JLabel JavaDoc();
120         nameTF = new javax.swing.JTextField JavaDoc();
121         beanTypeLabel = new javax.swing.JLabel JavaDoc();
122         beanTypeCB = new javax.swing.JComboBox JavaDoc();
123         interfaceTypeLabel = new javax.swing.JLabel JavaDoc();
124         interfaceTypeCB = new javax.swing.JComboBox JavaDoc();
125         homeLabel = new javax.swing.JLabel JavaDoc();
126         homeTF = new javax.swing.JTextField JavaDoc();
127         interfaceLabel = new javax.swing.JLabel JavaDoc();
128         interfaceTF = new javax.swing.JTextField JavaDoc();
129         linkLabel = new javax.swing.JLabel JavaDoc();
130         linkTF = new javax.swing.JTextField JavaDoc();
131         descriptionLabel = new javax.swing.JLabel JavaDoc();
132         descriptionTA = new javax.swing.JTextArea JavaDoc();
133
134         setLayout(new java.awt.GridBagLayout JavaDoc());
135
136         nameLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbRefName_mnem").charAt(0));
137         nameLabel.setLabelFor(nameTF);
138         nameLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbRefName"));
139         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
140         gridBagConstraints.gridx = 0;
141         gridBagConstraints.gridy = 0;
142         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
143         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
144         add(nameLabel, gridBagConstraints);
145
146         nameTF.setColumns(30);
147         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
148         gridBagConstraints.gridx = 1;
149         gridBagConstraints.gridy = 0;
150         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
151         gridBagConstraints.weightx = 1.0;
152         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 12);
153         add(nameTF, gridBagConstraints);
154
155         beanTypeLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbRefType_mnem").charAt(0));
156         beanTypeLabel.setLabelFor(beanTypeCB);
157         beanTypeLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbRefType"));
158         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
159         gridBagConstraints.gridx = 0;
160         gridBagConstraints.gridy = 1;
161         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
162         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
163         add(beanTypeLabel, gridBagConstraints);
164
165         beanTypeCB.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "Session", "Entity" }));
166         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
167         gridBagConstraints.gridx = 1;
168         gridBagConstraints.gridy = 1;
169         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
170         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
171         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 12);
172         add(beanTypeCB, gridBagConstraints);
173
174         interfaceTypeLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbInterfaceType_mnem").charAt(0));
175         interfaceTypeLabel.setLabelFor(interfaceTypeCB);
176         interfaceTypeLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbInterfaceType"));
177         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
178         gridBagConstraints.gridx = 0;
179         gridBagConstraints.gridy = 2;
180         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
181         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
182         add(interfaceTypeLabel, gridBagConstraints);
183
184         interfaceTypeCB.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "Remote", "Local" }));
185         interfaceTypeCB.addItemListener(new java.awt.event.ItemListener JavaDoc() {
186             public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
187                 interfaceTypeCBItemStateChanged(evt);
188             }
189         });
190
191         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
192         gridBagConstraints.gridx = 1;
193         gridBagConstraints.gridy = 2;
194         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
195         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
196         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 12);
197         add(interfaceTypeCB, gridBagConstraints);
198
199         homeLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbHome_mnem").charAt(0));
200         homeLabel.setLabelFor(homeTF);
201         homeLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbHome"));
202         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
203         gridBagConstraints.gridx = 0;
204         gridBagConstraints.gridy = 3;
205         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
206         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
207         add(homeLabel, gridBagConstraints);
208
209         homeTF.setColumns(20);
210         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
211         gridBagConstraints.gridx = 1;
212         gridBagConstraints.gridy = 3;
213         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
214         gridBagConstraints.weightx = 1.0;
215         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 12);
216         add(homeTF, gridBagConstraints);
217
218         interfaceLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbInterface_mnem").charAt(0));
219         interfaceLabel.setLabelFor(interfaceTF);
220         interfaceLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbRemote"));
221         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
222         gridBagConstraints.gridx = 0;
223         gridBagConstraints.gridy = 4;
224         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
225         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
226         add(interfaceLabel, gridBagConstraints);
227
228         interfaceTF.setColumns(20);
229         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
230         gridBagConstraints.gridx = 1;
231         gridBagConstraints.gridy = 4;
232         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
233         gridBagConstraints.weightx = 1.0;
234         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 12);
235         add(interfaceTF, gridBagConstraints);
236
237         linkLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbLink_mnem").charAt(0));
238         linkLabel.setLabelFor(linkTF);
239         linkLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbLink"));
240         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
241         gridBagConstraints.gridx = 0;
242         gridBagConstraints.gridy = 5;
243         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
244         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
245         add(linkLabel, gridBagConstraints);
246
247         linkTF.setColumns(20);
248         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
249         gridBagConstraints.gridx = 1;
250         gridBagConstraints.gridy = 5;
251         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
252         gridBagConstraints.weightx = 1.0;
253         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 12);
254         add(linkTF, gridBagConstraints);
255
256         descriptionLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_description_mnem").charAt(0));
257         descriptionLabel.setLabelFor(descriptionTA);
258         descriptionLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_description"));
259         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
260         gridBagConstraints.gridx = 0;
261         gridBagConstraints.gridy = 6;
262         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
263         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 0);
264         add(descriptionLabel, gridBagConstraints);
265
266         descriptionTA.setRows(3);
267         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
268         gridBagConstraints.gridx = 1;
269         gridBagConstraints.gridy = 6;
270         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
271         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 12, 0, 12);
272         add(descriptionTA, gridBagConstraints);
273
274     }
275     // </editor-fold>//GEN-END:initComponents
276

277     private void interfaceTypeCBItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_interfaceTypeCBItemStateChanged
278
// TODO add your handling code here:
279
if ("Remote".equals(interfaceTypeCB.getSelectedItem())) { //NOI18N
280
interfaceLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbRemote"));
281         } else {
282             interfaceLabel.setText(org.openide.util.NbBundle.getMessage(EjbRefPanel.class, "LBL_EjbLocal"));
283         }
284     }//GEN-LAST:event_interfaceTypeCBItemStateChanged
285

286     
287     // Variables declaration - do not modify//GEN-BEGIN:variables
288
private javax.swing.JComboBox JavaDoc beanTypeCB;
289     private javax.swing.JLabel JavaDoc beanTypeLabel;
290     private javax.swing.ButtonGroup JavaDoc buttonGroup1;
291     private javax.swing.JLabel JavaDoc descriptionLabel;
292     private javax.swing.JTextArea JavaDoc descriptionTA;
293     private javax.swing.JLabel JavaDoc homeLabel;
294     private javax.swing.JTextField JavaDoc homeTF;
295     private javax.swing.JLabel JavaDoc interfaceLabel;
296     private javax.swing.JTextField JavaDoc interfaceTF;
297     private javax.swing.JComboBox JavaDoc interfaceTypeCB;
298     private javax.swing.JLabel JavaDoc interfaceTypeLabel;
299     private javax.swing.JLabel JavaDoc linkLabel;
300     private javax.swing.JTextField JavaDoc linkTF;
301     private javax.swing.JLabel JavaDoc nameLabel;
302     private javax.swing.JTextField JavaDoc nameTF;
303     // End of variables declaration//GEN-END:variables
304

305 }
306
Popular Tags