KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > webapp > form > core > SelectRolesAndGroupsForm


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.blandware.atleap.webapp.form.core;
17
18 import com.blandware.atleap.webapp.form.BaseForm;
19 import org.apache.struts.action.ActionErrors;
20 import org.apache.struts.action.ActionMapping;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23 import java.util.ArrayList JavaDoc;
24 import java.util.List JavaDoc;
25
26 /**
27  * <p>ActionForm bean that holds selected and available roles and groups from lists
28  * on the page with four HTML Selects with multiple attribute set to true</p>
29  * <p><a HREF="SelectRolesAndGroupsForm.java.htm"><i>View Source</i></a></p>
30  *
31  * @author Roman Puchkovskiy <a HREF="mailto:roman.puchkovskiy@blandware.com">
32  * &lt;roman.puchkovskiy@blandware.com&gt;</a>
33  * @version $Revision: 1.1 $ $Date: 2006/03/06 18:12:33 $
34  * @struts.form name="selectRolesAndGroupsForm"
35  */

36 public class SelectRolesAndGroupsForm extends BaseForm {
37
38     protected List JavaDoc availableRolesList;
39     protected List JavaDoc selectedRolesList;
40
41     protected String JavaDoc[] availableRoles;
42     protected String JavaDoc[] selectedRoles;
43
44     protected List JavaDoc availableGroupsList;
45     protected List JavaDoc selectedGroupsList;
46
47     protected String JavaDoc[] availableGroups;
48     protected String JavaDoc[] selectedGroups;
49
50     protected String JavaDoc version;
51
52     /**
53      * Creates the new instance of SelectRolesAndGroupsForm
54      */

55     public SelectRolesAndGroupsForm() {
56     }
57
58     /**
59      * Returns list of available roles
60      *
61      * @return list of available roles
62      */

63     public List JavaDoc getAvailableRolesList() {
64         return availableRolesList;
65     }
66
67     /**
68      * Sets list of available roles
69      *
70      * @param availableRoles list of available roles
71      */

72     public void setAvailableRolesList(List JavaDoc availableRoles) {
73         this.availableRolesList = availableRoles;
74     }
75
76     /**
77      * Returns list of selected roles
78      *
79      * @return list of selected roles
80      */

81     public List JavaDoc getSelectedRolesList() {
82         return selectedRolesList;
83     }
84
85     /**
86      * Sets list of selected roles
87      *
88      * @param selectedRoles list of selected roles
89      */

90     public void setSelectedRolesList(List JavaDoc selectedRoles) {
91         this.selectedRolesList = selectedRoles;
92     }
93
94     /**
95      * Returns array of available roles
96      *
97      * @return array of available roles
98      */

99     public String JavaDoc[] getAvailableRoles() {
100         return availableRoles;
101     }
102
103     /**
104      * Sets array of available roles
105      *
106      * @param availableRoles array of available roles
107      */

108     public void setAvailableRoles(String JavaDoc[] availableRoles) {
109         this.availableRoles = availableRoles;
110     }
111
112     /**
113      * Returns array of selected roles
114      *
115      * @return array of selected roles
116      */

117     public String JavaDoc[] getSelectedRoles() {
118         return selectedRoles;
119     }
120
121     /**
122      * Sets array of selected roles
123      *
124      * @param selectedRoles array of selected roles
125      */

126     public void setSelectedRoles(String JavaDoc[] selectedRoles) {
127         this.selectedRoles = selectedRoles;
128     }
129
130     /**
131      * Returns list of available groups
132      *
133      * @return list of available groups
134      */

135     public List JavaDoc getAvailableGroupsList() {
136         return availableGroupsList;
137     }
138
139     /**
140      * Sets list of available groups
141      *
142      * @param availableGroups list of available roles
143      */

144     public void setAvailableGroupsList(List JavaDoc availableGroups) {
145         this.availableGroupsList = availableGroups;
146     }
147
148     /**
149      * Returns list of selected groups
150      *
151      * @return list of selected groups
152      */

153     public List JavaDoc getSelectedGroupsList() {
154         return selectedGroupsList;
155     }
156
157     /**
158      * Sets list of selected groups
159      *
160      * @param selectedGroups list of selected groups
161      */

162     public void setSelectedGroupsList(List JavaDoc selectedGroups) {
163         this.selectedGroupsList = selectedGroups;
164     }
165
166     /**
167      * Returns array of available groups
168      *
169      * @return array of available groups
170      */

171     public String JavaDoc[] getAvailableGroups() {
172         return availableGroups;
173     }
174
175     /**
176      * Sets array of available groups
177      *
178      * @param availableGroups array of available groups
179      */

180     public void setAvailableGroups(String JavaDoc[] availableGroups) {
181         this.availableGroups = availableGroups;
182     }
183
184     /**
185      * Returns array of selected groups
186      *
187      * @return array of selected groups
188      */

189     public String JavaDoc[] getSelectedGroups() {
190         return selectedGroups;
191     }
192
193     /**
194      * Sets array of selected groups
195      *
196      * @param selectedGroups array of selected groups
197      */

198     public void setSelectedGroups(String JavaDoc[] selectedGroups) {
199         this.selectedGroups = selectedGroups;
200     }
201
202     /**
203      * Returns version
204      *
205      * @return version
206      */

207     public String JavaDoc getVersion() {
208         return version;
209     }
210
211     /**
212      * Sets version
213      *
214      * @param version version to set
215      */

216     public void setVersion(String JavaDoc version) {
217         this.version = version;
218     }
219
220     /**
221      * Resets all properties to their default values
222      *
223      * @param mapping The ActionMapping used to select this instance
224      * @param request The non-http request we are proceeding
225      */

226     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
227         availableRolesList = new ArrayList JavaDoc();
228         selectedRolesList = new ArrayList JavaDoc();
229         availableRoles = new String JavaDoc[0];
230         selectedRoles = new String JavaDoc[0];
231         availableGroupsList = new ArrayList JavaDoc();
232         selectedGroupsList = new ArrayList JavaDoc();
233         availableGroups = new String JavaDoc[0];
234         selectedGroups = new String JavaDoc[0];
235         version = null;
236     }
237
238     /**
239      * Form validation -- this form is always valid
240      *
241      * @param mapping The ActionMapping used to select this instance
242      * @param request The non-http request we are proceeding
243      * @return Instance of ActionErrors contains all validation errors
244      */

245     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
246         return null;
247     }
248
249 }
Popular Tags