KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ddloaders > multiview > ui > SecurityForm


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.multiview.ui;
21
22
23 import javax.swing.ButtonGroup JavaDoc;
24 import javax.swing.JCheckBox JavaDoc;
25 import javax.swing.JComponent JavaDoc;
26 import javax.swing.JRadioButton JavaDoc;
27 import javax.swing.JTextField JavaDoc;
28 import org.netbeans.modules.xml.multiview.Refreshable;
29 import org.netbeans.modules.xml.multiview.ui.SectionNodeInnerPanel;
30 import org.netbeans.modules.xml.multiview.ui.SectionNodeView;
31
32 /**
33  * SecurityForm.java
34  *
35  * Form for adding and editing the run-as and method-permission elemens of
36  * the ejb deployment descriptor.
37  *
38  * @author ptliu
39  */

40 public class SecurityForm extends SectionNodeInnerPanel {
41     public static String JavaDoc USE_CALLER_ID = "useCallerID"; //NOI18N
42
public static String JavaDoc RUN_AS = "runAs"; //NOI18N
43
public static String JavaDoc NO_SECURITY_ID = "noSecurityID"; //NOI18N
44
public static String JavaDoc ALL_METHOD_PERMISSION = "allMethodPermission"; //NOI18N
45
public static String JavaDoc SET_ROLE_METHOD_PERMISSION = "setRoleMethodPermission"; //NOI18N
46
public static String JavaDoc NO_METHOD_PERMISSION = "noMethodPermission"; //NOI18N
47
/**
48      * Creates new form SecurityForm
49      */

50     public SecurityForm(SectionNodeView sectionNodeView) {
51         super(sectionNodeView);
52         initComponents();
53         
54         noSecurityIDRB.putClientProperty(Refreshable.PROPERTY_FIXED_VALUE, NO_SECURITY_ID);
55         useCallerIDRB.putClientProperty(Refreshable.PROPERTY_FIXED_VALUE, USE_CALLER_ID);
56         runAsRB.putClientProperty(Refreshable.PROPERTY_FIXED_VALUE, RUN_AS);
57         
58         allMethodPermissionRB.putClientProperty(Refreshable.PROPERTY_FIXED_VALUE, ALL_METHOD_PERMISSION);
59         setRoleMethodPermissionRB.putClientProperty(Refreshable.PROPERTY_FIXED_VALUE, SET_ROLE_METHOD_PERMISSION);
60         noPermissionsRB.putClientProperty(Refreshable.PROPERTY_FIXED_VALUE, NO_METHOD_PERMISSION);
61     }
62     
63     public JComponent JavaDoc getErrorComponent(String JavaDoc errorId) {
64         return null;
65     }
66     
67     public void setValue(JComponent JavaDoc source, Object JavaDoc value) {
68         
69     }
70     
71     public void linkButtonPressed(Object JavaDoc ddBean, String JavaDoc ddProperty) {
72         
73     }
74     
75     public JRadioButton JavaDoc getNoSecurityIDRB() {
76         return noSecurityIDRB;
77     }
78     
79     public ButtonGroup JavaDoc getSecurityIDButtonGroup() {
80         return buttonGroup1;
81     }
82     
83     public JRadioButton JavaDoc getUseCallerIDRB() {
84         return useCallerIDRB;
85     }
86     
87     public JRadioButton JavaDoc getRunAsRB() {
88         return runAsRB;
89     }
90     
91     public JTextField JavaDoc getRunAsRoleNameTF() {
92         return runAsRoleNameTF;
93     }
94     
95     public JTextField JavaDoc getRunAsDescriptionTF() {
96         return runAsDescriptionTF;
97     }
98     
99     public JRadioButton JavaDoc getNoPermissionRB() {
100         return noPermissionsRB;
101     }
102     
103     public ButtonGroup JavaDoc getGlobalMethodPermissionButtonGroup() {
104         return buttonGroup2;
105     }
106     
107     public JTextField JavaDoc getSetRoleRoleNamesTF() {
108         return setRoleRoleNamesTF;
109     }
110     
111     public JRadioButton JavaDoc getAllMethodPermissionRB() {
112         return allMethodPermissionRB;
113     }
114     
115     public JRadioButton JavaDoc getSetRolePermissionRB() {
116         return setRoleMethodPermissionRB;
117     }
118     
119     protected void updateVisualState() {
120         
121         if (runAsRB.isSelected()) {
122             runAsRoleNameLabel.setEnabled(true);
123             runAsRoleNameTF.setEnabled(true);
124             runAsDescriptionLabel.setEnabled(true);
125             runAsDescriptionTF.setEnabled(true);
126         } else {
127             runAsRoleNameLabel.setEnabled(false);
128             runAsRoleNameTF.setEnabled(false);
129             runAsDescriptionLabel.setEnabled(false);
130             runAsDescriptionTF.setEnabled(false);
131         }
132                
133         if (setRoleMethodPermissionRB.isSelected()) {
134             setRoleRoleNamesLabel.setEnabled(true);
135             setRoleRoleNamesTF.setEnabled(true);
136             setRoleRoleNamesHintLabel.setEnabled(true);
137         } else {
138             setRoleRoleNamesLabel.setEnabled(false);
139             setRoleRoleNamesTF.setEnabled(false);
140             setRoleRoleNamesHintLabel.setEnabled(false);
141         }
142         
143     }
144     
145     /** This method is called from within the constructor to
146      * initialize the form.
147      * WARNING: Do NOT modify this code. The content of this method is
148      * always regenerated by the Form Editor.
149      */

150     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
151
private void initComponents() {
152         buttonGroup1 = new javax.swing.ButtonGroup JavaDoc();
153         buttonGroup2 = new javax.swing.ButtonGroup JavaDoc();
154         buttonGroup3 = new javax.swing.ButtonGroup JavaDoc();
155         runAsRoleNameLabel = new javax.swing.JLabel JavaDoc();
156         runAsRoleNameTF = new javax.swing.JTextField JavaDoc();
157         runAsDescriptionLabel = new javax.swing.JLabel JavaDoc();
158         runAsDescriptionTF = new javax.swing.JTextField JavaDoc();
159         setRoleRoleNamesLabel = new javax.swing.JLabel JavaDoc();
160         setRoleRoleNamesTF = new javax.swing.JTextField JavaDoc();
161         setRoleRoleNamesHintLabel = new javax.swing.JLabel JavaDoc();
162         allMethodPermissionRB = new javax.swing.JRadioButton JavaDoc();
163         setRoleMethodPermissionRB = new javax.swing.JRadioButton JavaDoc();
164         useCallerIDRB = new javax.swing.JRadioButton JavaDoc();
165         runAsRB = new javax.swing.JRadioButton JavaDoc();
166         jLabel1 = new javax.swing.JLabel JavaDoc();
167         noSecurityIDRB = new javax.swing.JRadioButton JavaDoc();
168         noPermissionsRB = new javax.swing.JRadioButton JavaDoc();
169         jLabel2 = new javax.swing.JLabel JavaDoc();
170
171         runAsRoleNameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_SecurityRoleName"));
172         runAsRoleNameLabel.setEnabled(false);
173
174         runAsRoleNameTF.setEnabled(false);
175
176         runAsDescriptionLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_Description"));
177         runAsDescriptionLabel.setEnabled(false);
178
179         runAsDescriptionTF.setEnabled(false);
180
181         setRoleRoleNamesLabel.setLabelFor(setRoleRoleNamesTF);
182         setRoleRoleNamesLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_RoleNames"));
183         setRoleRoleNamesLabel.setEnabled(false);
184
185         setRoleRoleNamesTF.setEnabled(false);
186
187         setRoleRoleNamesHintLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_RoleNamesHint"));
188         setRoleRoleNamesHintLabel.setEnabled(false);
189
190         buttonGroup2.add(allMethodPermissionRB);
191         allMethodPermissionRB.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_AllUsesAllMethodsPermission"));
192         allMethodPermissionRB.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
193         allMethodPermissionRB.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
194         allMethodPermissionRB.setOpaque(false);
195
196         buttonGroup2.add(setRoleMethodPermissionRB);
197         setRoleMethodPermissionRB.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_SetRolesAllMethodsPermission"));
198         setRoleMethodPermissionRB.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
199         setRoleMethodPermissionRB.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
200         setRoleMethodPermissionRB.setOpaque(false);
201
202         buttonGroup1.add(useCallerIDRB);
203         useCallerIDRB.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_CallerIdentity"));
204         useCallerIDRB.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
205         useCallerIDRB.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
206         useCallerIDRB.setOpaque(false);
207
208         buttonGroup1.add(runAsRB);
209         runAsRB.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_RunAs"));
210         runAsRB.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
211         runAsRB.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
212         runAsRB.setOpaque(false);
213
214         jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_SecurityIdentity"));
215
216         buttonGroup1.add(noSecurityIDRB);
217         noSecurityIDRB.setSelected(true);
218         noSecurityIDRB.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_NoSecurityIdentity"));
219         noSecurityIDRB.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
220         noSecurityIDRB.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
221         noSecurityIDRB.setOpaque(false);
222
223         buttonGroup2.add(noPermissionsRB);
224         noPermissionsRB.setSelected(true);
225         noPermissionsRB.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_NoGlobalMethodPermissions"));
226         noPermissionsRB.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
227         noPermissionsRB.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
228         noPermissionsRB.setOpaque(false);
229
230         jLabel2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/multiview/ui/Bundle").getString("LBL_GlobalMethodPermission"));
231
232         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
233         this.setLayout(layout);
234         layout.setHorizontalGroup(
235             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
236             .add(layout.createSequentialGroup()
237                 .addContainerGap()
238                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
239                     .add(layout.createSequentialGroup()
240                         .add(17, 17, 17)
241                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
242                             .add(noSecurityIDRB)
243                             .add(layout.createSequentialGroup()
244                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
245                                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
246                                     .add(runAsRB)
247                                     .add(useCallerIDRB)
248                                     .add(layout.createSequentialGroup()
249                                         .add(17, 17, 17)
250                                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
251                                             .add(layout.createSequentialGroup()
252                                                 .add(runAsDescriptionLabel)
253                                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
254                                                 .add(runAsDescriptionTF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE))
255                                             .add(layout.createSequentialGroup()
256                                                 .add(runAsRoleNameLabel)
257                                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
258                                                 .add(runAsRoleNameTF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE)
259                                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))))))
260                         .addContainerGap())
261                     .add(layout.createSequentialGroup()
262                         .add(17, 17, 17)
263                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
264                             .add(allMethodPermissionRB)
265                             .add(setRoleMethodPermissionRB)
266                             .add(layout.createSequentialGroup()
267                                 .add(17, 17, 17)
268                                 .add(setRoleRoleNamesLabel)
269                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
270                                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
271                                     .add(setRoleRoleNamesTF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 282, Short.MAX_VALUE)
272                                     .add(setRoleRoleNamesHintLabel)))
273                             .add(noPermissionsRB))
274                         .addContainerGap())
275                     .add(layout.createSequentialGroup()
276                         .add(jLabel1)
277                         .addContainerGap(324, Short.MAX_VALUE))
278                     .add(layout.createSequentialGroup()
279                         .add(jLabel2)
280                         .addContainerGap(272, Short.MAX_VALUE))))
281         );
282         layout.setVerticalGroup(
283             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
284             .add(layout.createSequentialGroup()
285                 .addContainerGap()
286                 .add(jLabel1)
287                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
288                 .add(noSecurityIDRB)
289                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
290                 .add(useCallerIDRB)
291                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
292                 .add(runAsRB)
293                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
294                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
295                     .add(runAsRoleNameLabel)
296                     .add(runAsRoleNameTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
297                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
298                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
299                     .add(runAsDescriptionLabel)
300                     .add(runAsDescriptionTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
301                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
302                 .add(jLabel2)
303                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
304                 .add(noPermissionsRB)
305                 .add(7, 7, 7)
306                 .add(allMethodPermissionRB)
307                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
308                 .add(setRoleMethodPermissionRB)
309                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
310                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
311                     .add(setRoleRoleNamesLabel)
312                     .add(setRoleRoleNamesTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
313                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
314                 .add(setRoleRoleNamesHintLabel)
315                 .add(31, 31, 31))
316         );
317     }// </editor-fold>//GEN-END:initComponents
318

319     
320     // Variables declaration - do not modify//GEN-BEGIN:variables
321
private javax.swing.JRadioButton JavaDoc allMethodPermissionRB;
322     private javax.swing.ButtonGroup JavaDoc buttonGroup1;
323     private javax.swing.ButtonGroup JavaDoc buttonGroup2;
324     private javax.swing.ButtonGroup JavaDoc buttonGroup3;
325     private javax.swing.JLabel JavaDoc jLabel1;
326     private javax.swing.JLabel JavaDoc jLabel2;
327     private javax.swing.JRadioButton JavaDoc noPermissionsRB;
328     private javax.swing.JRadioButton JavaDoc noSecurityIDRB;
329     private javax.swing.JLabel JavaDoc runAsDescriptionLabel;
330     private javax.swing.JTextField JavaDoc runAsDescriptionTF;
331     private javax.swing.JRadioButton JavaDoc runAsRB;
332     private javax.swing.JLabel JavaDoc runAsRoleNameLabel;
333     private javax.swing.JTextField JavaDoc runAsRoleNameTF;
334     private javax.swing.JRadioButton JavaDoc setRoleMethodPermissionRB;
335     private javax.swing.JLabel JavaDoc setRoleRoleNamesHintLabel;
336     private javax.swing.JLabel JavaDoc setRoleRoleNamesLabel;
337     private javax.swing.JTextField JavaDoc setRoleRoleNamesTF;
338     private javax.swing.JRadioButton JavaDoc useCallerIDRB;
339     // End of variables declaration//GEN-END:variables
340

341 }
342
Popular Tags