org.apache.cocoon.woody.formmodel
Class Action

java.lang.Object
  extended by org.apache.cocoon.woody.formmodel.AbstractWidget
      extended by org.apache.cocoon.woody.formmodel.Action
All Implemented Interfaces:
Widget
Direct Known Subclasses:
RepeaterAction, RowAction, Submit

public class Action
extends AbstractWidget

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.

Version:
$Id: Action.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
protected  ActionDefinition definition
           
 
Constructor Summary
Action(ActionDefinition definition)
           
 
Method Summary
 void broadcastEvent(WidgetEvent event)
          Broadcast an event previously queued by this widget to its event listeners.
 void generateLabel(ContentHandler contentHandler)
          Generates SAX events for the label of this widget.
 void generateSaxFragment(ContentHandler contentHandler, Locale locale)
          Generates an XML representation of this widget.
 String getId()
          Gets the id of this widget.
protected  void handleActivate()
          Handle the fact that this action was activated.
 void readFromRequest(FormContext formContext)
          Lets this widget read its data from a request.
 boolean validate(FormContext formContext)
          Always return true (an action has no validation)
 
Methods inherited from class org.apache.cocoon.woody.formmodel.AbstractWidget
addValidator, generateItemSaxFragment, generateSaxFragment, getForm, getFullyQualifiedId, getLocation, getNamespace, getParent, getValue, getWidget, isRequired, removeValidator, setDefinition, setLocation, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

definition

protected ActionDefinition definition
Constructor Detail

Action

public Action(ActionDefinition definition)
Method Detail

getId

public String getId()
Description copied from class: AbstractWidget
Gets the id of this widget.

Specified by:
getId in interface Widget
Overrides:
getId in class AbstractWidget

readFromRequest

public void readFromRequest(FormContext formContext)
Description copied from interface: Widget
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.


handleActivate

protected void handleActivate()
Handle the fact that this action was activated. The default here is to end the current form processing and redisplay the form, which means that actual behaviour should be implemented in event listeners.


validate

public boolean validate(FormContext formContext)
Always return true (an action has no validation)

Specified by:
validate in interface Widget
Overrides:
validate in class AbstractWidget

generateSaxFragment

public void generateSaxFragment(ContentHandler contentHandler,
                                Locale locale)
                         throws SAXException
Description copied from interface: Widget
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).

Throws:
SAXException

generateLabel

public void generateLabel(ContentHandler contentHandler)
                   throws SAXException
Description copied from interface: Widget
Generates SAX events for the label of this widget. The label will not be wrapped inside another element.

Specified by:
generateLabel in interface Widget
Overrides:
generateLabel in class AbstractWidget
Throws:
SAXException

broadcastEvent

public void broadcastEvent(WidgetEvent event)
Description copied from interface: Widget
Broadcast an event previously queued by this widget to its event listeners.

Specified by:
broadcastEvent in interface Widget
Overrides:
broadcastEvent in class AbstractWidget


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.