|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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()
AbstractWidget
null
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 Widget
getDefinition
in class AbstractWidget
WidgetDefinition.createInstance()
)public void initialize()
initialize
in interface Widget
initialize
in class AbstractContainerWidget
public String getXMLElementName()
AbstractWidget
AbstractWidget.generateSaxFragment(ContentHandler, Locale)
to produce the wrapping element for all the XML-instance-content of this Widget.
getXMLElementName
in class AbstractWidget
public Object getValue()
Widget
Not all widgets do have a value (notably ContainerWidget
s,
but this method is provided here as a convenience to ease writing and avoiding casts.
getValue
in interface Widget
getValue
in class AbstractWidget
public void readFromRequest(FormContext formContext)
AbstractContainerWidget
super.readFromRequest()
to allow child-widgets to process the request.
Overide only to add possible request-reading statements on the containment level.
readFromRequest
in interface Widget
readFromRequest
in class AbstractContainerWidget
formContext
- to be passed to the Widget.readFromRequest(FormContext)
of the contained widgets.public boolean validate()
AbstractContainerWidget
validate()
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 Widget
validate
in class AbstractContainerWidget
true
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 ContainerWidget
getChild
in class AbstractContainerWidget
id
- of the child-widget
null
if not overriden.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |