|
||||||||||
| 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.Union
public class Union
A discriminated union that references a discriminant value in another widget and contains one of several cases (widgets). To have a case hold more than one widget or to use a different id for the case than for the widget id, just wrap the widget(s) in a container widget named with the desired case id.
| Field Summary | |
|---|---|
protected String |
caseValue
|
| 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 | |
|---|---|
Union(UnionDefinition definition)
|
|
| Method Summary | |
|---|---|
Widget |
getChild(String id)
Concrete widgets that contain actual child widgets should override to return the actual child-widget. |
WidgetDefinition |
getDefinition()
Concrete subclasses should allow access to their underlaying Definition through this method. |
Object |
getValue()
Get the value of a widget. |
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. |
void |
initialize()
Called after widget's environment has been setup, to allow for any contextual initalization such as looking up case widgets for union widgets. |
void |
readFromRequest(FormContext formContext)
Delegates the readFromRequest() down to the contained child-widgets. |
boolean |
validate()
Delegates the validate() down to the contained child-widgets,
and validates the extra rules on this containment level regardless of
children widget's validities. |
| Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractContainerWidget |
|---|
addChild, generateItemSaxFragment, getChildren, getSize, hasChild |
| Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget |
|---|
addValidator, broadcastEvent, generateDisplayData, generateLabel, generateSaxFragment, getAttribute, getCombinedState, getForm, getFullName, getId, getLocation, getName, getParent, getRequestParameterName, getState, getWidget, getXMLElementAttributes, isRequired, isValid, 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, getId, getLocation, getName, getParent, getRequestParameterName, getState, getWidget, isRequired, isValid, lookupWidget, removeAttribute, removeValidator, setAttribute, setParent, setState, setValue |
| Field Detail |
|---|
protected String caseValue
| Constructor Detail |
|---|
public Union(UnionDefinition definition)
| Method Detail |
|---|
public 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 initialize()
initialize in interface Widgetinitialize in class AbstractContainerWidgetpublic String getXMLElementName()
AbstractWidgetAbstractWidget.generateSaxFragment(ContentHandler, Locale)
to produce the wrapping element for all the XML-instance-content of this Widget.
getXMLElementName in class AbstractWidgetpublic Object getValue()
Widget
Not all widgets do have a value (notably ContainerWidgets,
but this method is provided here as a convenience to ease writing and avoiding casts.
getValue in interface WidgetgetValue in class AbstractWidgetpublic 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 boolean validate()
AbstractContainerWidgetvalidate() down to the contained child-widgets,
and validates the extra rules on this containment level regardless of
children widget's validities.
When overriding one should call super.validate() as the first
statement to keep in sync with this behaviour.
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 Widget getChild(String id)
AbstractWidget
getChild in interface ContainerWidgetgetChild in class AbstractContainerWidgetid - of the child-widget
null if not overriden.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||