KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > test > WizardTestBean


1 package com.tonbeller.wcf.test;
2
3 import com.tonbeller.wcf.controller.RequestContext;
4 import com.tonbeller.wcf.form.ActionReferenceException;
5 import com.tonbeller.wcf.form.FormBean;
6 import com.tonbeller.wcf.form.FormComponent;
7
8 /**
9  * @author av
10  */

11 public class WizardTestBean implements FormBean {
12
13   String JavaDoc stringValue = "XX";
14   int intValue;
15   boolean booleanValue;
16   FormComponent form;
17   
18   public void onNext(RequestContext context) throws Exception JavaDoc {
19     if (!"AB".equals(stringValue)) {
20       form.setError("errorElementID", "Please enter AB");
21       throw new ActionReferenceException();
22     }
23     form.setError("errorElementID", null);
24   }
25   
26   public void setFormComponent(RequestContext context, FormComponent form) {
27     // this bean is called with multiple forms.
28
// We remember the first one only to display the error message
29
if (this.form == null)
30       this.form = form;
31   }
32
33   public boolean isBooleanValue() {
34     return booleanValue;
35   }
36   public void setBooleanValue(boolean booleanValue) {
37     this.booleanValue = booleanValue;
38   }
39   public int getIntValue() {
40     return intValue;
41   }
42   public void setIntValue(int intValue) {
43     this.intValue = intValue;
44   }
45   public String JavaDoc getStringValue() {
46     return stringValue;
47   }
48   public void setStringValue(String JavaDoc stringValue) {
49     this.stringValue = stringValue;
50   }
51 }
52
Popular Tags