KickJava   Java API By Example, From Geeks To Geeks.

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


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
21 package org.netbeans.modules.j2ee.ddloaders.web.multiview;
22
23 import java.awt.GridBagLayout JavaDoc;
24 import java.util.StringTokenizer JavaDoc;
25 import org.netbeans.modules.j2ee.dd.api.common.SecurityRole;
26 import org.netbeans.modules.j2ee.dd.api.web.AuthConstraint;
27 import org.netbeans.modules.j2ee.dd.api.web.SecurityConstraint;
28 import org.netbeans.modules.j2ee.dd.api.web.UserDataConstraint;
29 import org.netbeans.modules.j2ee.dd.api.web.WebApp;
30 import org.netbeans.modules.j2ee.ddloaders.web.DDDataObject;
31 import org.netbeans.modules.xml.multiview.ui.SectionInnerPanel;
32 import org.netbeans.modules.xml.multiview.ui.SectionPanel;
33 import org.netbeans.modules.xml.multiview.ui.SectionView;
34 import org.netbeans.modules.xml.multiview.Error;
35 import org.netbeans.modules.xml.multiview.ui.EditDialog;
36 import org.openide.util.NbBundle;
37
38 /**
39  * SecurityConstraintPanel.java
40  *
41  * Panel for adding and editing the security-constraint element of the web
42  * deployment descriptor.
43  *
44  * @author ptliu
45  */

46 public class SecurityConstraintPanel extends SectionInnerPanel {
47     
48     private SectionView view;
49     private DDDataObject dObj;
50     private WebApp webApp;
51     private SecurityConstraint constraint;
52     
53     /** Creates new form SecurityConstraintPanel */
54     public SecurityConstraintPanel(SectionView view, DDDataObject dObj,
55             SecurityConstraint constraint) {
56         super(view);
57         initComponents();
58         
59         this.view = view;
60         this.dObj = dObj;
61         this.webApp = dObj.getWebApp();
62         this.constraint = constraint;
63         
64         initPanel();
65     }
66     
67     private void initPanel() {
68         displayNameTF.setText(constraint.getDefaultDisplayName());
69         addValidatee(displayNameTF);
70         
71         AuthConstraint authConstraint = constraint.getAuthConstraint();
72         if (authConstraint != null) {
73             authConstraintCB.setSelected(true);
74             updateVisualState();
75             String JavaDoc nameString = getRoleNamesString(authConstraint);
76             roleNamesTF.setText(nameString);
77             authConstraintDescTF.setText(authConstraint.getDefaultDescription());
78         }
79         
80         addModifier(authConstraintCB);
81         //addValidatee(roleNamesTF);
82
addModifier(authConstraintDescTF);
83         
84         UserDataConstraint userDataConstraint = constraint.getUserDataConstraint();
85         if (userDataConstraint != null) {
86             userDataConstraintCB.setSelected(true);
87             updateVisualState();
88             transportGuaranteeCB.setSelectedItem((String JavaDoc) userDataConstraint.getTransportGuarantee());
89             userDataConstraintDescTF.setText(userDataConstraint.getDefaultDescription());
90         }
91         
92         addModifier(userDataConstraintCB);
93         addModifier(userDataConstraintDescTF);
94         addModifier(transportGuaranteeCB);
95         
96         WebResourceCollectionTableModel model = new WebResourceCollectionTableModel();
97         WebResourceCollectionTablePanel panel = new WebResourceCollectionTablePanel(dObj, model);
98         panel.setModel(dObj.getWebApp(), constraint, constraint.getWebResourceCollection());
99         
100         webResourceCollectionPanel2.setLayout(new GridBagLayout JavaDoc());
101         java.awt.GridBagConstraints JavaDoc gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
102         gridBagConstraints.gridx = 0;
103         gridBagConstraints.gridy = 0;
104         //gridBagConstraints.gridwidth = 4;
105
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
106         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
107         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 0, 0);
108         gridBagConstraints.weightx = 1.0;
109         //gridBagConstraints.weighty = 5.0;
110
webResourceCollectionPanel2.add(panel, gridBagConstraints);
111         
112     }
113     
114     private void updateVisualState() {
115         if (authConstraintCB.isSelected()) {
116             authConstraintDescLabel.setEnabled(true);
117             authConstraintDescTF.setEnabled(true);
118             roleNamesLabel.setEnabled(true);
119             roleNamesTF.setEnabled(true);
120             editButton.setEnabled(true);
121         } else {
122             authConstraintDescLabel.setEnabled(false);
123             authConstraintDescTF.setEnabled(false);
124             roleNamesLabel.setEnabled(false);
125             roleNamesTF.setEnabled(false);
126             editButton.setEnabled(false);
127         }
128         
129         if (userDataConstraintCB.isSelected()) {
130             userDataConstraintDescLabel.setEnabled(true);
131             userDataConstraintDescTF.setEnabled(true);
132             transportGuaranteeLabel.setEnabled(true);
133             transportGuaranteeCB.setEnabled(true);
134         } else {
135             userDataConstraintDescLabel.setEnabled(false);
136             userDataConstraintDescTF.setEnabled(false);
137             transportGuaranteeLabel.setEnabled(false);
138             transportGuaranteeCB.setEnabled(false);
139         }
140     }
141     
142     public void linkButtonPressed(Object JavaDoc obj, String JavaDoc id) {
143     }
144     
145     
146     public javax.swing.JComponent JavaDoc getErrorComponent(String JavaDoc name) {
147         return null;
148     }
149     
150     public void documentChanged(javax.swing.text.JTextComponent JavaDoc comp, String JavaDoc value) {
151         if (comp==displayNameTF) {
152             String JavaDoc val = (String JavaDoc)value;
153             if (val.length()==0) {
154                 getSectionView().getErrorPanel().setError(new Error JavaDoc(Error.MISSING_VALUE_MESSAGE, "Display Name", displayNameTF));
155                 
156                 return;
157             }
158             
159             SecurityConstraint[] constraints = webApp.getSecurityConstraint();
160             for (int i=0; i < constraints.length;i++) {
161                 if (constraints[i] != constraint &&
162                         val.equals(constraints[i].getDefaultDisplayName())) {
163                     getSectionView().getErrorPanel().setError(new Error JavaDoc(Error.TYPE_FATAL, Error.DUPLICATE_VALUE_MESSAGE, val, displayNameTF));
164                     return;
165                 }
166             }
167             getSectionView().getErrorPanel().clearError();
168             
169         }
170     }
171     
172     public void setValue(javax.swing.JComponent JavaDoc source, Object JavaDoc value) {
173         if (source == displayNameTF) {
174             String JavaDoc text = (String JavaDoc)value;
175             constraint.setDisplayName(text);
176             SectionPanel enclosingPanel = getSectionView().findSectionPanel(constraint);
177             enclosingPanel.setTitle(text);
178             enclosingPanel.getNode().setDisplayName(text);
179         } else if (source == authConstraintCB) {
180             if (authConstraintCB.isSelected()) {
181                 refillAuthConstraint();
182             } else {
183                 setAuthConstraint(null);
184             }
185         } else if (source == roleNamesTF) {
186             refillAuthConstraint();
187         } else if (source == authConstraintDescTF) {
188             refillAuthConstraint();
189         } else if (source == userDataConstraintCB) {
190             if (userDataConstraintCB.isSelected()) {
191                 refillUserDataConstraint();
192             } else {
193                 setUserDataConstraint(null);
194             }
195         } else if (source == transportGuaranteeCB) {
196             refillUserDataConstraint();
197         } else if (source == userDataConstraintDescTF) {
198             refillUserDataConstraint();
199         }
200     }
201     
202     public void rollbackValue(javax.swing.text.JTextComponent JavaDoc source) {
203         if (source == displayNameTF) {
204             displayNameTF.setText(constraint.getDefaultDisplayName());
205         }
206     }
207     
208     /** This will be called before model is changed from this panel
209      */

210     protected void startUIChange() {
211         dObj.setChangedFromUI(true);
212     }
213     
214     /** This will be called after model is changed from this panel
215      */

216     protected void endUIChange() {
217         dObj.modelUpdatedFromUI();
218         dObj.setChangedFromUI(false);
219     }
220     
221     private void setUserDataConstraint(UserDataConstraint userDataConstraint) {
222         constraint.setUserDataConstraint(userDataConstraint);
223     }
224     
225     private UserDataConstraint getUserDataConstraint() {
226         UserDataConstraint userDataConstraint = constraint.getUserDataConstraint();
227         if (userDataConstraint == null) {
228             try {
229                 userDataConstraint = (UserDataConstraint) webApp.createBean("UserDataConstraint"); //NOI18N
230
constraint.setUserDataConstraint(userDataConstraint);
231             } catch (ClassNotFoundException JavaDoc ex) {
232             }
233         }
234         
235         return userDataConstraint;
236     }
237     
238     private void refillUserDataConstraint() {
239         setUserDataConstraint(null);
240         UserDataConstraint userDataConstraint = getUserDataConstraint();
241         userDataConstraint.setDescription(userDataConstraintDescTF.getText());
242         userDataConstraint.setTransportGuarantee((String JavaDoc) transportGuaranteeCB.getSelectedItem());
243     }
244     
245     private void setAuthConstraint(AuthConstraint authConstraint) {
246         constraint.setAuthConstraint(authConstraint);
247     }
248     
249     private AuthConstraint getAuthConstraint() {
250         AuthConstraint authConstraint = constraint.getAuthConstraint();
251         if (authConstraint == null) {
252             try {
253                 authConstraint = (AuthConstraint) webApp.createBean("AuthConstraint"); //NOI18N
254
constraint.setAuthConstraint(authConstraint);
255             } catch (ClassNotFoundException JavaDoc ex) {
256             }
257         }
258         
259         return authConstraint;
260     }
261     
262     private void refillAuthConstraint() {
263         // Null out the previous authConstraint.
264
setAuthConstraint(null);
265         
266         AuthConstraint authConstraint = getAuthConstraint();
267         authConstraint.setDescription(authConstraintDescTF.getText());
268         
269         String JavaDoc roleNamesString = roleNamesTF.getText();
270         StringTokenizer JavaDoc tokenizer = new StringTokenizer JavaDoc(roleNamesString, ","); //NOI18N
271

272         while (tokenizer.hasMoreTokens()) {
273             String JavaDoc roleName = tokenizer.nextToken().trim();
274             
275             if (roleName.length() > 0)
276                 authConstraint.addRoleName(roleName);
277         }
278     }
279     
280     private String JavaDoc getRoleNamesString(AuthConstraint authConstraint) {
281         String JavaDoc names[] = authConstraint.getRoleName();
282         String JavaDoc nameString = ""; //NOI18N
283

284         for (int i = 0; i < names.length; i++) {
285             if (i > 0)
286                 nameString += ", "; //NOI18N
287

288             nameString += names[i];
289         }
290         
291         return nameString;
292     }
293     
294     private String JavaDoc[] getSelectedRoleNames() {
295         return constraint.getAuthConstraint().getRoleName();
296     }
297     
298     private String JavaDoc[] getAllRoleNames() {
299         SecurityRole[] roles = webApp.getSecurityRole();
300         String JavaDoc[] roleNames = new String JavaDoc[roles.length];
301         
302         for (int i = 0; i < roles.length; i++) {
303             roleNames[i] = roles[i].getRoleName();
304         }
305         
306         return roleNames;
307     }
308     
309     private void setSelectedRoleNames(String JavaDoc[] roleNames) {
310         AuthConstraint authConstraint = constraint.getAuthConstraint();
311         
312         authConstraint.setRoleName(roleNames);
313         roleNamesTF.setText(getRoleNamesString(authConstraint));
314     }
315     
316     /** This method is called from within the constructor to
317      * initialize the form.
318      * WARNING: Do NOT modify this code. The content of this method is
319      * always regenerated by the Form Editor.
320      */

321     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
322
private void initComponents() {
323         displayNameLabel = new javax.swing.JLabel JavaDoc();
324         displayNameTF = new javax.swing.JTextField JavaDoc();
325         roleNamesLabel = new javax.swing.JLabel JavaDoc();
326         roleNamesTF = new javax.swing.JTextField JavaDoc();
327         authConstraintDescLabel = new javax.swing.JLabel JavaDoc();
328         authConstraintDescTF = new javax.swing.JTextField JavaDoc();
329         transportGuaranteeLabel = new javax.swing.JLabel JavaDoc();
330         transportGuaranteeCB = new javax.swing.JComboBox JavaDoc();
331         webResourceCollectionLabel = new javax.swing.JLabel JavaDoc();
332         jPanel1 = new javax.swing.JPanel JavaDoc();
333         webResourceCollectionPanel = new javax.swing.JPanel JavaDoc();
334         authConstraintCB = new javax.swing.JCheckBox JavaDoc();
335         userDataConstraintCB = new javax.swing.JCheckBox JavaDoc();
336         webResourceCollectionPanel2 = new javax.swing.JPanel JavaDoc();
337         userDataConstraintDescLabel = new javax.swing.JLabel JavaDoc();
338         userDataConstraintDescTF = new javax.swing.JTextField JavaDoc();
339         editButton = new javax.swing.JButton JavaDoc();
340
341         displayNameLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_displayName_mnem").charAt(0));
342         displayNameLabel.setLabelFor(displayNameTF);
343         displayNameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_displayName"));
344
345         roleNamesLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_roleNames_mnem").charAt(0));
346         roleNamesLabel.setLabelFor(roleNamesTF);
347         roleNamesLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_SecurityRoleNames"));
348         roleNamesLabel.setEnabled(false);
349
350         roleNamesTF.setEditable(false);
351         roleNamesTF.setEnabled(false);
352
353         authConstraintDescLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_description_mnem1").charAt(0));
354         authConstraintDescLabel.setLabelFor(authConstraintDescTF);
355         authConstraintDescLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_SecurityRoleDescription"));
356         authConstraintDescLabel.setEnabled(false);
357
358         authConstraintDescTF.setEnabled(false);
359
360         transportGuaranteeLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_transportGuarantee_mnem").charAt(0));
361         transportGuaranteeLabel.setLabelFor(transportGuaranteeCB);
362         transportGuaranteeLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_TransportGuarantee"));
363         transportGuaranteeLabel.setEnabled(false);
364
365         transportGuaranteeCB.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "NONE", "INTEGRAL", "CONFIDENTIAL" }));
366         transportGuaranteeCB.setEnabled(false);
367
368         webResourceCollectionLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_webResourceCollection_mnem").charAt(0));
369         webResourceCollectionLabel.setLabelFor(webResourceCollectionPanel);
370         webResourceCollectionLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_WebResourceCollection"));
371
372         jPanel1.setLayout(new java.awt.GridBagLayout JavaDoc());
373
374         webResourceCollectionPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
375
376         authConstraintCB.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_authConstraint_mnem").charAt(0));
377         authConstraintCB.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_AuthConstraint"));
378         authConstraintCB.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
379         authConstraintCB.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
380         authConstraintCB.setOpaque(false);
381         authConstraintCB.addActionListener(new java.awt.event.ActionListener JavaDoc() {
382             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
383                 authConstraintCBActionPerformed(evt);
384             }
385         });
386
387         userDataConstraintCB.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_userDataConstraint_mnem").charAt(0));
388         userDataConstraintCB.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_UserDataConstraint"));
389         userDataConstraintCB.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
390         userDataConstraintCB.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
391         userDataConstraintCB.setOpaque(false);
392         userDataConstraintCB.addActionListener(new java.awt.event.ActionListener JavaDoc() {
393             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
394                 userDataConstraintCBActionPerformed(evt);
395             }
396         });
397
398         webResourceCollectionPanel2.setOpaque(false);
399         org.jdesktop.layout.GroupLayout webResourceCollectionPanel2Layout = new org.jdesktop.layout.GroupLayout(webResourceCollectionPanel2);
400         webResourceCollectionPanel2.setLayout(webResourceCollectionPanel2Layout);
401         webResourceCollectionPanel2Layout.setHorizontalGroup(
402             webResourceCollectionPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
403             .add(0, 331, Short.MAX_VALUE)
404         );
405         webResourceCollectionPanel2Layout.setVerticalGroup(
406             webResourceCollectionPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
407             .add(0, 38, Short.MAX_VALUE)
408         );
409
410         userDataConstraintDescLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_description_mnem2").charAt(0));
411         userDataConstraintDescLabel.setLabelFor(userDataConstraintDescTF);
412         userDataConstraintDescLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_UserDataConstraintDescription"));
413         userDataConstraintDescLabel.setEnabled(false);
414
415         userDataConstraintDescTF.setEnabled(false);
416
417         editButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_editRoleNames_mnem").charAt(0));
418         editButton.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_EditRoleNames"));
419         editButton.setEnabled(false);
420         editButton.addActionListener(new java.awt.event.ActionListener JavaDoc() {
421             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
422                 editButtonActionPerformed(evt);
423             }
424         });
425
426         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
427         this.setLayout(layout);
428         layout.setHorizontalGroup(
429             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
430             .add(layout.createSequentialGroup()
431                 .addContainerGap()
432                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
433                     .add(layout.createSequentialGroup()
434                         .add(17, 17, 17)
435                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
436                             .add(layout.createSequentialGroup()
437                                 .add(transportGuaranteeLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 105, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
438                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
439                                 .add(transportGuaranteeCB, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
440                             .add(layout.createSequentialGroup()
441                                 .add(userDataConstraintDescLabel)
442                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
443                                 .add(userDataConstraintDescTF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)))
444                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
445                     .add(layout.createSequentialGroup()
446                         .add(displayNameLabel)
447                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
448                         .add(displayNameTF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 259, Short.MAX_VALUE))
449                     .add(layout.createSequentialGroup()
450                         .add(userDataConstraintCB)
451                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
452                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
453                             .add(webResourceCollectionPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
454                             .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
455                     .add(webResourceCollectionLabel)
456                     .add(org.jdesktop.layout.GroupLayout.TRAILING, webResourceCollectionPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
457                     .add(layout.createSequentialGroup()
458                         .add(17, 17, 17)
459                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
460                             .add(roleNamesLabel)
461                             .add(authConstraintDescLabel))
462                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
463                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
464                             .add(roleNamesTF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)
465                             .add(authConstraintDescTF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)))
466                     .add(authConstraintCB))
467                 .add(6, 6, 6)
468                 .add(editButton)
469                 .addContainerGap())
470         );
471         layout.setVerticalGroup(
472             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
473             .add(layout.createSequentialGroup()
474                 .addContainerGap()
475                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
476                     .add(displayNameTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
477                     .add(displayNameLabel))
478                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
479                 .add(webResourceCollectionLabel)
480                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
481                 .add(webResourceCollectionPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
482                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
483                 .add(authConstraintCB)
484                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
485                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
486                     .add(authConstraintDescLabel)
487                     .add(authConstraintDescTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
488                 .add(5, 5, 5)
489                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
490                     .add(layout.createSequentialGroup()
491                         .add(39, 39, 39)
492                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
493                             .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
494                             .add(webResourceCollectionPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
495                     .add(layout.createSequentialGroup()
496                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
497                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
498                             .add(roleNamesLabel)
499                             .add(roleNamesTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
500                             .add(editButton))
501                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
502                         .add(userDataConstraintCB)))
503                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
504                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
505                     .add(userDataConstraintDescTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
506                     .add(userDataConstraintDescLabel))
507                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
508                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
509                     .add(transportGuaranteeCB, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
510                     .add(transportGuaranteeLabel))
511                 .addContainerGap(36, Short.MAX_VALUE))
512         );
513     }// </editor-fold>//GEN-END:initComponents
514

515     private void editButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_editButtonActionPerformed
516
// TODO add your handling code here:
517
SecurityRolesEditorPanel dialogPanel = new SecurityRolesEditorPanel(
518                 getAllRoleNames(), getSelectedRoleNames());
519         EditDialog dialog = new EditDialog(dialogPanel,
520                 NbBundle.getMessage(SecurityConstraintPanel.class,"TTL_RoleNames"),
521                 false) {
522             protected String JavaDoc validate() {
523                 return null;
524             }
525         };
526               
527         javax.swing.event.DocumentListener JavaDoc docListener = new EditDialog.DocListener(dialog);
528         java.awt.Dialog JavaDoc d = org.openide.DialogDisplayer.getDefault().createDialog(dialog);
529         d.setVisible(true);
530         
531         if (dialog.getValue().equals(EditDialog.OK_OPTION)) {
532             dObj.modelUpdatedFromUI();
533             dObj.setChangedFromUI(true);
534             
535             String JavaDoc[] selectedRoles = dialogPanel.getSelectedRoles();
536             setSelectedRoleNames(selectedRoles);
537             dObj.setChangedFromUI(false);
538         }
539     }//GEN-LAST:event_editButtonActionPerformed
540

541     private void userDataConstraintCBActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_userDataConstraintCBActionPerformed
542
// TODO add your handling code here:
543
updateVisualState();
544     }//GEN-LAST:event_userDataConstraintCBActionPerformed
545

546     private void authConstraintCBActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_authConstraintCBActionPerformed
547
// TODO add your handling code here:
548
updateVisualState();
549     }//GEN-LAST:event_authConstraintCBActionPerformed
550

551     
552     // Variables declaration - do not modify//GEN-BEGIN:variables
553
private javax.swing.JCheckBox JavaDoc authConstraintCB;
554     private javax.swing.JLabel JavaDoc authConstraintDescLabel;
555     private javax.swing.JTextField JavaDoc authConstraintDescTF;
556     private javax.swing.JLabel JavaDoc displayNameLabel;
557     private javax.swing.JTextField JavaDoc displayNameTF;
558     private javax.swing.JButton JavaDoc editButton;
559     private javax.swing.JPanel JavaDoc jPanel1;
560     private javax.swing.JLabel JavaDoc roleNamesLabel;
561     private javax.swing.JTextField JavaDoc roleNamesTF;
562     private javax.swing.JComboBox JavaDoc transportGuaranteeCB;
563     private javax.swing.JLabel JavaDoc transportGuaranteeLabel;
564     private javax.swing.JCheckBox JavaDoc userDataConstraintCB;
565     private javax.swing.JLabel JavaDoc userDataConstraintDescLabel;
566     private javax.swing.JTextField JavaDoc userDataConstraintDescTF;
567     private javax.swing.JLabel JavaDoc webResourceCollectionLabel;
568     private javax.swing.JPanel JavaDoc webResourceCollectionPanel;
569     private javax.swing.JPanel JavaDoc webResourceCollectionPanel2;
570     // End of variables declaration//GEN-END:variables
571

572 }
573
Popular Tags