~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to j2ee/ddloaders/src/org/netbeans/modules/j2ee/ddloaders/web/multiview/ResRefPanel.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
3
 *
 
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
5
 *
 
6
 * The contents of this file are subject to the terms of either the GNU
 
7
 * General Public License Version 2 only ("GPL") or the Common
 
8
 * Development and Distribution License("CDDL") (collectively, the
 
9
 * "License"). You may not use this file except in compliance with the
 
10
 * License. You can obtain a copy of the License at
 
11
 * http://www.netbeans.org/cddl-gplv2.html
 
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 
13
 * specific language governing permissions and limitations under the
 
14
 * License.  When distributing the software, include this License Header
 
15
 * Notice in each file and include the License file at
 
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 
17
 * particular file as subject to the "Classpath" exception as provided
 
18
 * by Sun in the GPL Version 2 section of the License file that
 
19
 * accompanied this code. If applicable, add the following below the
 
20
 * License Header, with the fields enclosed by brackets [] replaced by
 
21
 * your own identifying information:
 
22
 * "Portions Copyrighted [year] [name of copyright owner]"
 
23
 *
 
24
 * Contributor(s):
 
25
 *
 
26
 * The Original Software is NetBeans. The Initial Developer of the Original
 
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
 
28
 * Microsystems, Inc. All Rights Reserved.
 
29
 *
 
30
 * If you wish your version of this file to be governed by only the CDDL
 
31
 * or only the GPL Version 2, indicate your decision by adding
 
32
 * "[Contributor] elects to include this software in this distribution
 
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 
34
 * single choice of license, a recipient has the option to distribute
 
35
 * your version of this file under either the CDDL, the GPL Version 2 or
 
36
 * to extend the choice of license to its licensees as provided above.
 
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 
38
 * Version 2 license, then the option applies only if the new code is
 
39
 * made subject to such option by the copyright holder.
 
40
 */
 
41
 
 
42
package org.netbeans.modules.j2ee.ddloaders.web.multiview;
 
43
 
 
44
/**
 
45
 * ResRefPanel.java
 
46
 * Panel for adding/editing resource references
 
47
 *
 
48
 * Created on April 11, 2005
 
49
 * @author  mkuchtiak
 
50
 */
 
51
public class ResRefPanel extends javax.swing.JPanel {
 
52
 
 
53
    /** Creates new form ResRefPanel */
 
54
    public ResRefPanel() {
 
55
        initComponents();
 
56
        org.netbeans.modules.xml.multiview.Utils.makeTextAreaLikeTextField(descriptionTA, nameTF);
 
57
    }
 
58
 
 
59
    void setResRefName(String name) {
 
60
        nameTF.setText(name);
 
61
    }
 
62
 
 
63
    void setResType(String value) {
 
64
        typeCB.setSelectedItem(value);
 
65
    }
 
66
    
 
67
    void setResAuth(String value) {
 
68
        authCB.setSelectedItem(value);
 
69
    }
 
70
    
 
71
    void setResScope(String value) {
 
72
        scopeCB.setSelectedItem(value);
 
73
    }
 
74
    
 
75
    void setDescription(String value) {
 
76
        descriptionTA.setText(value);
 
77
    }
 
78
    
 
79
    String getResRefName() {
 
80
        return nameTF.getText();
 
81
    }
 
82
    
 
83
    String getResType() {
 
84
        return (String)typeCB.getEditor().getItem();
 
85
    }
 
86
    
 
87
    String getResAuth() {
 
88
        return (String)authCB.getSelectedItem();
 
89
    }
 
90
    
 
91
    String getResScope() {
 
92
        return (String)scopeCB.getSelectedItem();
 
93
    }
 
94
    
 
95
    String getDescription() {
 
96
        return descriptionTA.getText();
 
97
    }
 
98
    
 
99
    javax.swing.JTextField getNameTF() {
 
100
        return nameTF;
 
101
    }
 
102
    
 
103
    javax.swing.JTextField getTypeTF() {
 
104
        return (javax.swing.JTextField)typeCB.getEditor().getEditorComponent();
 
105
    }
 
106
    
 
107
    /** This method is called from within the constructor to
 
108
     * initialize the form.
 
109
     * WARNING: Do NOT modify this code. The content of this method is
 
110
     * always regenerated by the Form Editor.
 
111
     */
 
112
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
 
113
    private void initComponents() {
 
114
        java.awt.GridBagConstraints gridBagConstraints;
 
115
 
 
116
        buttonGroup1 = new javax.swing.ButtonGroup();
 
117
        nameLabel = new javax.swing.JLabel();
 
118
        nameTF = new javax.swing.JTextField();
 
119
        typeLabel = new javax.swing.JLabel();
 
120
        typeCB = new javax.swing.JComboBox();
 
121
        authLabel = new javax.swing.JLabel();
 
122
        authCB = new javax.swing.JComboBox();
 
123
        scopeLabel = new javax.swing.JLabel();
 
124
        scopeCB = new javax.swing.JComboBox();
 
125
        descriptionLabel = new javax.swing.JLabel();
 
126
        descriptionTA = new javax.swing.JTextArea();
 
127
 
 
128
        setLayout(new java.awt.GridBagLayout());
 
129
 
 
130
        nameLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_ResRefName_mnem").charAt(0));
 
131
        nameLabel.setLabelFor(nameTF);
 
132
        nameLabel.setText(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_ResRefName"));
 
133
        gridBagConstraints = new java.awt.GridBagConstraints();
 
134
        gridBagConstraints.gridx = 0;
 
135
        gridBagConstraints.gridy = 0;
 
136
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
137
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
 
138
        add(nameLabel, gridBagConstraints);
 
139
 
 
140
        nameTF.setColumns(20);
 
141
        gridBagConstraints = new java.awt.GridBagConstraints();
 
142
        gridBagConstraints.gridx = 1;
 
143
        gridBagConstraints.gridy = 0;
 
144
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
145
        gridBagConstraints.weightx = 1.0;
 
146
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 12);
 
147
        add(nameTF, gridBagConstraints);
 
148
 
 
149
        typeLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_ResType_mnem").charAt(0));
 
150
        typeLabel.setLabelFor(typeCB);
 
151
        typeLabel.setText(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_ResType"));
 
152
        gridBagConstraints = new java.awt.GridBagConstraints();
 
153
        gridBagConstraints.gridx = 0;
 
154
        gridBagConstraints.gridy = 1;
 
155
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
156
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
 
157
        add(typeLabel, gridBagConstraints);
 
158
 
 
159
        typeCB.setEditable(true);
 
160
        typeCB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "javax.sql.DataSource", "javax.jms.ConnectionFactory", "javax.mail.Session", "java.net.URL" }));
 
161
        gridBagConstraints = new java.awt.GridBagConstraints();
 
162
        gridBagConstraints.gridx = 1;
 
163
        gridBagConstraints.gridy = 1;
 
164
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
165
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
166
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 12);
 
167
        add(typeCB, gridBagConstraints);
 
168
 
 
169
        authLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_ResAuth_mnem").charAt(0));
 
170
        authLabel.setLabelFor(authCB);
 
171
        authLabel.setText(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_ResAuth"));
 
172
        gridBagConstraints = new java.awt.GridBagConstraints();
 
173
        gridBagConstraints.gridx = 0;
 
174
        gridBagConstraints.gridy = 2;
 
175
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
176
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
 
177
        add(authLabel, gridBagConstraints);
 
178
 
 
179
        authCB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Container", "Application" }));
 
180
        gridBagConstraints = new java.awt.GridBagConstraints();
 
181
        gridBagConstraints.gridx = 1;
 
182
        gridBagConstraints.gridy = 2;
 
183
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
184
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
185
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 12);
 
186
        add(authCB, gridBagConstraints);
 
187
 
 
188
        scopeLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_ResSharingScope_mnem").charAt(0));
 
189
        scopeLabel.setLabelFor(scopeCB);
 
190
        scopeLabel.setText(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_ResSharingScope"));
 
191
        gridBagConstraints = new java.awt.GridBagConstraints();
 
192
        gridBagConstraints.gridx = 0;
 
193
        gridBagConstraints.gridy = 3;
 
194
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
195
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
 
196
        add(scopeLabel, gridBagConstraints);
 
197
 
 
198
        scopeCB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Shareable", "Unshareable" }));
 
199
        gridBagConstraints = new java.awt.GridBagConstraints();
 
200
        gridBagConstraints.gridx = 1;
 
201
        gridBagConstraints.gridy = 3;
 
202
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
203
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
 
204
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 12);
 
205
        add(scopeCB, gridBagConstraints);
 
206
 
 
207
        descriptionLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_description_mnem").charAt(0));
 
208
        descriptionLabel.setLabelFor(descriptionTA);
 
209
        descriptionLabel.setText(org.openide.util.NbBundle.getMessage(ResRefPanel.class, "LBL_description"));
 
210
        gridBagConstraints = new java.awt.GridBagConstraints();
 
211
        gridBagConstraints.gridx = 0;
 
212
        gridBagConstraints.gridy = 4;
 
213
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
 
214
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
 
215
        add(descriptionLabel, gridBagConstraints);
 
216
 
 
217
        descriptionTA.setRows(3);
 
218
        gridBagConstraints = new java.awt.GridBagConstraints();
 
219
        gridBagConstraints.gridx = 1;
 
220
        gridBagConstraints.gridy = 4;
 
221
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
 
222
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 12);
 
223
        add(descriptionTA, gridBagConstraints);
 
224
 
 
225
    }
 
226
    // </editor-fold>//GEN-END:initComponents
 
227
    
 
228
    
 
229
    // Variables declaration - do not modify//GEN-BEGIN:variables
 
230
    private javax.swing.JComboBox authCB;
 
231
    private javax.swing.JLabel authLabel;
 
232
    private javax.swing.ButtonGroup buttonGroup1;
 
233
    private javax.swing.JLabel descriptionLabel;
 
234
    private javax.swing.JTextArea descriptionTA;
 
235
    private javax.swing.JLabel nameLabel;
 
236
    private javax.swing.JTextField nameTF;
 
237
    private javax.swing.JComboBox scopeCB;
 
238
    private javax.swing.JLabel scopeLabel;
 
239
    private javax.swing.JComboBox typeCB;
 
240
    private javax.swing.JLabel typeLabel;
 
241
    // End of variables declaration//GEN-END:variables
 
242
    
 
243
}