|
||||||||||
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.Action
public class Action
An Action widget. An Action widget can cause an ActionEvent
to be triggered
on the server side, which will be handled by either the event handlers defined in the
form definition, and/or by the FormHandler
registered with the form, if any. An Action widget can e.g. be rendered as a button,
or as a hidden field which gets its value set by javascript. The Action widget will generate its associated
ActionEvent when a requestparameter is present with as name the id of this Action widget, and as
value a non-empty value.
Field Summary |
---|
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 | |
---|---|
Action(ActionDefinition definition)
|
Method Summary | |
---|---|
void |
addActionListener(ActionListener listener)
Adds a ActionListener to this widget instance. |
void |
broadcastEvent(WidgetEvent event)
Broadcast an event previously queued by this widget to its event listeners. |
WidgetDefinition |
getDefinition()
Concrete subclasses should allow access to their underlaying Definition through this method. |
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. |
protected void |
handleActivate()
Handle the fact that this action was activated. |
boolean |
isValid()
Return the current validation state. |
void |
performAction()
Performs all actions and calls on-action listeners attached to this object. |
void |
readFromRequest(FormContext formContext)
Lets this widget read its data from a request. |
void |
removeActionListener(ActionListener listener)
|
boolean |
validate()
Always return true (an action has no validation)
TODO is there a use case for actions having validators? |
Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget |
---|
addValidator, generateDisplayData, generateItemSaxFragment, generateLabel, generateSaxFragment, getAttribute, getChild, getCombinedState, getForm, getFullName, getId, getLocation, getName, getParent, getRequestParameterName, getState, getValue, getWidget, getXMLElementAttributes, initialize, isRequired, 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 |
Constructor Detail |
---|
public Action(ActionDefinition 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 readFromRequest(FormContext formContext)
Widget
readFromRequest
in interface Widget
public void performAction()
protected void handleActivate()
performAction()
public boolean validate()
true
(an action has no validation)
validate
in interface Widget
validate
in class AbstractWidget
true
to indicate all validations were ok,
false
otherwiseWidget.validate()
public boolean isValid()
Widget
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.
isValid
in interface Widget
isValid
in class AbstractWidget
Widget.validate()
.Widget.isValid()
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 void addActionListener(ActionListener listener)
addActionListener
in interface ActionListenerEnabled
public void removeActionListener(ActionListener listener)
removeActionListener
in interface ActionListenerEnabled
public void broadcastEvent(WidgetEvent event)
AbstractWidget
UnsupportedOperationException
.
Concrete subclass widgets need to override when supporting event broadcasting.
broadcastEvent
in interface Widget
broadcastEvent
in class AbstractWidget
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |