001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003: * Distributed under the terms of either:
004: * - the common development and distribution license (CDDL), v1.0; or
005: * - the GNU Lesser General Public License, v2.1 or later
006: * $Id: ConstrainedBeanImpl.java 3697 2007-03-16 16:59:32Z gbevin $
007: */
008: package com.uwyn.rife.site;
009:
010: public class ConstrainedBeanImpl extends Validation {
011: public enum Question {
012: a1, a2, a3
013: }
014:
015: private String mHidden = null;
016: private String mAnotherhidden = null;
017: private String mLogin = null;
018: private String mAnotherlogin = null;
019: private String mPassword = null;
020: private String mAnotherpassword = null;
021: private String mComment = null;
022: private String mAnothercomment = null;
023: private Question mQuestion = null;
024: private String mAnotherquestion = null;
025: private String mCustomquestion = null;
026: private String mAnothercustomquestion = null;
027: private int[] mOptions = null;
028: private int[] mOtheroptions = null;
029: private int[] mCustomoptions = null;
030: private int[] mOthercustomoptions = null;
031: private boolean mInvoice = false;
032: private boolean mOnemoreinvoice = true;
033: private String[] mColors = null;
034: private String[] mMorecolors = null;
035: private String[] mYourcolors = null;
036:
037: public ConstrainedBeanImpl() {
038: addConstraint(new ConstrainedProperty("hidden").maxLength(16)
039: .notNull(true));
040: addConstraint(new ConstrainedProperty("anotherhidden")
041: .maxLength(20).notNull(true).defaultValue("weg")
042: .editable(false));
043: addConstraint(new ConstrainedProperty("login").maxLength(6)
044: .notNull(true));
045: addConstraint(new ConstrainedProperty("anotherlogin")
046: .maxLength(10).notNull(true).defaultValue("jij")
047: .editable(false));
048: addConstraint(new ConstrainedProperty("password").maxLength(8)
049: .notNull(true));
050: addConstraint(new ConstrainedProperty("anotherpassword")
051: .maxLength(12).notNull(true).defaultValue("secrettoo")
052: .editable(false));
053: addConstraint(new ConstrainedProperty("comment")
054: .editable(false));
055: addConstraint(new ConstrainedProperty("anothercomment")
056: .defaultValue("the comment"));
057: addConstraint(new ConstrainedProperty("question").notNull(true));
058: addConstraint(new ConstrainedProperty("anotherquestion")
059: .inList("a1", "a3", "a2").defaultValue("a1").editable(
060: false));
061: addConstraint(new ConstrainedProperty("customquestion")
062: .notNull(true).inList("a1", "a2"));
063: addConstraint(new ConstrainedProperty("anothercustomquestion")
064: .notNull(true).inList("a2", "a3").defaultValue("a3"));
065: addConstraint(new ConstrainedProperty("options").notNull(true)
066: .inList("0", "2", "3"));
067: addConstraint(new ConstrainedProperty("otheroptions").notNull(
068: true).inList("0", "2").defaultValue("0")
069: .editable(false));
070: addConstraint(new ConstrainedProperty("customoptions").inList(
071: "1", "2"));
072: addConstraint(new ConstrainedProperty("othercustomoptions")
073: .notNull(true).inList("0", "2", "1").defaultValue("0"));
074: addConstraint(new ConstrainedProperty("invoice")
075: .editable(false));
076: addConstraint(new ConstrainedProperty("onemoreinvoice")
077: .defaultValue(true));
078: addConstraint(new ConstrainedProperty("colors").notNull(true)
079: .inList("red", "blue", "green"));
080: addConstraint(new ConstrainedProperty("morecolors").notNull(
081: true).inList("blue", "red", "black", "green")
082: .defaultValue("green").editable(false));
083: addConstraint(new ConstrainedProperty("yourcolors").notNull(
084: true).inList("purple", "yellow", "brown").defaultValue(
085: "orange"));
086: }
087:
088: public void setHidden(String hidden) {
089: mHidden = hidden;
090: }
091:
092: public String getHidden() {
093: return mHidden;
094: }
095:
096: public void setAnotherhidden(String anotherhidden) {
097: mAnotherhidden = anotherhidden;
098: }
099:
100: public String getAnotherhidden() {
101: return mAnotherhidden;
102: }
103:
104: public void setLogin(String login) {
105: mLogin = login;
106: }
107:
108: public String getLogin() {
109: return mLogin;
110: }
111:
112: public void setAnotherlogin(String anotherlogin) {
113: mAnotherlogin = anotherlogin;
114: }
115:
116: public String getAnotherlogin() {
117: return mAnotherlogin;
118: }
119:
120: public void setPassword(String password) {
121: mPassword = password;
122: }
123:
124: public String getPassword() {
125: return mPassword;
126: }
127:
128: public void setAnotherpassword(String anotherpassword) {
129: mAnotherpassword = anotherpassword;
130: }
131:
132: public String getAnotherpassword() {
133: return mAnotherpassword;
134: }
135:
136: public void setComment(String comment) {
137: mComment = comment;
138: }
139:
140: public String getComment() {
141: return mComment;
142: }
143:
144: public void setAnothercomment(String anothercomment) {
145: mAnothercomment = anothercomment;
146: }
147:
148: public String getAnothercomment() {
149: return mAnothercomment;
150: }
151:
152: public void setQuestion(Question question) {
153: mQuestion = question;
154: }
155:
156: public Question getQuestion() {
157: return mQuestion;
158: }
159:
160: public void setAnotherquestion(String anotherquestion) {
161: mAnotherquestion = anotherquestion;
162: }
163:
164: public String getAnotherquestion() {
165: return mAnotherquestion;
166: }
167:
168: public void setCustomquestion(String customquestion) {
169: mCustomquestion = customquestion;
170: }
171:
172: public String getCustomquestion() {
173: return mCustomquestion;
174: }
175:
176: public void setAnothercustomquestion(String anothercustomquestion) {
177: mAnothercustomquestion = anothercustomquestion;
178: }
179:
180: public String getAnothercustomquestion() {
181: return mAnothercustomquestion;
182: }
183:
184: public void setOptions(int[] options) {
185: mOptions = options;
186: }
187:
188: public int[] getOptions() {
189: return mOptions;
190: }
191:
192: public void setOtheroptions(int[] otheroptions) {
193: mOtheroptions = otheroptions;
194: }
195:
196: public int[] getOtheroptions() {
197: return mOtheroptions;
198: }
199:
200: public void setCustomoptions(int[] customoptions) {
201: mCustomoptions = customoptions;
202: }
203:
204: public int[] getCustomoptions() {
205: return mCustomoptions;
206: }
207:
208: public void setOthercustomoptions(int[] othercustomoptions) {
209: mOthercustomoptions = othercustomoptions;
210: }
211:
212: public int[] getOthercustomoptions() {
213: return mOthercustomoptions;
214: }
215:
216: public void setInvoice(boolean invoice) {
217: mInvoice = invoice;
218: }
219:
220: public boolean isInvoice() {
221: return mInvoice;
222: }
223:
224: public void setOnemoreinvoice(boolean onemoreinvoice) {
225: mOnemoreinvoice = onemoreinvoice;
226: }
227:
228: public boolean isOnemoreinvoice() {
229: return mOnemoreinvoice;
230: }
231:
232: public void setColors(String[] colors) {
233: mColors = colors;
234: }
235:
236: public String[] getColors() {
237: return mColors;
238: }
239:
240: public void setMorecolors(String[] morecolors) {
241: mMorecolors = morecolors;
242: }
243:
244: public String[] getMorecolors() {
245: return mMorecolors;
246: }
247:
248: public void setYourcolors(String[] yourcolors) {
249: mYourcolors = yourcolors;
250: }
251:
252: public String[] getYourcolors() {
253: return mYourcolors;
254: }
255: }
|