org.apache.cocoon.forms.formmodel
Interface WidgetDefinition

All Superinterfaces:
Locatable
All Known Subinterfaces:
ContainerDefinition
All Known Implementing Classes:
AbstractContainerDefinition, AbstractDatatypeWidgetDefinition, AbstractWidgetDefinition, ActionDefinition, AggregateFieldDefinition, BooleanFieldDefinition, CalculatedFieldDefinition, CaptchaFieldDefinition, ClassDefinition, FieldDefinition, FormDefinition, GoogleMapDefinition, GroupDefinition, ImageMapDefinition, MessagesDefinition, MultiValueFieldDefinition, NewDefinition, OutputDefinition, RepeaterActionDefinition, RepeaterActionDefinition.AddRowActionDefinition, RepeaterActionDefinition.ChangePageActionDefinition, RepeaterActionDefinition.DeleteRowsActionDefinition, RepeaterActionDefinition.InsertRowsActionDefinition, RepeaterActionDefinition.SortActionDefinition, RepeaterDefinition, RepeaterFilterFieldDefinition, RowActionDefinition, RowActionDefinition.AddAfterDefinition, RowActionDefinition.DeleteRowDefinition, RowActionDefinition.MoveDownDefinition, RowActionDefinition.MoveUpDefinition, StructDefinition, SubmitDefinition, TreeDefinition, UnionDefinition, UploadDefinition

public interface WidgetDefinition
extends 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 1304258 2012-03-23 10:09:27Z 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.
 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

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

Throws:
Exception

getFormDefinition

FormDefinition getFormDefinition()
Gets the FormDefinition.


getEnclosingLibrary

Library getEnclosingLibrary()
Gets the Library object containing this definition


setEnclosingLibrary

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


setParent

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


getLocation

Location getLocation()
Gets source location of this widget definition.

Specified by:
getLocation in interface Locatable
Returns:
the location

getId

String getId()
Gets id of this widget definition.


getAttribute

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

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

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

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


generateDisplayData

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

Throws:
SAXException

generateDisplayData

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

Throws:
SAXException

generateLabel

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

Throws:
SAXException


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