|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.bebop.Completable
com.arsdigita.bebop.SimpleComponent
com.arsdigita.bebop.FormSection
A standalone section of a Form
. A FormSection
contains other Bebop components, most importantly
Widgets
and associated listeners. It serves two purposes:
Since a FormSection
has its own init, validation, and
process listeners, it can do all of its processing without any intervention
from the enclosing form.
Although a FormSection
contains all the same pieces
that a Form
does, it can only be used if it is added
directly or indirectly to a Form
. FormSection
s
that are not contained in a Form
do not exhibit any useful
behavior.
Form
,
FormModel
Field Summary | |
protected FormModel |
m_formModel
Underlying FormModel that stores
the parameter models for all the widgets in this form section. |
protected Container |
m_panel
The container to which all children are added. |
static String |
versionId
|
Fields inherited from class com.arsdigita.bebop.SimpleComponent |
m_attr |
Fields inherited from interface com.arsdigita.bebop.Component |
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE |
Constructor Summary | |
|
FormSection()
Constructs a new form section. |
|
FormSection(Container panel)
Constructs a new form section. |
protected |
FormSection(Container panel,
FormModel model)
Constructs a new form section. |
Method Summary | |
void |
add(Component pc)
Adds a component to this container. |
void |
add(Component pc,
int constraints)
Adds a component with the specified layout constraints to this container. |
void |
addCancelListener(FormCancelListener listener)
Adds a listener for form cancellation events. |
void |
addInitListener(FormInitListener listener)
Adds a listener for form initialization events. |
void |
addProcessListener(FormProcessListener listener)
Adds a listener for form processing events. |
void |
addSubmissionListener(FormSubmissionListener listener)
Adds a listener that is called as soon as the FormData has been
initialized with the request parameters but before any of the init,
validation, or process listeners are run. |
void |
addValidationListener(FormValidationListener listener)
Adds a validation listener, implementing a custom validation check that applies to the form as a whole. |
Iterator |
children()
Returns an iterator over the children of this component. |
boolean |
contains(Object o)
Returns true if this list contains the
specified element. |
protected FormInitListener |
createInitListener()
Creates the init listener that forwards init events to this form section. |
protected FormProcessListener |
createProcessListener()
|
protected FormSubmissionListener |
createSubmissionListener()
Creates the submission listener that forwards submission events to this form section. |
protected FormValidationListener |
createValidationListener()
Create the validation listener that forwards validation events to this form section. |
protected void |
fireCancel(FormSectionEvent e)
Calls the cancel method on all registered cancellation
listeners. |
protected void |
fireInit(FormSectionEvent e)
Calls the init method on all registered init
listeners. |
protected void |
fireProcess(FormSectionEvent e)
Calls the process method on all registered process
listeners. |
protected void |
fireSubmitted(FormSectionEvent e)
Calls the submitted method on all registered submission
listeners. |
protected void |
fireValidate(FormSectionEvent e)
Calls the validate method on all registered validation
listeners. |
protected void |
forwardInit()
|
protected void |
forwardProcess()
|
protected void |
forwardSubmission()
|
protected void |
forwardValidation()
|
void |
generateXML(PageState pageState,
Element parent)
Builds an XML subtree for this component under the specified parent . |
Component |
get(int index)
Returns the Component at the specified position. |
protected FormModel |
getModel()
Accessor method for this form's FormModel. |
Container |
getPanel()
Returns the implicit Container of this FormSection. |
int |
indexOf(Component pc)
|
boolean |
isEmpty()
Determines whether the container contains any components. |
void |
lock()
Locks this FormSection, its FormModel, and the implicit Container. |
FormData |
process(PageState data)
Since a form section cannot be processed, always throws an error. |
void |
register(Form f,
FormModel m)
Traverses the children this FormSection, collecting parameter models and listeners into the supplied FormModel. |
void |
removeCancelListener(FormCancelListener listener)
Removes the specified cancellation listener from the list of cancellation listeners (if it had previously been added). |
void |
removeInitListener(FormInitListener listener)
Removes the specified init listener from the list of init listeners (if it had previously been added). |
void |
removeProcessListener(FormProcessListener listener)
Removes the specified process listener from the list of process listeners (if it had previously been added). |
void |
removeSubmissionListener(FormSubmissionListener listener)
Removes the specified submission listener from the list of submission listeners (if it had previously been added). |
void |
removeValidationListener(FormValidationListener listener)
Removes the specified validation listener from the list of validation listeners (if it had previously been added). |
void |
respond(PageState state)
Responds to the request. |
int |
size()
Returns the number of elements in this container. |
Methods inherited from class com.arsdigita.bebop.SimpleComponent |
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, register, 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, toString, wait, wait, wait |
Methods inherited from interface com.arsdigita.bebop.Component |
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible |
Methods inherited from interface com.arsdigita.util.Lockable |
isLocked |
Field Detail |
public static final String versionId
protected FormModel m_formModel
FormModel
that stores
the parameter models for all the widgets in this form section.
protected Container m_panel
ColumnPanel
by default.
Constructor Detail |
public FormSection()
FormSection
to two column ColumnPanel
by calling the 1-argument constructor.
public FormSection(Container panel)
FormSection
to a new, anonymous FormModel.
protected FormSection(Container panel, FormModel model)
FormSection
to panel
. Sets the form
model of this FormSection
to model
.
panel
- the container within this form section that holds the
components that are added to the form section with calls to the
add
methodsmodel
- the form model for this form sectionMethod Detail |
public void addSubmissionListener(FormSubmissionListener listener)
FormData
has been
initialized with the request parameters but before any of the init,
validation, or process listeners are run. The listener's
submitted
method may throw a
FormProcessException
to signal that any further
processing of the form should be aborted.
listener
- a submission listener to run every time the form is
submittedFormModel.addSubmissionListener(com.arsdigita.bebop.event.FormSubmissionListener)
public void removeSubmissionListener(FormSubmissionListener listener)
listener
- the submission listener to removeprotected void fireSubmitted(FormSectionEvent e) throws FormProcessException
submitted
method on all registered submission
listeners.
e
- the event to pass to the listeners
FormProcessException
- if one of the listeners throws such an
exception.protected void forwardSubmission()
protected FormSubmissionListener createSubmissionListener()
public void addInitListener(FormInitListener listener)
listener
- an instance of a class that implements the
FormInitListener
interfacepublic void removeInitListener(FormInitListener listener)
listener
- the init listener to removeprotected void fireInit(FormSectionEvent e) throws FormProcessException
init
method on all registered init
listeners.
e
- the event to pass to the listeners
FormProcessException
- if one of the listeners throws such an
exception.protected void forwardInit()
protected FormInitListener createInitListener()
public void addValidationListener(FormValidationListener listener)
listener
- an instance of a class that implements the
FormValidationListener
interfacepublic void removeValidationListener(FormValidationListener listener)
listener
- a validation listenerprotected void fireValidate(FormSectionEvent e)
validate
method on all registered validation
listeners.
e
- the event to pass to the listenersprotected void forwardValidation()
protected FormValidationListener createValidationListener()
public void addProcessListener(FormProcessListener listener)
Process events only occur after a form submission has been successfully validated. They are typically used to perform a database transaction or other operation based on the submitted data.
Process listeners are executed in the order in which they are added.
listener
- an instance of a class that implements the
FormProcessListener
interfacepublic void removeProcessListener(FormProcessListener listener)
listener
- the process listener to removeprotected void forwardProcess()
protected FormProcessListener createProcessListener()
protected void fireProcess(FormSectionEvent e) throws FormProcessException
process
method on all registered process
listeners.
e
- the event to pass to the listeners
FormProcessException
- if one of the listeners throws such an
exception.public FormData process(PageState data) throws javax.servlet.ServletException
javax.servlet.ServletException
- because processing a form section is
not meaningful.public void addCancelListener(FormCancelListener listener)
listener
- an instance of a class that implements the
FormCancelListener
interfacepublic void removeCancelListener(FormCancelListener listener)
listener
- the cancellation listener to removeprotected void fireCancel(FormSectionEvent e) throws FormProcessException
cancel
method on all registered cancellation
listeners.
e
- the event to pass to the listeners
FormProcessException
- if one of the listeners throws such an
exception.public void register(Form f, FormModel m)
register
in interface Component
register
in class SimpleComponent
f
- pointer to the form that is set inside Widgets within this
FormSectionm
- the FormModel in which to merge ParameterModels and
Listenersprotected final FormModel getModel()
public void lock()
lock
in interface Lockable
lock
in class SimpleComponent
public void respond(PageState state) throws javax.servlet.ServletException
Component
Responds to the request. This method is only called if the request
was made from a link or form that the component put on the page in the
PageState.stateAsURL()
previous request.
No output should be generated on the HTTP response. The component
can store intermediate results in the state
by calling
setAttribute
.
This method is called before any output is printed to the HTTP response so that the component can forward to a different page and thereby commit the response.
respond
in interface Component
respond
in class SimpleComponent
state
- the current page state
javax.servlet.ServletException
public Container getPanel()
public Iterator children()
null
!).
children
in interface Component
children
in class SimpleComponent
public void generateXML(PageState pageState, Element parent)
parent
. Uses the request values stored in
state
.
This method generates DOM to be used with the XSLT template to produce the appropriate output.
generateXML
in interface Component
generateXML
in class SimpleComponent
pageState
- the state of the current pageparent
- the node that will be used to write topublic void add(Component pc)
add
in interface Container
pc
- the component to add to this containerpublic void add(Component pc, int constraints)
add
in interface Container
pc
- the component to add to this containerconstraints
- layout constraints (a
bitwise OR of static ints in the particular layout)public boolean contains(Object o)
true
if this list contains the
specified element. More
formally, returns true if and only if this list contains at least
one element e such that (o==null ? e==null : o.equals(e)).
This method returns true
only if the component has
been directly
added to this container. If this container contains another
container that contains this component, this method returns
false
.
contains
in interface Container
o
- element whose presence in this container is to be tested
true
if this Container contains the
specified component directly; false
otherwise.public Component get(int index)
get
in interface Container
index
- The index of the item to be retrieved from this
Container. Since the user has no control over the index of added
components (other than counting each call to add), this method
should be used in conjunction with indexOf.
public int indexOf(Component pc)
indexOf
in interface Container
pc
- component to search for
public boolean isEmpty()
isEmpty
in interface Container
true
if this container contains no components
false
otherwise.public int size()
size
in interface Container
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |