org.apache.tapestry.spec
Interface IComponentSpecification

All Superinterfaces:
ILocatable, ILocationHolder, IPropertyHolder
All Known Implementing Classes:
ComponentSpecification

public interface IComponentSpecification
extends IPropertyHolder, ILocationHolder, ILocatable

A specification for a component, as read from an XML specification file.

A specification consists of

From this information, an actual component may be instantiated and initialized. Instantiating a component is usually a recursive process, since to initialize a container component, it is necessary to instantiate and initialize its contained components as well.

Version:
$Id: IComponentSpecification.java 243791 2004-02-19 17:38:13Z hlship $
Author:
glongman@intelligentworks.com
See Also:
IComponent, IContainedComponent, IComponentSpecification, IPageLoader

Method Summary
 void addAsset(String name, IAssetSpecification asset)
           
 void addBeanSpecification(String name, IBeanSpecification specification)
           
 void addComponent(String id, IContainedComponent component)
           
 void addParameter(String name, IParameterSpecification spec)
          Adds the parameter.
 void addPropertySpecification(IPropertySpecification spec)
          Adds a new property specification.
 void addReservedParameterName(String value)
          Adds the value as a reserved name.
 boolean getAllowBody()
          Returns true if the component is allowed to wrap other elements (static HTML or other components).
 boolean getAllowInformalParameters()
          Returns true if the component allows informal parameters (parameters not formally defined).
 IAssetSpecification getAsset(String name)
          Returns the IAssetSpecification with the given name, or null if no such specification exists.
 List getAssetNames()
          Returns a List of the String names of all assets, in alphabetical order
 Collection getBeanNames()
          Returns an unmodifiable collection of the names of all beans.
 IBeanSpecification getBeanSpecification(String name)
          Returns the IBeanSpecification for the given name, or null if not such specification exists.
 IContainedComponent getComponent(String id)
          Returns the specification of a contained component with the given id, or null if no such contained component exists.
 String getComponentClassName()
           
 List getComponentIds()
          Returns an List of the String names of the IContainedComponents for this component.
 String getDescription()
          Returns the documentation for this component.
 IParameterSpecification getParameter(String name)
          Returns the specification of a parameter with the given name, or null if no such parameter exists.
 List getParameterNames()
          Returns a List of of String names of all parameters.
 IPropertySpecification getPropertySpecification(String name)
          Returns the named IPropertySpecification, or null if no such specification exist.
 List getPropertySpecificationNames()
          Returns a sorted, immutable list of the names of all IPropertySpecifications.
 String getPublicId()
          Returns the XML Public Id for the specification file, or null if not applicable.
 IResourceLocation getSpecificationLocation()
           
 boolean isPageSpecification()
          Returns true if the specification is known to be a page specification and not a component specification.
 boolean isReservedParameterName(String value)
          Returns true if the value specified is in the reserved name list.
 void setAllowBody(boolean value)
           
 void setAllowInformalParameters(boolean value)
           
 void setComponentClassName(String value)
           
 void setDescription(String description)
          Sets the documentation for this component.
 void setPageSpecification(boolean pageSpecification)
           
 void setPublicId(String publicId)
           
 void setSpecificationLocation(IResourceLocation specificationLocation)
           
 
Methods inherited from interface org.apache.tapestry.util.IPropertyHolder
getProperty, getPropertyNames, removeProperty, setProperty
 
Methods inherited from interface org.apache.tapestry.ILocationHolder
setLocation
 
Methods inherited from interface org.apache.tapestry.ILocatable
getLocation
 

Method Detail

addAsset

void addAsset(String name,
              IAssetSpecification asset)
Throws:
IllegalArgumentException - if the name already exists.

addComponent

void addComponent(String id,
                  IContainedComponent component)
Throws:
IllegalArgumentException - if the id is already defined.

addParameter

void addParameter(String name,
                  IParameterSpecification spec)
Adds the parameter. The name is added as a reserved name.

Throws:
IllegalArgumentException - if the name already exists.

getAllowBody

boolean getAllowBody()
Returns true if the component is allowed to wrap other elements (static HTML or other components). The default is true.

See Also:
setAllowBody(boolean)

getAllowInformalParameters

boolean getAllowInformalParameters()
Returns true if the component allows informal parameters (parameters not formally defined). Informal parameters are generally used to create additional HTML attributes for an HTML tag rendered by the component. This is often used to specify JavaScript event handlers or the class of the component (for Cascarding Style Sheets).

The default value is true.

See Also:
setAllowInformalParameters(boolean)

getAsset

IAssetSpecification getAsset(String name)
Returns the IAssetSpecification with the given name, or null if no such specification exists.

See Also:
addAsset(String,IAssetSpecification)

getAssetNames

List getAssetNames()
Returns a List of the String names of all assets, in alphabetical order


getComponent

IContainedComponent getComponent(String id)
Returns the specification of a contained component with the given id, or null if no such contained component exists.

See Also:
addComponent(String, IContainedComponent)

getComponentClassName

String getComponentClassName()

getComponentIds

List getComponentIds()
Returns an List of the String names of the IContainedComponents for this component.

See Also:
addComponent(String, IContainedComponent)

getParameter

IParameterSpecification getParameter(String name)
Returns the specification of a parameter with the given name, or null if no such parameter exists.

See Also:
addParameter(String, IParameterSpecification)

getParameterNames

List getParameterNames()
Returns a List of of String names of all parameters. This list is in alphabetical order.

See Also:
addParameter(String, IParameterSpecification)

setAllowBody

void setAllowBody(boolean value)

setAllowInformalParameters

void setAllowInformalParameters(boolean value)

setComponentClassName

void setComponentClassName(String value)

addBeanSpecification

void addBeanSpecification(String name,
                          IBeanSpecification specification)
Throws:
IllegalArgumentException - if the bean already has a specification.
Since:
1.0.4

getBeanSpecification

IBeanSpecification getBeanSpecification(String name)
Returns the IBeanSpecification for the given name, or null if not such specification exists.

Since:
1.0.4

getBeanNames

Collection getBeanNames()
Returns an unmodifiable collection of the names of all beans.


addReservedParameterName

void addReservedParameterName(String value)
Adds the value as a reserved name. Reserved names are not allowed as the names of informal parameters. Since the comparison is caseless, the value is converted to lowercase before being stored.

Since:
1.0.5

isReservedParameterName

boolean isReservedParameterName(String value)
Returns true if the value specified is in the reserved name list. The comparison is caseless. All formal parameters are automatically in the reserved name list, as well as any additional reserved names specified in the component specification. The latter refer to HTML attributes generated directly by the component.

Since:
1.0.5

getDescription

String getDescription()
Returns the documentation for this component.

Since:
1.0.9

setDescription

void setDescription(String description)
Sets the documentation for this component.

Since:
1.0.9

getPublicId

String getPublicId()
Returns the XML Public Id for the specification file, or null if not applicable.

This method exists as a convienience for the Spindle plugin. A previous method used an arbitrary version string, the public id is more useful and less ambiguous.

Since:
2.2

setPublicId

void setPublicId(String publicId)
Since:
2.2

isPageSpecification

boolean isPageSpecification()
Returns true if the specification is known to be a page specification and not a component specification. Earlier versions of the framework did not distinguish between the two, but starting in 2.2, there are seperate XML entities for pages and components. Pages omit several attributes and entities related to parameters, as parameters only make sense for components.

Since:
2.2

setPageSpecification

void setPageSpecification(boolean pageSpecification)
Since:
2.2

getSpecificationLocation

IResourceLocation getSpecificationLocation()
Since:
3.0

setSpecificationLocation

void setSpecificationLocation(IResourceLocation specificationLocation)
Since:
3.0

addPropertySpecification

void addPropertySpecification(IPropertySpecification spec)
Adds a new property specification. The name of the property must not already be defined (and must not change after being added).

Since:
3.0

getPropertySpecificationNames

List getPropertySpecificationNames()
Returns a sorted, immutable list of the names of all IPropertySpecifications.

Since:
3.0

getPropertySpecification

IPropertySpecification getPropertySpecification(String name)
Returns the named IPropertySpecification, or null if no such specification exist.

Since:
3.0
See Also:
addPropertySpecification(IPropertySpecification)