org.apache.cocoon.forms.formmodel
Interface WidgetDefinition

All Superinterfaces:
org.apache.cocoon.util.location.Locatable
All Known Subinterfaces:
ContainerDefinition
All Known Implementing Classes:
AbstractContainerDefinition, AbstractWidgetDefinition

public interface WidgetDefinition
extends org.apache.cocoon.util.location.Locatable

A WidgetDefinition holds all the static information about a Widget. It's function is a lot like that of the class in Java. Users of the Cocoon Forms framework usually won't have to bother with the WidgetDefinition's, but will rather use the Widget's themselves.

Version:
$Id: WidgetDefinition.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Method Summary
 void checkCompleteness()
          Checks whether this definition is complete since we are allowed to have partial definitions in libraries.
 Widget createInstance()
          Creates and returns a widget based on this widget definition.
 void generateDisplayData(ContentHandler contentHandler)
          Generates SAX events for display data.
 void generateDisplayData(String name, ContentHandler contentHandler)
          Generates SAX events for named display data.
 void generateLabel(ContentHandler contentHandler)
          Generates SAX events for the label of this widget.
 Object getAttribute(String name)
          Gets an attribute that has been defined on the widget's definition.
 Library getEnclosingLibrary()
          Gets the Library object containing this definition
 FormDefinition getFormDefinition()
          Gets the FormDefinition.
 String getId()
          Gets id of this widget definition.
 org.apache.cocoon.util.location.Location getLocation()
          Gets source location of this widget definition.
 void initializeFrom(WidgetDefinition definition)
          Initializes this definition with values from the given other definition
 void setEnclosingLibrary(Library library)
          Sets the Library object containing this definition (should only be used by Library itself!)
 void setParent(WidgetDefinition definition)
          Sets the parent of this definition.
 boolean validate(Widget widget)
          Validate a widget using the validators that were defined in its definition.
 

Method Detail

initializeFrom

public void initializeFrom(WidgetDefinition definition)
                    throws Exception
Initializes this definition with values from the given other definition

Throws:
Exception

getFormDefinition

public FormDefinition getFormDefinition()
Gets the FormDefinition.


getEnclosingLibrary

public Library getEnclosingLibrary()
Gets the Library object containing this definition


setEnclosingLibrary

public void setEnclosingLibrary(Library library)
Sets the Library object containing this definition (should only be used by Library itself!)


setParent

public void setParent(WidgetDefinition definition)
Sets the parent of this definition.


getLocation

public org.apache.cocoon.util.location.Location getLocation()
Gets source location of this widget definition.

Specified by:
getLocation in interface org.apache.cocoon.util.location.Locatable

getId

public String getId()
Gets id of this widget definition.


getAttribute

public Object getAttribute(String name)
Gets an attribute that has been defined on the widget's definition.

Parameters:
name - the attribute name
Returns:
the attribute value, or null if it doesn't exist

validate

public boolean validate(Widget widget)
Validate a widget using the validators that were defined in its definition. If validation fails, the validator has set a validation error on the widget or one of its children.

Parameters:
widget - the widget
Returns:
true if validation was successful.

checkCompleteness

public void checkCompleteness()
                       throws IncompletenessException
Checks whether this definition is complete since we are allowed to have partial definitions in libraries. Definitions need to be complete _before_ a call to createInstance() though.

Throws:
IncompletenessException

createInstance

public Widget createInstance()
Creates and returns a widget based on this widget definition.


generateDisplayData

public void generateDisplayData(String name,
                                ContentHandler contentHandler)
                         throws SAXException
Generates SAX events for named display data.

Throws:
SAXException

generateDisplayData

public void generateDisplayData(ContentHandler contentHandler)
                         throws SAXException
Generates SAX events for display data.

Throws:
SAXException

generateLabel

public void generateLabel(ContentHandler contentHandler)
                   throws SAXException
Generates SAX events for the label of this widget.

Throws:
SAXException


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.