KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.swing.DefaultComboBoxModel JavaDoc;
24 import javax.swing.JTextArea JavaDoc;
25 import javax.swing.JTextField JavaDoc;
26 import org.netbeans.modules.j2ee.dd.api.common.SecurityRole;
27
28 /**
29  * SecurityRoleRefPanel.java
30  *
31  * Panel for adding and editing the securit-role-ref element of the web deployment
32  * descriptor.
33  *
34  * @author ptliu
35  */

36 public class SecurityRoleRefPanel extends javax.swing.JPanel JavaDoc {
37     
38     /** Creates new form SecurityRoleRefPanel */
39     public SecurityRoleRefPanel(SecurityRole[] roles) {
40         initComponents();
41         
42         String JavaDoc[] roleNames = new String JavaDoc[roles.length];
43         for (int i = 0; i < roles.length; i++) {
44             roleNames[i] = roles[i].getRoleName();
45         }
46         roleRefLinkCB.setModel(new DefaultComboBoxModel JavaDoc(roleNames));
47         
48         if (roleNames.length > 0) {
49             roleRefLinkCB.setSelectedIndex(0);
50         }
51     }
52     
53     public String JavaDoc getRoleRefName() {
54         return roleRefNameTF.getText();
55     }
56     
57     public void setRoleRefName(String JavaDoc name) {
58         roleRefNameTF.setText(name);
59     }
60     
61     public String JavaDoc getRoleRefLink() {
62         return (String JavaDoc) roleRefLinkCB.getSelectedItem();
63     }
64     
65     public void setRoleRefLink(String JavaDoc link) {
66         roleRefLinkCB.setSelectedItem(link.trim());
67     }
68     
69     public String JavaDoc getDescription() {
70         return descriptionTA.getText();
71     }
72     
73     public void setDescription(String JavaDoc description) {
74         descriptionTA.setText(description);
75     }
76     
77     public JTextField JavaDoc getRoleRefNameTF() {
78         return roleRefNameTF;
79     }
80     
81     public JTextArea JavaDoc getDescriptionTA() {
82         return descriptionTA;
83     }
84     
85     /** This method is called from within the constructor to
86      * initialize the form.
87      * WARNING: Do NOT modify this code. The content of this method is
88      * always regenerated by the Form Editor.
89      */

90     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
91
private void initComponents() {
92         roleRefNameLabel = new javax.swing.JLabel JavaDoc();
93         roleRefLinkLabel = new javax.swing.JLabel JavaDoc();
94         descriptionLabel = new javax.swing.JLabel JavaDoc();
95         roleRefNameTF = new javax.swing.JTextField JavaDoc();
96         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
97         descriptionTA = new javax.swing.JTextArea JavaDoc();
98         roleRefLinkCB = new javax.swing.JComboBox JavaDoc();
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     }// </editor-fold>//GEN-END:initComponents
150

151     
152     // Variables declaration - do not modify//GEN-BEGIN:variables
153
private javax.swing.JLabel JavaDoc descriptionLabel;
154     private javax.swing.JTextArea JavaDoc descriptionTA;
155     private javax.swing.JScrollPane JavaDoc jScrollPane1;
156     private javax.swing.JComboBox JavaDoc roleRefLinkCB;
157     private javax.swing.JLabel JavaDoc roleRefLinkLabel;
158     private javax.swing.JLabel JavaDoc roleRefNameLabel;
159     private javax.swing.JTextField JavaDoc roleRefNameTF;
160     // End of variables declaration//GEN-END:variables
161

162 }
163
Popular Tags