1 19 20 21 package org.netbeans.modules.j2ee.ddloaders.web.multiview; 22 23 import javax.swing.DefaultComboBoxModel ; 24 import javax.swing.JTextArea ; 25 import javax.swing.JTextField ; 26 import org.netbeans.modules.j2ee.dd.api.common.SecurityRole; 27 28 36 public class SecurityRoleRefPanel extends javax.swing.JPanel { 37 38 39 public SecurityRoleRefPanel(SecurityRole[] roles) { 40 initComponents(); 41 42 String [] roleNames = new String [roles.length]; 43 for (int i = 0; i < roles.length; i++) { 44 roleNames[i] = roles[i].getRoleName(); 45 } 46 roleRefLinkCB.setModel(new DefaultComboBoxModel (roleNames)); 47 48 if (roleNames.length > 0) { 49 roleRefLinkCB.setSelectedIndex(0); 50 } 51 } 52 53 public String getRoleRefName() { 54 return roleRefNameTF.getText(); 55 } 56 57 public void setRoleRefName(String name) { 58 roleRefNameTF.setText(name); 59 } 60 61 public String getRoleRefLink() { 62 return (String ) roleRefLinkCB.getSelectedItem(); 63 } 64 65 public void setRoleRefLink(String link) { 66 roleRefLinkCB.setSelectedItem(link.trim()); 67 } 68 69 public String getDescription() { 70 return descriptionTA.getText(); 71 } 72 73 public void setDescription(String description) { 74 descriptionTA.setText(description); 75 } 76 77 public JTextField getRoleRefNameTF() { 78 return roleRefNameTF; 79 } 80 81 public JTextArea getDescriptionTA() { 82 return descriptionTA; 83 } 84 85 90 private void initComponents() { 92 roleRefNameLabel = new javax.swing.JLabel (); 93 roleRefLinkLabel = new javax.swing.JLabel (); 94 descriptionLabel = new javax.swing.JLabel (); 95 roleRefNameTF = new javax.swing.JTextField (); 96 jScrollPane1 = new javax.swing.JScrollPane (); 97 descriptionTA = new javax.swing.JTextArea (); 98 roleRefLinkCB = new javax.swing.JComboBox (); 99 100 roleRefNameLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_roleRefName_mnem").charAt(0)); 101 roleRefNameLabel.setLabelFor(roleRefNameTF); 102 roleRefNameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_SecurityRoleRefName")); 103 104 roleRefLinkLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_roleReLink_mnem").charAt(0)); 105 roleRefLinkLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_SecurityRoleRefLink")); 106 107 descriptionLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_description_mnem").charAt(0)); 108 descriptionLabel.setLabelFor(descriptionTA); 109 descriptionLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("LBL_SecurityRoleRefDescription")); 110 111 descriptionTA.setColumns(20); 112 descriptionTA.setRows(5); 113 jScrollPane1.setViewportView(descriptionTA); 114 115 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 116 this.setLayout(layout); 117 layout.setHorizontalGroup( 118 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 119 .add(layout.createSequentialGroup() 120 .addContainerGap() 121 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 122 .add(roleRefLinkLabel) 123 .add(descriptionLabel) 124 .add(roleRefNameLabel)) 125 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 126 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 127 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) 128 .add(roleRefNameTF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) 129 .add(roleRefLinkCB, 0, 300, Short.MAX_VALUE)) 130 .addContainerGap()) 131 ); 132 layout.setVerticalGroup( 133 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 134 .add(layout.createSequentialGroup() 135 .addContainerGap() 136 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 137 .add(roleRefNameTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 138 .add(roleRefNameLabel)) 139 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 140 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 141 .add(roleRefLinkLabel) 142 .add(roleRefLinkCB, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 143 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 144 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 145 .add(descriptionLabel) 146 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 147 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 148 ); 149 } 151 152 private javax.swing.JLabel descriptionLabel; 154 private javax.swing.JTextArea descriptionTA; 155 private javax.swing.JScrollPane jScrollPane1; 156 private javax.swing.JComboBox roleRefLinkCB; 157 private javax.swing.JLabel roleRefLinkLabel; 158 private javax.swing.JLabel roleRefNameLabel; 159 private javax.swing.JTextField roleRefNameTF; 160 162 } 163 | Popular Tags |