|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.forms.formmodel.AbstractWidget
org.apache.cocoon.forms.formmodel.AbstractContainerWidget
org.apache.cocoon.forms.formmodel.Form
public class Form
A widget that serves as a container for other widgets, the top-level widget in a form description file.
| Field Summary | |
|---|---|
static String |
SUBMIT_ID_PARAMETER
Form parameter containing the submit widget's id |
| Fields inherited from class org.apache.cocoon.forms.formmodel.AbstractContainerWidget |
|---|
validationError, widgets |
| Fields inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget |
|---|
wasValid |
| Fields inherited from interface org.apache.cocoon.forms.formmodel.Widget |
|---|
PATH_SEPARATOR |
| Constructor Summary | |
|---|---|
Form(FormDefinition definition)
|
|
| Method Summary | |
|---|---|
void |
addProcessingPhaseListener(ProcessingPhaseListener listener)
|
void |
addWidgetEvent(WidgetEvent event)
Events produced by child widgets should not be fired immediately, but queued in order to ensure an overall consistency of the widget tree before being handled. |
boolean |
addWidgetUpdate(Widget widget)
Mark a widget as being updated. |
void |
endProcessing(boolean redisplayForm)
End the current form processing after the current phase. |
Set |
getChildUpdatedWidgetIds()
|
WidgetDefinition |
getDefinition()
Concrete subclasses should allow access to their underlaying Definition through this method. |
String |
getId()
Gets the id of this widget. |
Locale |
getLocale()
Get the locale to be used to process this form. |
Widget |
getSubmitWidget()
Get the widget that triggered the current processing. |
Set |
getUpdatedWidgetIds()
|
ValidationError |
getValidationError()
Set a validation error on this field. |
String |
getXMLElementName()
The XML element name used in AbstractWidget.generateSaxFragment(ContentHandler, Locale)
to produce the wrapping element for all the XML-instance-content of this Widget. |
boolean |
hasFormHandler()
|
void |
informEndLoadingModel()
Inform the form that the values are loaded. |
void |
informEndSavingModel()
Inform the form that the values are saved. |
void |
informStartLoadingModel()
Inform the form that the values will be loaded. |
void |
informStartSavingModel()
Inform the form that the values will be saved. |
void |
initialize()
Initialize the form by recursively initializing all its children. |
boolean |
isValid()
Was form validation successful ? |
boolean |
process(FormContext formContext)
Processes a form submit. |
void |
readFromRequest(FormContext formContext)
Delegates the readFromRequest() down to the contained child-widgets. |
void |
removeProcessingPhaseListener(ProcessingPhaseListener listener)
|
void |
setFormHandler(FormHandler formHandler)
|
void |
setId(String value)
Set the optional id. |
void |
setSubmitWidget(Widget widget)
Set the widget that triggered the current form processing. |
void |
setValidationError(ValidationError error)
set a validation error |
boolean |
validate()
Performs validation phase of form processing. |
| Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractContainerWidget |
|---|
addChild, generateItemSaxFragment, getChild, getChildren, getSize, hasChild |
| Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget |
|---|
addValidator, broadcastEvent, generateDisplayData, generateLabel, generateSaxFragment, getAttribute, getCombinedState, getForm, getFullName, getLocation, getName, getParent, getRequestParameterName, getState, getValue, getWidget, getXMLElementAttributes, isRequired, lookupWidget, removeAttribute, removeValidator, setAttribute, setParent, setState, setValue, toString, widgetNameChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.cocoon.forms.formmodel.Widget |
|---|
addValidator, broadcastEvent, generateLabel, generateSaxFragment, getAttribute, getCombinedState, getForm, getFullName, getLocation, getName, getParent, getRequestParameterName, getState, getValue, getWidget, isRequired, lookupWidget, removeAttribute, removeValidator, setAttribute, setParent, setState, setValue |
| Field Detail |
|---|
public static final String SUBMIT_ID_PARAMETER
| Constructor Detail |
|---|
public Form(FormDefinition definition)
| Method Detail |
|---|
public void initialize()
initialize in interface Widgetinitialize in class AbstractContainerWidgetpublic WidgetDefinition getDefinition()
AbstractWidgetnull they should also organize
own implementations of AbstractWidget.getId(), AbstractWidget.getLocation(),
AbstractWidget.validate(), AbstractWidget.generateLabel(ContentHandler) and
AbstractWidget.generateDisplayData(ContentHandler) to avoid NPE's.
getDefinition in interface WidgetgetDefinition in class AbstractWidgetWidgetDefinition.createInstance())public void addWidgetEvent(WidgetEvent event)
event - the event to queuepublic boolean addWidgetUpdate(Widget widget)
widget - the updated widget
true if this widget was added to the list (i.e. wasn't alredy marked for update)public Set getUpdatedWidgetIds()
public Set getChildUpdatedWidgetIds()
public void informStartLoadingModel()
public void informEndLoadingModel()
public void informStartSavingModel()
public void informEndSavingModel()
public Locale getLocale()
public Widget getSubmitWidget()
public void setSubmitWidget(Widget widget)
widget - the widgetpublic boolean hasFormHandler()
public void setFormHandler(FormHandler formHandler)
public void addProcessingPhaseListener(ProcessingPhaseListener listener)
public void removeProcessingPhaseListener(ProcessingPhaseListener listener)
public boolean process(FormContext formContext)
isValid() method.
Form processing consists in multiple steps:
readFromRequest(FormContext) is called recursively on
the whole widget tree)
endProcessing(boolean).
Note that this method is synchronized as a Form is not thread-safe. This should not be a bottleneck as such concurrent requests can only happen for a single user.
public void endProcessing(boolean redisplayForm)
redisplayForm - indicates if the form should be redisplayed to the user.public boolean isValid()
isValid in interface WidgetisValid in class AbstractWidgettrue if the form was successfully validated.Widget.isValid()public void readFromRequest(FormContext formContext)
AbstractContainerWidgetsuper.readFromRequest()
to allow child-widgets to process the request.
Overide only to add possible request-reading statements on the containment level.
readFromRequest in interface WidgetreadFromRequest in class AbstractContainerWidgetformContext - to be passed to the Widget.readFromRequest(FormContext)
of the contained widgets.public ValidationError getValidationError()
getValidationError in interface ValidationErrorAwarepublic void setValidationError(ValidationError error)
setValidationError in interface ValidationErrorAwarepublic boolean validate()
validate in interface Widgetvalidate in class AbstractContainerWidgettrue only if all contained widgets are valid and the
extra validation rules on this containment level are ok.Widget.validate()public String getXMLElementName()
AbstractWidgetAbstractWidget.generateSaxFragment(ContentHandler, Locale)
to produce the wrapping element for all the XML-instance-content of this Widget.
getXMLElementName in class AbstractWidgetpublic String getId()
AbstractWidget
getId in interface WidgetgetId in class AbstractWidgetnull
Top-level container widgets (like 'form') should return ""AbstractWidget.getId()public void setId(String value)
value - A new id.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||