com.arsdigita.bebop
Class Wizard

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.FormSection
              extended bycom.arsdigita.bebop.Form
                  extended bycom.arsdigita.bebop.MultiStepForm
                      extended bycom.arsdigita.bebop.Wizard
All Implemented Interfaces:
BebopConstants, Cloneable, Component, Container, Lockable

public class Wizard
extends MultiStepForm

The Wizard class can be used in conjunction with FormStep to build a series of forms that gather information from the user in several stages. A simple two stage confirmation step would be built like this:

 // The first step asks the user for a subject and body.
 FormStep one = new FormStep("one");

 one.add(new Label("Subject"));
 final TextField subject = new TextField("subject");
 one.add(subject);

 one.add(new Label("Body"));
 final TextArea body = new TextArea("body");
 one.add(body);


 // The second step displays the subject and body to the user as it will
 // appear when posted.
 GridPanel two = new GridPanel(1);
 two.add(new Label() {
     public String getLabel(PageState ps) {
         return "Subject: " + subject.getValue(ps);
     }
 });
 two.add(new Label() {
     public String getLabel(PageState ps) {
         return (String) body.getValue(ps);
     }
 });
 two.add(new Label("Are you sure?"));


 // Create the wizard and add the steps in the appropriate order.
 Wizard form = new Wizard("post");
 form.add(one);
 form.add(two);

 // Add a process listener to actually save the message.
 form.addProcessListener(new FormProcessListener() {
     public void process(FormSectionEvent evt) {
         PageState ps = evt.getPageState();
         System.out.println("SAVING MESSAGE");
         System.out.println("Subject: " + subject.getValue(ps));
         System.out.println("Body: " + body.getValue(ps));
     }
 });
 

Version:
$Revision: #9 $ $Date: 2004/04/07 $
Author:
rhs@mit.edu

Field Summary
static String versionId
           
 
Fields inherited from class com.arsdigita.bebop.Form
GET, POST
 
Fields inherited from class com.arsdigita.bebop.FormSection
m_formModel, m_panel
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.util.BebopConstants
BEBOP_BORDER, BEBOP_BOXPANEL, BEBOP_CELL, BEBOP_CHECKBOX, BEBOP_CHECKBOXGROUP, BEBOP_COLUMNPANEL, BEBOP_DATE, BEBOP_DATETIME, BEBOP_DHTMLEDITOR, BEBOP_FORMERRORS, BEBOP_FORMWIDGET, BEBOP_GRIDPANEL, BEBOP_LIST, BEBOP_MULTISELECT, BEBOP_OPTION, BEBOP_PAD, BEBOP_PADFRAME, BEBOP_PANELROW, BEBOP_PORTAL, BEBOP_PORTLET, BEBOP_RADIO, BEBOP_RADIOGROUP, BEBOP_SEG_BODY, BEBOP_SEG_HEADER, BEBOP_SEG_PANEL, BEBOP_SEGMENT, BEBOP_SELECT, BEBOP_TABLE, BEBOP_TABLEBODY, BEBOP_TABLEROW, BEBOP_TEXTAREA
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
Wizard(String name)
           
Wizard(String name, Container panel)
           
 
Method Summary
 void add(Container step)
           
 void add(Container step, int constraints)
           
protected  void fireProcess(FormSectionEvent evt)
          Calls the process method on all registered process listeners.
protected  void fireSubmitted(FormSectionEvent evt)
          Calls the submitted method on all registered submission listeners.
 Submit getCancel()
           
 Submit getFinish()
           
 boolean isFirst(PageState ps)
           
 boolean isLast(PageState ps)
           
 void next(PageState ps)
           
 void previous(PageState ps)
           
 void register(Page p)
          Adds this form to the page and traverses the components contained in this form, collecting parameterModels and Listeners into this form's FormModel.
 
Methods inherited from class com.arsdigita.bebop.MultiStepForm
generateXMLSansState
 
Methods inherited from class com.arsdigita.bebop.Form
addMagicTag, excludeParameterFromExport, generateErrors, generateXML, getAction, getFormData, getName, getProcessInvisible, isRedirecting, process, respond, setAction, setEncType, setFormData, setMethod, setName, setOnReset, setOnSubmit, setProcessInvisible, setRedirecting, toString, traverse
 
Methods inherited from class com.arsdigita.bebop.FormSection
add, add, addCancelListener, addInitListener, addProcessListener, addSubmissionListener, addValidationListener, children, contains, createInitListener, createProcessListener, createSubmissionListener, createValidationListener, fireCancel, fireInit, fireValidate, forwardInit, forwardProcess, forwardSubmission, forwardValidation, get, getModel, getPanel, indexOf, isEmpty, lock, register, removeCancelListener, removeInitListener, removeProcessListener, removeSubmissionListener, removeValidationListener, size
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible
 
Methods inherited from class com.arsdigita.bebop.Completable
addCompletionListener, fireCompletionEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.arsdigita.bebop.Component
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

Wizard

public Wizard(String name)

Wizard

public Wizard(String name,
              Container panel)
Method Detail

register

public void register(Page p)
Description copied from class: Form
Adds this form to the page and traverses the components contained in this form, collecting parameterModels and Listeners into this form's FormModel.

Specified by:
register in interface Component
Overrides:
register in class MultiStepForm

add

public void add(Container step)

add

public void add(Container step,
                int constraints)

getCancel

public Submit getCancel()

getFinish

public Submit getFinish()

isFirst

public boolean isFirst(PageState ps)

isLast

public boolean isLast(PageState ps)

next

public void next(PageState ps)

previous

public void previous(PageState ps)

fireSubmitted

protected void fireSubmitted(FormSectionEvent evt)
                      throws FormProcessException
Description copied from class: FormSection
Calls the submitted method on all registered submission listeners.

Overrides:
fireSubmitted in class FormSection
Parameters:
evt - the event to pass to the listeners
Throws:
FormProcessException - if one of the listeners throws such an exception.

fireProcess

protected void fireProcess(FormSectionEvent evt)
                    throws FormProcessException
Description copied from class: FormSection
Calls the process method on all registered process listeners.

Overrides:
fireProcess in class FormSection
Parameters:
evt - the event to pass to the listeners
Throws:
FormProcessException - if one of the listeners throws such an exception.


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC