KickJava   Java API By Example, From Geeks To Geeks.

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


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 from lists
28  * on the page with two HTML Selects with multiple attribute set to true</p>
29  * <p><a HREF="SelectRolesForm.java.htm"><i>View Source</i></a></p>
30  *
31  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
32  * @version $Revision: 1.9 $ $Date: 2005/08/04 17:25:16 $
33  * @struts.form name="selectRolesForm"
34  */

35 public class SelectRolesForm extends BaseForm {
36
37     protected List JavaDoc availableRolesList;
38     protected List JavaDoc selectedRolesList;
39
40     protected String JavaDoc[] availableRoles;
41     protected String JavaDoc[] selectedRoles;
42
43     protected String JavaDoc version;
44
45     /**
46      * Creates the new instance of SelectRolesForm
47      */

48     public SelectRolesForm() {
49     }
50
51     /**
52      * Returns list of available roles
53      *
54      * @return list of available roles
55      */

56     public List JavaDoc getAvailableRolesList() {
57         return availableRolesList;
58     }
59
60     /**
61      * Sets list of available roles
62      *
63      * @param availableRoles list of available roles
64      */

65     public void setAvailableRolesList(List JavaDoc availableRoles) {
66         this.availableRolesList = availableRoles;
67     }
68
69     /**
70      * Returns list of selected roles
71      *
72      * @return list of selected roles
73      */

74     public List JavaDoc getSelectedRolesList() {
75         return selectedRolesList;
76     }
77
78     /**
79      * Sets list of selected roles
80      *
81      * @param selectedRoles list of selected roles
82      */

83     public void setSelectedRolesList(List JavaDoc selectedRoles) {
84         this.selectedRolesList = selectedRoles;
85     }
86
87     /**
88      * Returns array of available roles
89      *
90      * @return array of available roles
91      */

92     public String JavaDoc[] getAvailableRoles() {
93         return availableRoles;
94     }
95
96     /**
97      * Sets array of available roles
98      *
99      * @param availableRoles array of available roles
100      */

101     public void setAvailableRoles(String JavaDoc[] availableRoles) {
102         this.availableRoles = availableRoles;
103     }
104
105     /**
106      * Returns array of selected roles
107      *
108      * @return array of selected roles
109      */

110     public String JavaDoc[] getSelectedRoles() {
111         return selectedRoles;
112     }
113
114     /**
115      * Sets array of selected roles
116      *
117      * @param selectedRoles array of selected roles
118      */

119     public void setSelectedRoles(String JavaDoc[] selectedRoles) {
120         this.selectedRoles = selectedRoles;
121     }
122
123     /**
124      * Returns version
125      *
126      * @return version
127      */

128     public String JavaDoc getVersion() {
129         return version;
130     }
131
132     /**
133      * Sets version
134      *
135      * @param version version to set
136      */

137     public void setVersion(String JavaDoc version) {
138         this.version = version;
139     }
140
141     /**
142      * Resets all properties to their default values
143      *
144      * @param mapping The ActionMapping used to select this instance
145      * @param request The non-http request we are proceeding
146      */

147     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
148         availableRolesList = new ArrayList JavaDoc();
149         selectedRolesList = new ArrayList JavaDoc();
150         availableRoles = new String JavaDoc[0];
151         selectedRoles = new String JavaDoc[0];
152         version = null;
153     }
154
155     /**
156      * Form validation -- this form is always valid
157      *
158      * @param mapping The ActionMapping used to select this instance
159      * @param request The non-http request we are proceeding
160      * @return Instance of ActionErrors contains all validation errors
161      */

162     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
163         return null;
164     }
165
166 }
Popular Tags