| org.apache.cocoon.woody.formmodel.Widget
All known Subclasses: org.apache.cocoon.woody.formmodel.AbstractWidget,
Widget | public interface Widget (Code) | | Interface to be implemented by Widgets. In Woody, a form consists of a number
of widgets. Each widget:
Because widgets can have children, the widgets form a widget tree, with its root
being the
Form widget.
A widget can have only a value, or only child widgets, or can have both a value and child
widgets, or can have neither. This all depends on the widget implementation.
When a request is submitted, first the
Widget.readFromRequest(FormContext) method of all widgets
will be called so that they can read their value(s). Next, the
Widget.validate(FormContext) method will
be called. Doing this in two steps allows the validation to compare values between widgets.
See also the method
Form.process(FormContext) .
A Widget is created by calling the createInstance method on the a
WidgetDefinition . A Widget holds all the data that is specific for
a certain use of the widget (its value, validationerrors, ...), while the
WidgetDefinition holds the data that is static accross all widgets. This
keeps the Widgets small and light to create. This mechanism is similar to
classes and objects in Java.
version: CVS $Id: Widget.java 433543 2006-08-22 06:22:54Z crossley $ |
broadcastEvent | public void broadcastEvent(WidgetEvent event)(Code) | | Broadcast an event previously queued by this widget to its event listeners.
|
generateLabel | public void generateLabel(ContentHandler contentHandler) throws SAXException(Code) | | Generates SAX events for the label of this widget. The label will not be wrapped
inside another element.
|
generateSaxFragment | public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException(Code) | | Generates an XML representation of this widget. The startDocument and endDocument
SAX events will not be called. It is assumed that the prefix for the Woody namespace
mentioned in Constants.WI_PREFIX is already declared (by the caller or otherwise).
|
getForm | public Form getForm()(Code) | | Get the
Form to which this widget belongs. The form is the top-most ancestor
of the widget.
|
getFullyQualifiedId | public String getFullyQualifiedId()(Code) | | Returns the id prefixed with the namespace, this name should be unique
accross all widgets on the form.
|
getId | public String getId()(Code) | | Returns the id of this widget.
|
getLocation | public String getLocation()(Code) | | Gets the source location of this widget.
|
getNamespace | public String getNamespace()(Code) | | Gets the namespace of this widget. The combination of a widget's namespace
with its id (see
Widget.getId() gives the widget a form-wide unique name.
In practice, the namespace consists of the id's of the widget's parent widgets,
separated by dots.
|
getParent | public Widget getParent()(Code) | | Gets the parent of this widget. If this widget is the root widget,
this method returns null.
|
getValue | public Object getValue()(Code) | | Returns the value of the widget. For some widgets (notably ContainerWidgets)
this may not make sense, those should then simply return null here.
|
getWidget | public Widget getWidget(String id)(Code) | | Gets the child widget of this widget with the given id, or null if there isn't such a child.
|
isRequired | public boolean isRequired()(Code) | | Returns wether this widget is required to be filled in. As with
Widget.getValue() , for some
widgets this may not make sense, those should return false here.
|
readFromRequest | public void readFromRequest(FormContext formContext)(Code) | | Lets this widget read its data from a request. At this point the Widget
may try to convert the request parameter to its native datatype (if it
is not a string), but it should not yet generate any validation errors.
|
setParent | public void setParent(Widget widget)(Code) | | This method is called on a widget when it is added to a container.
You shouldn't call this method unless youre implementing a widget yourself (in
which case it should be called when a widget is added as child of your widget).
|
setValue | public void setValue(Object object)(Code) | | Sets the value of this widget to the given object. Some widgets may not support this
method, those should throw an runtime exception if you try to set their value anyway.
|
|
|