KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > faces > samples > carstore > CustomerBean


1 /*
2  * $Id: CustomerBean.java 53793 2004-10-05 13:47:48Z vgritsenko $
3  */

4 /*
5  * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
6  *
7  * Redistribution and use in source and binary forms, with or
8  * without modification, are permitted provided that the following
9  * conditions are met:
10  *
11  * - Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * - Redistribution in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials
17  * provided with the distribution.
18  *
19  * Neither the name of Sun Microsystems, Inc. or the names of
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * This software is provided "AS IS," without a warranty of any
24  * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
25  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
27  * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
28  * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR
29  * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE OR
30  * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE
31  * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,
32  * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
33  * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
34  * THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
35  * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36  *
37  * You acknowledge that this software is not designed, licensed or
38  * intended for use in the design, construction, operation or
39  * maintenance of any nuclear facility.
40  */

41
42 package org.apache.cocoon.faces.samples.carstore;
43
44 import javax.faces.context.FacesContext;
45 import javax.faces.model.SelectItem;
46
47 import java.util.ArrayList JavaDoc;
48 import java.util.Collection JavaDoc;
49 import java.util.ResourceBundle JavaDoc;
50
51 public class CustomerBean extends Object JavaDoc {
52
53
54     String JavaDoc firstName = null;
55     String JavaDoc middleInitial = null;
56     String JavaDoc lastName = null;
57     String JavaDoc mailingAddress = null;
58     String JavaDoc city = null;
59     String JavaDoc state = null;
60     String JavaDoc zip = null;
61     String JavaDoc month = null;
62     String JavaDoc year = null;
63
64
65     public CustomerBean() {
66         super();
67     }
68
69
70     protected Collection JavaDoc titleOptions = null;
71
72
73     public Collection JavaDoc getTitleOptions() {
74         titleOptions = new ArrayList JavaDoc();
75         ResourceBundle JavaDoc rb = ResourceBundle.getBundle(
76             "org.apache.cocoon.faces.samples.carstore.bundles.Resources",
77             (FacesContext.getCurrentInstance().getViewRoot().getLocale()));
78         String JavaDoc titleStr = (String JavaDoc) rb.getObject("mrLabel");
79         titleOptions.add(new SelectItem(titleStr, titleStr,
80                                         titleStr));
81         titleStr = (String JavaDoc) rb.getObject("mrsLabel");
82         titleOptions.add(new SelectItem(titleStr, titleStr,
83                                         titleStr));
84         titleStr = (String JavaDoc) rb.getObject("msLabel");
85         titleOptions.add(new SelectItem(titleStr, titleStr,
86                                         titleStr));
87
88         return titleOptions;
89     }
90
91
92     public void setTitleOptions(Collection JavaDoc newOptions) {
93         titleOptions = new ArrayList JavaDoc(newOptions);
94     }
95
96
97     String JavaDoc title = null;
98
99
100     public void setCurrentTitle(String JavaDoc newTitle) {
101         title = newTitle;
102     }
103
104
105     public String JavaDoc getCurrentTitle() {
106         return title;
107     }
108
109
110     public void setFirstName(String JavaDoc first) {
111         firstName = first;
112     }
113
114
115     public String JavaDoc getFirstName() {
116         return firstName;
117     }
118
119
120     public void setMiddleInitial(String JavaDoc mI) {
121         middleInitial = mI;
122     }
123
124
125     public String JavaDoc getMiddleInitial() {
126         return middleInitial;
127     }
128
129
130     public void setLastName(String JavaDoc last) {
131         lastName = last;
132     }
133
134
135     public String JavaDoc getLastName() {
136         return lastName;
137     }
138
139
140     public void setMailingAddress(String JavaDoc mA) {
141         mailingAddress = mA;
142     }
143
144
145     public String JavaDoc getMailingAddress() {
146         return mailingAddress;
147     }
148
149
150     public void setCity(String JavaDoc cty) {
151         city = cty;
152     }
153
154
155     public String JavaDoc getCity() {
156         return city;
157     }
158
159
160     public void setState(String JavaDoc sT) {
161         state = sT;
162     }
163
164
165     public String JavaDoc getState() {
166         return state;
167     }
168
169
170     public void setZip(String JavaDoc zipCode) {
171         zip = zipCode;
172     }
173
174
175     public String JavaDoc getZip() {
176         return zip;
177     }
178
179
180     public void setMonth(String JavaDoc mth) {
181         month = mth;
182     }
183
184
185     public String JavaDoc getMonth() {
186         return month;
187     }
188
189
190     public void setYear(String JavaDoc yr) {
191         year = yr;
192     }
193
194
195     public String JavaDoc getYear() {
196         return year;
197     }
198 }
199
Popular Tags