| org.apache.cocoon.forms.formmodel.Widget
All known Subclasses: org.apache.cocoon.forms.formmodel.AbstractWidget,
Widget | public interface Widget extends Locatable(Code) | | Interface to be implemented by Widgets. In CForms, a form consists of a number
of widgets. Each widget:
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() 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: $Id: Widget.java 449149 2006-09-23 03:58:05Z crossley $ |
broadcastEvent | void broadcastEvent(WidgetEvent event)(Code) | | Broadcast an event previously queued by this widget to its event listeners.
|
generateLabel | 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 | 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 CForms namespace
mentioned in Constants.FI_PREFIX is already declared (by the caller or otherwise).
|
getAttribute | Object getAttribute(String name)(Code) | | Retrieves an attribute on this widget.
Parameters: name - of the attribute to lookup the found attribute or null if none was found with that name. |
getCombinedState | WidgetState getCombinedState()(Code) | | Get the widget's combined state, which is the strictest of its own state and parent state.
This combined state is the one that will be used by the widget to know if request
parameters should be considered and if some output must be produced.
See Also: WidgetState.strictest(WidgetStateWidgetState) the combined state |
getForm | Form getForm()(Code) | | the Form to which this widget belongs. The form is the top-most ancestorof the widget. |
getFullName | String getFullName()(Code) | | the name prefixed with the namespace, this name should be uniqueaccross all widgets on the form. |
getId | String getId()(Code) | | the id of this widget. This should never be null Top-level container widgets (like 'form') should return "" |
getLocation | Location getLocation()(Code) | | the source location of this widget. |
getName | String getName()(Code) | | the name of this widget. This should never be null Top-level container widgets (like 'form') should return "" |
getParent | Widget getParent()(Code) | | the parent of this widget. If this widget is the root widget,this method returns null. |
getRequestParameterName | String getRequestParameterName()(Code) | | the id prefixed with the namespace, this name should be uniqueaccross all widgets on the form. |
getState | WidgetState getState()(Code) | | Get the widget's own state. Note that this state is not the one actually considered
for handling requests and producing output. For these matters, the combined state is used.
See Also: Widget.getCombinedState() the widget's own state |
initialize | void initialize()(Code) | | Called after widget's environment has been setup,
to allow for any contextual initalization such as
looking up case widgets for union widgets.
|
isRequired | boolean isRequired()(Code) | | whether 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. |
isValid | boolean isValid()(Code) | | Return the current validation state.
This method delivers the same result as the last call to
Widget.validate() .
The validation process is not started again. If the value of this widget has
changed since the latest call to
Widget.validate() , the result of this method
is out of date.
The result of the last call to Widget.validate(). |
lookupWidget | Widget lookupWidget(String path)(Code) | | Finds a widget relative to this one based on a path-like
string (/-delimted) into the widget-tree structure.
This supports '../' and '/' to point to
the found widget or null if allong the traversalof the path an invalid section was encountered. |
readFromRequest | 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.
|
removeAttribute | void removeAttribute(String name)(Code) | | Removes the named attribute from this widget.
Parameters: name - of the attribute |
setAttribute | void setAttribute(String name, Object value)(Code) | | Sets an attribute on this widget. This can be used to store custom
data with each widget.
|
setParent | 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).
|
setState | void setState(WidgetState state)(Code) | | Set the widget's own state. This may change its combined state, and those of its
children, if any.
Parameters: state - the new wiget state |
validate | boolean validate()(Code) | | Validates this widget and returns the outcome. Possible error messages are
remembered by the widget itself and will be part of the XML produced by
this widget in its
Widget.generateSaxFragment(ContentHandler,Locale) method.
true to indicate all validations were ok,false otherwise |
|
|