| java.lang.Object org.apache.cocoon.forms.formmodel.AbstractWidget
All known Subclasses: org.apache.cocoon.forms.formmodel.tree.Tree, org.apache.cocoon.forms.formmodel.Repeater, org.apache.cocoon.forms.formmodel.Upload, org.apache.cocoon.forms.formmodel.Messages, org.apache.cocoon.forms.formmodel.AbstractContainerWidget, org.apache.cocoon.forms.formmodel.Field, org.apache.cocoon.forms.formmodel.Action, org.apache.cocoon.forms.formmodel.Output, org.apache.cocoon.forms.formmodel.MultiValueField, org.apache.cocoon.forms.formmodel.ImageMap, org.apache.cocoon.forms.formmodel.GoogleMap, org.apache.cocoon.forms.formmodel.BooleanField,
AbstractWidget | abstract public class AbstractWidget implements Widget(Code) | | Abstract base class for Widget implementations. Provides functionality
common to many widgets.
version: $Id: AbstractWidget.java 449149 2006-09-23 03:58:05Z crossley $ |
Method Summary | |
public void | addValidator(WidgetValidator validator) Add a validator to this widget instance. | public void | broadcastEvent(WidgetEvent event) Abstract implementation throws a
UnsupportedOperationException . | protected void | generateDisplayData(ContentHandler contentHandler) Delegates to the
AbstractWidget.getDefinition() of this widget to generate a common
set of 'display' data. | protected void | generateItemSaxFragment(ContentHandler contentHandler, Locale locale) Generates nested additional content nested inside the main element for this
widget which is generated by
AbstractWidget.generateSaxFragment(ContentHandler,Locale) The implementation on the AbstractWidget level inserts no additional XML. | public void | generateLabel(ContentHandler contentHandler) Delegates to the
AbstractWidget.getDefinition() to generate the 'label' part of
the display-data of this widget. | public void | generateSaxFragment(ContentHandler contentHandler, Locale locale) This will generate some standard XML consisting of a simple wrapper
element (name provided by
AbstractWidget.getXMLElementName() ) with attributes
(provided by
AbstractWidget.getXMLElementAttributes() around anything injected
in by both
AbstractWidget.generateDisplayData(ContentHandler) and
AbstractWidget.generateItemSaxFragment(ContentHandler,Locale) .
<fi:
AbstractWidget.getXMLElementName()
AbstractWidget.getXMLElementAttributes() >
AbstractWidget.generateDisplayData(ContentHandler) (i.e. | public Object | getAttribute(String name) | protected Widget | getChild(String id) Concrete widgets that contain actual child widgets should override to
return the actual child-widget. | public WidgetState | getCombinedState() | abstract public WidgetDefinition | getDefinition() Concrete subclasses should allow access to their underlaying Definition
through this method. | public Form | getForm() | public String | getFullName() | public String | getId() Gets the id of this widget. | public Location | getLocation() | public String | getName() | final public Widget | getParent() | public String | getRequestParameterName() | public WidgetState | getState() | public Object | getValue() | public Widget | getWidget(String id) | protected AttributesImpl | getXMLElementAttributes() The XML attributes used in
AbstractWidget.generateSaxFragment(ContentHandler,Locale) to be placed on the wrapping element for all the XML-instance-content of this Widget.
This automatically adds @id=
AbstractWidget.getRequestParameterName() to that element.
Concrete subclasses should call super.getXMLElementAttributes and possibly
add additional attributes.
Note: the @id is not added for those widgets who's getId() returns null
(e.g. | abstract protected 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. | public 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. | public boolean | isRequired() | public boolean | isValid() | public Widget | lookupWidget(String path) | public void | removeAttribute(String name) | public boolean | removeValidator(WidgetValidator validator) | public void | setAttribute(String name, Object value) | public void | setParent(Widget widget) Sets the parent-widget of this widget. | public void | setState(WidgetState state) | public void | setValue(Object object) | public String | toString() | public boolean | validate() | protected void | widgetNameChanged() Should be called when a widget's own name has changed, in order to clear
internal caches used to compute request parameters. |
addValidator | public void addValidator(WidgetValidator validator)(Code) | | Add a validator to this widget instance.
Parameters: validator - |
generateItemSaxFragment | protected void generateItemSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException(Code) | | Generates nested additional content nested inside the main element for this
widget which is generated by
AbstractWidget.generateSaxFragment(ContentHandler,Locale) The implementation on the AbstractWidget level inserts no additional XML.
Subclasses need to override to insert widget specific content.
Parameters: contentHandler - to send the SAX events to Parameters: locale - in which context potential content needs to be put. throws: SAXException - |
getChild | protected Widget getChild(String id)(Code) | | Concrete widgets that contain actual child widgets should override to
return the actual child-widget.
Parameters: id - of the child-widget null if not overriden. |
getForm | public Form getForm()(Code) | | the form where this widget belongs to. |
getId | public String getId()(Code) | | Gets the id of this widget.
|
getLocation | public Location getLocation()(Code) | | the location-information (file, line and column) where this widget wasconfigured. |
getParent | final public Widget getParent()(Code) | | The parent-widget of this widget. |
getRequestParameterName | public String getRequestParameterName()(Code) | | |
getXMLElementAttributes | protected AttributesImpl getXMLElementAttributes()(Code) | | The XML attributes used in
AbstractWidget.generateSaxFragment(ContentHandler,Locale) to be placed on the wrapping element for all the XML-instance-content of this Widget.
This automatically adds @id=
AbstractWidget.getRequestParameterName() to that element.
Concrete subclasses should call super.getXMLElementAttributes and possibly
add additional attributes.
Note: the @id is not added for those widgets who's getId() returns null
(e.g. top-level container widgets like 'form'). The contract of returning a non-null
AttributesImpl is however maintained.
the attributes for the main element for this widget's sax-fragment. |
initialize | public 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 | public boolean isRequired()(Code) | | |
removeAttribute | public void removeAttribute(String name)(Code) | | |
removeValidator | public boolean removeValidator(WidgetValidator validator)(Code) | | Remove a validator from this widget instance
Parameters: validator - true if the validator was found. |
setParent | public void setParent(Widget widget)(Code) | | Sets the parent-widget of this widget.
This is a write-once property.
Parameters: widget - the parent-widget of this one. throws: IllegalStateException - when the parent had already been set. |
widgetNameChanged | protected void widgetNameChanged()(Code) | | Should be called when a widget's own name has changed, in order to clear
internal caches used to compute request parameters.
|
|
|