org.apache.cocoon.forms.formmodel
Class WidgetList

java.lang.Object
  extended by org.apache.cocoon.forms.formmodel.WidgetList

public class WidgetList
extends Object

Helper class for the implementation of widgets containing other widgets. This implements a type-aware List of Widgets that automatically can distribute the common Widget operations over the contained Widgets.

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

Constructor Summary
WidgetList()
          Constructs ContainerDelegate to store and jointly manage a list of contained widgets.
 
Method Summary
 void addWidget(Widget widget)
          Adds a widget to the list of contained Widget's
 void generateSaxFragment(ContentHandler contentHandler, Locale locale)
          Generates the SAXfragments of the contained widgets
 Widget getWidget(String id)
          Looks for a widget in this list by using the provided id as a lookup key.
 List getWidgetList()
          Get the (unmodifiable) list of widgets
 Map getWidgetMap()
          Get the (unmodifiable) map of widgets
 boolean hasWidget(String id)
          Checks if a widget with the provided id is contained in the list.
 Iterator iterator()
           
 void readFromRequest(FormContext formContext)
          Performs the Widget.readFromRequest(FormContext) on all the contained widgets.
 boolean validate()
          Validates all contained widgets and returns the combined result.
 boolean widgetsHaveValues()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WidgetList

public WidgetList()
Constructs ContainerDelegate to store and jointly manage a list of contained widgets.

Method Detail

getWidgetList

public List getWidgetList()
Get the (unmodifiable) list of widgets

Returns:
the widget list

getWidgetMap

public Map getWidgetMap()
Get the (unmodifiable) map of widgets

Returns:
the widget map

addWidget

public void addWidget(Widget widget)
Adds a widget to the list of contained Widget's

Parameters:
widget -

readFromRequest

public void readFromRequest(FormContext formContext)
Performs the Widget.readFromRequest(FormContext) on all the contained widgets.

Parameters:
formContext - to pass to the Widget.readFromRequest(FormContext)
See Also:
Widget.readFromRequest(FormContext)

validate

public boolean validate()
Validates all contained widgets and returns the combined result.

Returns:
false if at least one of the contained widgets is not valid.
See Also:
Widget.validate()

hasWidget

public boolean hasWidget(String id)
Checks if a widget with the provided id is contained in the list.

Parameters:
id - of the widget to look for.
Returns:
true if the widget was found

getWidget

public Widget getWidget(String id)
Looks for a widget in this list by using the provided id as a lookup key.

Parameters:
id - of the widget to look for
Returns:
the found widget or null if it could not be found.

iterator

public Iterator iterator()
Returns:
an iterator over the contained Widget's

widgetsHaveValues

public boolean widgetsHaveValues()
Returns:
false if at least one of the contained widgets has no value.

generateSaxFragment

public void generateSaxFragment(ContentHandler contentHandler,
                                Locale locale)
                         throws SAXException
Generates the SAXfragments of the contained widgets

Parameters:
contentHandler -
locale -
Throws:
SAXException
See Also:
Widget.generateSaxFragment(ContentHandler, Locale)


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