com.arsdigita.bebop
Class MetaForm

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.MetaForm
All Implemented Interfaces:
BebopConstants, Cloneable, Component, Container, Lockable
Direct Known Subclasses:
FormPropertiesForm, JspForm, MoveControl, PreviewForm, PropertiesMetaForm, QuestionPropertiesForm

public abstract class MetaForm
extends Form

A form that is instantiated on a per-request basis. This class functions as a placeholder and decorator of the request-specific form in a Bebop Page.

Subclasses only need to override buildForm to return the request-specific form. The meta form takes care of interfacing that form with the normal control flow of serving a Bebop Page. The meta form will fool the request-specific forms into thinking that they are part of a static Bebop Page. The properties of the meta form should be used to initialize the correspoding properties of the request-specific form whenever possible. These properties include name, method, and encType.

Listeners can be added directly to the meta form and are run whenever the corresponding listeners would be run on an ordinary form. The source of the FormSectionEvent will be the meta form.

Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/MetaForm.java#8 $
Author:
Stas Freidin, David Lutterkort

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
MetaForm(String name)
          Constructs a new meta form.
 
Method Summary
 void add(Component pc, int constraints)
          Not implemented because meta forms currently don't support mixing static and dynamic widgets.
protected  void addMagicTag()
          Do nothing; the dynamic form will take care of the tag.
abstract  Form buildForm(PageState state)
          Builds the dynamic form.
protected  Element generateXMLSansState(PageState s, Element parent)
          Generates the XML representing the form and its widgets, but not the state information, from s.
protected  Form getDynamicForm(PageState state)
          Retrieves the form for the request represented by state.
 FormData getFormData(PageState state)
          Returns the form data constructed by process for the request described by state.
 Container getPanel()
          Not implemented.
 FormData process(PageState state)
          Processes the request-specific form for the request represented by state.
 void rebuildForm(PageState s)
          Force a rebuilding and updating of the dynamic form.
 
Methods inherited from class com.arsdigita.bebop.Form
excludeParameterFromExport, generateErrors, generateXML, getAction, getName, getProcessInvisible, isRedirecting, register, respond, setAction, setEncType, setFormData, setMethod, setName, setOnReset, setOnSubmit, setProcessInvisible, setRedirecting, toString, traverse
 
Methods inherited from class com.arsdigita.bebop.FormSection
add, addCancelListener, addInitListener, addProcessListener, addSubmissionListener, addValidationListener, children, contains, createInitListener, createProcessListener, createSubmissionListener, createValidationListener, fireCancel, fireInit, fireProcess, fireSubmitted, fireValidate, forwardInit, forwardProcess, forwardSubmission, forwardValidation, get, getModel, 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

MetaForm

public MetaForm(String name)
Constructs a new meta form.

Parameters:
name - the name of the form
Method Detail

getDynamicForm

protected Form getDynamicForm(PageState state)
Retrieves the form for the request represented by state. If the form hasn't been built yet, calls buildForm to build the form.

Parameters:
state - describes the current request
Returns:
a custom-built form for this request.

buildForm

public abstract Form buildForm(PageState state)
Builds the dynamic form. Subclasses should override this method to build the form based on the request represented by state.

Parameters:
state - describes the current request
Returns:
the form to be used for this request.

rebuildForm

public void rebuildForm(PageState s)
Force a rebuilding and updating of the dynamic form. Calls buildForm again and sets the dynamic form to the form returned by it.

Parameters:
s - describes the current request

getFormData

public FormData getFormData(PageState state)
Returns the form data constructed by process for the request described by state. If the form for this request hasn't been built yet, calls buildForm.

Overrides:
getFormData in class Form
Parameters:
state - describes the current request
Returns:
the values extracted from the HTTP request contained in state, or null if the form has not yet been processed.

generateXMLSansState

protected Element generateXMLSansState(PageState s,
                                       Element parent)
Generates the XML representing the form and its widgets, but not the state information, from s. The XML generation is delegated to the request-specific form by calling generateXMLSansState on it.

Overrides:
generateXMLSansState in class Form
Parameters:
s - represents the curent request
Returns:
the top-level element for the form.

process

public FormData process(PageState state)
                 throws FormProcessException
Processes the request-specific form for the request represented by state.

Overrides:
process in class Form
Parameters:
state - describes the current request
Returns:
the form data extracted from the current request.
Throws:
FormProcessException
See Also:
Form.process(...), FormModel.process(...)

addMagicTag

protected void addMagicTag()
Do nothing; the dynamic form will take care of the tag.

Overrides:
addMagicTag in class Form

add

public void add(Component pc,
                int constraints)
Not implemented because meta forms currently don't support mixing static and dynamic widgets.

Specified by:
add in interface Container
Overrides:
add in class FormSection
Parameters:
pc - the component to add to this container
constraints - layout constraints (a bitwise OR of static ints in the particular layout)
Throws:
UnsupportedOperationException

getPanel

public Container getPanel()
Not implemented.

Overrides:
getPanel in class FormSection
Throws:
UnsupportedOperationException


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