1 19 20 21 package org.netbeans.modules.j2ee.ddloaders.web.multiview; 22 23 import java.awt.GridBagLayout ; 24 import java.util.StringTokenizer ; 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 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 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 nameString = getRoleNamesString(authConstraint); 76 roleNamesTF.setText(nameString); 77 authConstraintDescTF.setText(authConstraint.getDefaultDescription()); 78 } 79 80 addModifier(authConstraintCB); 81 addModifier(authConstraintDescTF); 83 84 UserDataConstraint userDataConstraint = constraint.getUserDataConstraint(); 85 if (userDataConstraint != null) { 86 userDataConstraintCB.setSelected(true); 87 updateVisualState(); 88 transportGuaranteeCB.setSelectedItem((String ) 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 ()); 101 java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints (); 102 gridBagConstraints.gridx = 0; 103 gridBagConstraints.gridy = 0; 104 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 106 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 107 gridBagConstraints.insets = new java.awt.Insets (5, 10, 0, 0); 108 gridBagConstraints.weightx = 1.0; 109 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 obj, String id) { 143 } 144 145 146 public javax.swing.JComponent getErrorComponent(String name) { 147 return null; 148 } 149 150 public void documentChanged(javax.swing.text.JTextComponent comp, String value) { 151 if (comp==displayNameTF) { 152 String val = (String )value; 153 if (val.length()==0) { 154 getSectionView().getErrorPanel().setError(new Error (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 (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 source, Object value) { 173 if (source == displayNameTF) { 174 String text = (String )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 source) { 203 if (source == displayNameTF) { 204 displayNameTF.setText(constraint.getDefaultDisplayName()); 205 } 206 } 207 208 210 protected void startUIChange() { 211 dObj.setChangedFromUI(true); 212 } 213 214 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"); constraint.setUserDataConstraint(userDataConstraint); 231 } catch (ClassNotFoundException 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 ) 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"); constraint.setAuthConstraint(authConstraint); 255 } catch (ClassNotFoundException ex) { 256 } 257 } 258 259 return authConstraint; 260 } 261 262 private void refillAuthConstraint() { 263 setAuthConstraint(null); 265 266 AuthConstraint authConstraint = getAuthConstraint(); 267 authConstraint.setDescription(authConstraintDescTF.getText()); 268 269 String roleNamesString = roleNamesTF.getText(); 270 StringTokenizer tokenizer = new StringTokenizer (roleNamesString, ","); 272 while (tokenizer.hasMoreTokens()) { 273 String roleName = tokenizer.nextToken().trim(); 274 275 if (roleName.length() > 0) 276 authConstraint.addRoleName(roleName); 277 } 278 } 279 280 private String getRoleNamesString(AuthConstraint authConstraint) { 281 String names[] = authConstraint.getRoleName(); 282 String nameString = ""; 284 for (int i = 0; i < names.length; i++) { 285 if (i > 0) 286 nameString += ", "; 288 nameString += names[i]; 289 } 290 291 return nameString; 292 } 293 294 private String [] getSelectedRoleNames() { 295 return constraint.getAuthConstraint().getRoleName(); 296 } 297 298 private String [] getAllRoleNames() { 299 SecurityRole[] roles = webApp.getSecurityRole(); 300 String [] roleNames = new String [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 [] roleNames) { 310 AuthConstraint authConstraint = constraint.getAuthConstraint(); 311 312 authConstraint.setRoleName(roleNames); 313 roleNamesTF.setText(getRoleNamesString(authConstraint)); 314 } 315 316 321 private void initComponents() { 323 displayNameLabel = new javax.swing.JLabel (); 324 displayNameTF = new javax.swing.JTextField (); 325 roleNamesLabel = new javax.swing.JLabel (); 326 roleNamesTF = new javax.swing.JTextField (); 327 authConstraintDescLabel = new javax.swing.JLabel (); 328 authConstraintDescTF = new javax.swing.JTextField (); 329 transportGuaranteeLabel = new javax.swing.JLabel (); 330 transportGuaranteeCB = new javax.swing.JComboBox (); 331 webResourceCollectionLabel = new javax.swing.JLabel (); 332 jPanel1 = new javax.swing.JPanel (); 333 webResourceCollectionPanel = new javax.swing.JPanel (); 334 authConstraintCB = new javax.swing.JCheckBox (); 335 userDataConstraintCB = new javax.swing.JCheckBox (); 336 webResourceCollectionPanel2 = new javax.swing.JPanel (); 337 userDataConstraintDescLabel = new javax.swing.JLabel (); 338 userDataConstraintDescTF = new javax.swing.JTextField (); 339 editButton = new javax.swing.JButton (); 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 (new String [] { "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 ()); 373 374 webResourceCollectionPanel.setLayout(new java.awt.GridBagLayout ()); 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 (0, 0, 0, 0)); 380 authConstraintCB.setOpaque(false); 381 authConstraintCB.addActionListener(new java.awt.event.ActionListener () { 382 public void actionPerformed(java.awt.event.ActionEvent 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 (0, 0, 0, 0)); 391 userDataConstraintCB.setOpaque(false); 392 userDataConstraintCB.addActionListener(new java.awt.event.ActionListener () { 393 public void actionPerformed(java.awt.event.ActionEvent 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 () { 421 public void actionPerformed(java.awt.event.ActionEvent 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 } 515 private void editButtonActionPerformed(java.awt.event.ActionEvent evt) { 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 validate() { 523 return null; 524 } 525 }; 526 527 javax.swing.event.DocumentListener docListener = new EditDialog.DocListener(dialog); 528 java.awt.Dialog 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 [] selectedRoles = dialogPanel.getSelectedRoles(); 536 setSelectedRoleNames(selectedRoles); 537 dObj.setChangedFromUI(false); 538 } 539 } 541 private void userDataConstraintCBActionPerformed(java.awt.event.ActionEvent evt) { updateVisualState(); 544 } 546 private void authConstraintCBActionPerformed(java.awt.event.ActionEvent evt) { updateVisualState(); 549 } 551 552 private javax.swing.JCheckBox authConstraintCB; 554 private javax.swing.JLabel authConstraintDescLabel; 555 private javax.swing.JTextField authConstraintDescTF; 556 private javax.swing.JLabel displayNameLabel; 557 private javax.swing.JTextField displayNameTF; 558 private javax.swing.JButton editButton; 559 private javax.swing.JPanel jPanel1; 560 private javax.swing.JLabel roleNamesLabel; 561 private javax.swing.JTextField roleNamesTF; 562 private javax.swing.JComboBox transportGuaranteeCB; 563 private javax.swing.JLabel transportGuaranteeLabel; 564 private javax.swing.JCheckBox userDataConstraintCB; 565 private javax.swing.JLabel userDataConstraintDescLabel; 566 private javax.swing.JTextField userDataConstraintDescTF; 567 private javax.swing.JLabel webResourceCollectionLabel; 568 private javax.swing.JPanel webResourceCollectionPanel; 569 private javax.swing.JPanel webResourceCollectionPanel2; 570 572 } 573 | Popular Tags |