org.apache.cocoon.woody.formmodel
Class Output

java.lang.Object
  extended by org.apache.cocoon.woody.formmodel.AbstractWidget
      extended by org.apache.cocoon.woody.formmodel.Output
All Implemented Interfaces:
DataWidget, Widget

public class Output
extends AbstractWidget
implements DataWidget

An Output widget can be used to show a non-editable value to the user. An Output widget is associated with a certain Datatype.

An Output widget is always valid and never required.

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

Constructor Summary
protected Output(OutputDefinition definition)
           
 
Method Summary
 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.
 Datatype getDatatype()
           
 String getId()
          Gets the id of this widget.
 OutputDefinition getOutputDefinition()
           
 Object getValue()
          Returns the value of the widget.
 void readFromRequest(FormContext formContext)
          Lets this widget read its data from a request.
 void setValue(Object object)
          Sets the value of this widget to the given object.
 boolean validate(FormContext formContext)
          Validates this widget and returns the outcome.
 
Methods inherited from class org.apache.cocoon.woody.formmodel.AbstractWidget
addValidator, broadcastEvent, generateItemSaxFragment, generateSaxFragment, getForm, getFullyQualifiedId, getLocation, getNamespace, getParent, getWidget, isRequired, removeValidator, setDefinition, setLocation, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.woody.formmodel.Widget
broadcastEvent, getForm, getFullyQualifiedId, getLocation, getNamespace, getParent, getWidget, isRequired, setParent
 

Constructor Detail

Output

protected Output(OutputDefinition definition)
Method Detail

getOutputDefinition

public OutputDefinition getOutputDefinition()

getDatatype

public Datatype getDatatype()
Specified by:
getDatatype in interface DataWidget

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.

Specified by:
readFromRequest in interface Widget

validate

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

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).

Specified by:
generateSaxFragment in interface Widget
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

getValue

public Object getValue()
Description copied from interface: Widget
Returns the value of the widget. For some widgets (notably ContainerWidgets) this may not make sense, those should then simply return null here.

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

setValue

public void setValue(Object object)
Description copied from interface: Widget
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.

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


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