org.apache.cocoon.woody.formmodel
Class Messages

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

public class Messages
extends AbstractWidget

A widget to output one or messages. This widget doesn't respond to input from the user, except that on each form submit the messages are cleared.

This widget is typically used to communicate extra validation errors or other messages to the user, that aren't associated with any other widget in particular.

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

Constructor Summary
protected Messages(MessagesDefinition definition)
           
 
Method Summary
 void addMessage(String message)
          Adds a string message.
 void addMessage(XMLizable message)
          Adds a message in the form an object that implements the XMLizable interface.
 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.
 void readFromRequest(FormContext formContext)
          Lets this widget read its data from a request.
 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, 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
 

Constructor Detail

Messages

protected Messages(MessagesDefinition 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.


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

addMessage

public void addMessage(String message)
Adds a string message.


addMessage

public void addMessage(XMLizable message)
Adds a message in the form an object that implements the XMLizable interface. This allows to add messages that produce mixed content. The XMLizable should only generate a SAX fragment, i.e. without start/endDocument calls.

A useful implementation is I18nMesage.


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


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