1 19 20 package org.netbeans.modules.j2ee.ddloaders.multiview.ui; 21 22 23 import javax.swing.ButtonGroup ; 24 import javax.swing.JCheckBox ; 25 import javax.swing.JComponent ; 26 import javax.swing.JRadioButton ; 27 import javax.swing.JTextField ; 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 40 public class SecurityForm extends SectionNodeInnerPanel { 41 public static String USE_CALLER_ID = "useCallerID"; public static String RUN_AS = "runAs"; public static String NO_SECURITY_ID = "noSecurityID"; public static String ALL_METHOD_PERMISSION = "allMethodPermission"; public static String SET_ROLE_METHOD_PERMISSION = "setRoleMethodPermission"; public static String NO_METHOD_PERMISSION = "noMethodPermission"; 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 getErrorComponent(String errorId) { 64 return null; 65 } 66 67 public void setValue(JComponent source, Object value) { 68 69 } 70 71 public void linkButtonPressed(Object ddBean, String ddProperty) { 72 73 } 74 75 public JRadioButton getNoSecurityIDRB() { 76 return noSecurityIDRB; 77 } 78 79 public ButtonGroup getSecurityIDButtonGroup() { 80 return buttonGroup1; 81 } 82 83 public JRadioButton getUseCallerIDRB() { 84 return useCallerIDRB; 85 } 86 87 public JRadioButton getRunAsRB() { 88 return runAsRB; 89 } 90 91 public JTextField getRunAsRoleNameTF() { 92 return runAsRoleNameTF; 93 } 94 95 public JTextField getRunAsDescriptionTF() { 96 return runAsDescriptionTF; 97 } 98 99 public JRadioButton getNoPermissionRB() { 100 return noPermissionsRB; 101 } 102 103 public ButtonGroup getGlobalMethodPermissionButtonGroup() { 104 return buttonGroup2; 105 } 106 107 public JTextField getSetRoleRoleNamesTF() { 108 return setRoleRoleNamesTF; 109 } 110 111 public JRadioButton getAllMethodPermissionRB() { 112 return allMethodPermissionRB; 113 } 114 115 public JRadioButton 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 150 private void initComponents() { 152 buttonGroup1 = new javax.swing.ButtonGroup (); 153 buttonGroup2 = new javax.swing.ButtonGroup (); 154 buttonGroup3 = new javax.swing.ButtonGroup (); 155 runAsRoleNameLabel = new javax.swing.JLabel (); 156 runAsRoleNameTF = new javax.swing.JTextField (); 157 runAsDescriptionLabel = new javax.swing.JLabel (); 158 runAsDescriptionTF = new javax.swing.JTextField (); 159 setRoleRoleNamesLabel = new javax.swing.JLabel (); 160 setRoleRoleNamesTF = new javax.swing.JTextField (); 161 setRoleRoleNamesHintLabel = new javax.swing.JLabel (); 162 allMethodPermissionRB = new javax.swing.JRadioButton (); 163 setRoleMethodPermissionRB = new javax.swing.JRadioButton (); 164 useCallerIDRB = new javax.swing.JRadioButton (); 165 runAsRB = new javax.swing.JRadioButton (); 166 jLabel1 = new javax.swing.JLabel (); 167 noSecurityIDRB = new javax.swing.JRadioButton (); 168 noPermissionsRB = new javax.swing.JRadioButton (); 169 jLabel2 = new javax.swing.JLabel (); 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 (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 (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 (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 (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 (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 (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 } 319 320 private javax.swing.JRadioButton allMethodPermissionRB; 322 private javax.swing.ButtonGroup buttonGroup1; 323 private javax.swing.ButtonGroup buttonGroup2; 324 private javax.swing.ButtonGroup buttonGroup3; 325 private javax.swing.JLabel jLabel1; 326 private javax.swing.JLabel jLabel2; 327 private javax.swing.JRadioButton noPermissionsRB; 328 private javax.swing.JRadioButton noSecurityIDRB; 329 private javax.swing.JLabel runAsDescriptionLabel; 330 private javax.swing.JTextField runAsDescriptionTF; 331 private javax.swing.JRadioButton runAsRB; 332 private javax.swing.JLabel runAsRoleNameLabel; 333 private javax.swing.JTextField runAsRoleNameTF; 334 private javax.swing.JRadioButton setRoleMethodPermissionRB; 335 private javax.swing.JLabel setRoleRoleNamesHintLabel; 336 private javax.swing.JLabel setRoleRoleNamesLabel; 337 private javax.swing.JTextField setRoleRoleNamesTF; 338 private javax.swing.JRadioButton useCallerIDRB; 339 341 } 342 | Popular Tags |