|
|||||||||
| Home >> All >> org >> apache >> [ tapestry overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.tapestry
Interface IComponent

- All Superinterfaces:
- IRender, org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder
- All Known Subinterfaces:
- IAction, IDirect, IExternalPage, IForm, IPage, ITemplateComponent
- All Known Implementing Classes:
- AbstractComponent, AbstractPage, BaseComponent
- public interface IComponent
- extends IRender, org.apache.hivemind.LocationHolder
Defines an object which may be used to provide dynamic content on a Tapestry web page.
Components are created dynamically from thier class names (part of the org.apache.tapestry.spec.IComponentSpecification).
| Method Summary | |
void |
addAsset(java.lang.String name,
IAsset asset)
Adds an asset to the component. |
void |
addBody(IRender element)
Adds a new renderable element to the receiver's body. |
void |
addComponent(IComponent component)
Adds a component to a container. |
void |
finishLoad(IRequestCycle cycle,
org.apache.tapestry.engine.IPageLoader loader,
org.apache.tapestry.spec.IComponentSpecification specification)
Allows a component to finish any setup after it has been constructed. |
IAsset |
getAsset(java.lang.String name)
Returns the named asset, or null if not found. |
java.util.Map |
getAssets()
Returns the asset map for the component, which may be empty but will not be null. |
IBinding |
getBinding(java.lang.String name)
Returns the binding with the given name or null if not found. |
java.util.Collection |
getBindingNames()
Returns a java.util.Collection of the names of all bindings (which includes bindings for both formal and informal parameters). |
java.util.Map |
getBindings()
Returns a java.util.Map of the bindings for this component; this includes informal parameters as well as formal bindings. |
IComponent |
getComponent(java.lang.String id)
Retrieves an contained component by its id. |
java.util.Map |
getComponents()
Returns the contained components as an unmodifiable java.util.Map. |
IComponent |
getContainer()
Returns the component which embeds the receiver. |
java.lang.String |
getExtendedId()
Returns a string identifying the name of the page and the id path of the reciever within the page. |
java.lang.String |
getId()
Returns the simple id of the component, as defined in its specification. |
java.lang.String |
getIdPath()
Returns the qualified id of the component. |
java.lang.String |
getMessage(java.lang.String key)
Returns a localized string message. |
org.apache.hivemind.Messages |
getMessages()
Returns component strings for the component. |
INamespace |
getNamespace()
Returns the INamespace in which the component was defined (as an alias). |
IPage |
getPage()
Returns the page which ultimately contains the receiver. |
java.lang.Object |
getProperty(java.lang.String propertyName)
Gets a property of a component. |
org.apache.tapestry.spec.IComponentSpecification |
getSpecification()
Returns the specification which defines the component. |
java.lang.String |
getString(java.lang.String key)
Deprecated. To be removed in 3.1, use getMessage(String) 55 . |
void |
renderBody(IMarkupWriter writer,
IRequestCycle cycle)
Invoked to make the receiver render its body (the elements and components its tag wraps around, on its container's template). |
void |
setBinding(java.lang.String name,
IBinding binding)
Adds a binding to a container. |
void |
setContainer(IComponent value)
Sets the container of the component. |
void |
setId(java.lang.String value)
Sets the id of the component. |
void |
setNamespace(INamespace namespace)
Sets the INamespace for the component. |
void |
setPage(IPage value)
Sets the page which ultimiately contains the component. |
void |
setProperty(java.lang.String propertyName,
java.lang.Object value)
Sets a property of a component. |
void |
setSpecification(org.apache.tapestry.spec.IComponentSpecification value)
Sets the specification used by the component. |
| Methods inherited from interface org.apache.tapestry.IRender |
render |
| Methods inherited from interface org.apache.hivemind.LocationHolder |
setLocation |
| Methods inherited from interface org.apache.hivemind.Locatable |
getLocation |
| Method Detail |
addAsset
public void addAsset(java.lang.String name, IAsset asset)
- Adds an asset to the component. This is invoked from the page loader.
addComponent
public void addComponent(IComponent component)
- Adds a component to a container. Should only be called during the page
loading process, which is responsible for any checking.
addBody
public void addBody(IRender element)
- Adds a new renderable element to the receiver's body. The element may be either
another component, or static HTML. Such elements come from inside
the receiver's tag within its container's template, and represent static
text and other components.
The method
renderBody(IMarkupWriter, IRequestCycle)55 is used to render these elements.- Since:
- 2.2
getAssets
public java.util.Map getAssets()
- Returns the asset map for the component, which may be empty but will not be null.
The return value is unmodifiable.
getAsset
public IAsset getAsset(java.lang.String name)
- Returns the named asset, or null if not found.
getBinding
public IBinding getBinding(java.lang.String name)
- Returns the binding with the given name or null if not found.
Bindings are added to a component using
setBinding(String,IBinding)55 .
getBindingNames
public java.util.Collection getBindingNames()
- Returns a java.util.Collection of the names of all bindings (which includes
bindings for both formal and informal parameters).
The return value is unmodifiable. It will be null for a page, or may simply be empty for a component with no bindings.
getBindings
public java.util.Map getBindings()
- Returns a java.util.Map of the bindings for this component;
this includes informal parameters
as well as formal bindings.
- Since:
- 1.0.5
getComponent
public IComponent getComponent(java.lang.String id)
- Retrieves an contained component by its id.
Contained components have unique ids within their container.
getContainer
public IComponent getContainer()
- Returns the component which embeds the receiver. All components are contained within
other components, with the exception of the root page component.
A page returns null.
setContainer
public void setContainer(IComponent value)
- Sets the container of the component. This is write-once,
an attempt to change it later will throw an ApplicationRuntimeException.
getExtendedId
public java.lang.String getExtendedId()
- Returns a string identifying the name of the page and the id path of the reciever within
the page. Pages simply return their name.
getId
public java.lang.String getId()
- Returns the simple id of the component, as defined in its specification.
An id will be unique within the component which contains this component.
A page will always return null.
setId
public void setId(java.lang.String value)
- Sets the id of the component. This is write-once,
an attempt to change it later will throw an ApplicationRuntimeException.
getIdPath
public java.lang.String getIdPath()
- Returns the qualified id of the component. This represents a path from the
page to
this component, showing how components contain each other.
A page will always return null. A component contained on a page returns its simple id. Other components return their container's id path followed by a period and their own name.
getPage
public IPage getPage()
- Returns the page which ultimately contains the receiver. A page will return itself.
setPage
public void setPage(IPage value)
- Sets the page which ultimiately contains the component. This is write-once,
an attempt to change it later will throw an ApplicationRuntimeException.
getSpecification
public org.apache.tapestry.spec.IComponentSpecification getSpecification()
- Returns the specification which defines the component.
setSpecification
public void setSpecification(org.apache.tapestry.spec.IComponentSpecification value)
- Sets the specification used by the component. This is write-once, an attempt
to change it later will throw an ApplicationRuntimeException.
renderBody
public void renderBody(IMarkupWriter writer, IRequestCycle cycle)
- Invoked to make the receiver render its body (the elements and components
its tag wraps around, on its container's template).
This method is public so that the
org.apache.tapestry.components.RenderBodycomponent may operate.- Since:
- 2.2
setBinding
public void setBinding(java.lang.String name, IBinding binding)
- Adds a binding to a container. Should only be called during the page
loading process (which is responsible for eror checking).
getComponents
public java.util.Map getComponents()
- Returns the contained components as an unmodifiable java.util.Map. This
allows peer components to work together without directly involving their
container ... the classic example is to have an
org.apache.tapestry.components.Insertwork with an enclosingorg.apache.tapestry.components.Foreach.This is late addition to Tapestry, because it also opens the door to abuse, since it is quite possible to break the "black box" aspect of a component by interacting directly with components it embeds. This creates ugly interelationships between components that should be seperated.
finishLoad
public void finishLoad(IRequestCycle cycle, org.apache.tapestry.engine.IPageLoader loader, org.apache.tapestry.spec.IComponentSpecification specification)
- Allows a component to finish any setup after it has been constructed.
The exact timing is not specified, but any components contained by the receiving component will also have been constructed before this method is invoked.
As of release 1.0.6, this method is invoked before bindings are set. This should not affect anything, as bindings should only be used during renderring.
Release 2.2 added the cycle parameter which is, regretfully, not backwards compatible.
- Since:
- 0.2.12
getString
public java.lang.String getString(java.lang.String key)
- Deprecated. To be removed in 3.1, use
getMessage(String)55 .- Returns a localized string message. Each component has an optional set of localized message strings that are read from properties files.
- Since:
- 2.0.4
- Returns a localized string message. Each component has an optional set of localized message strings that are read from properties files.
getMessage
public java.lang.String getMessage(java.lang.String key)
- Returns a localized string message. Each component has an optional
set of localized message strings that are read from properties
files.
- Since:
- 3.0
getMessages
public org.apache.hivemind.Messages getMessages()
- Returns component strings for the component.
- Since:
- 3.0
getNamespace
public INamespace getNamespace()
- Returns the INamespace in which the component was defined
(as an alias).
- Since:
- 2.2
setNamespace
public void setNamespace(INamespace namespace)
- Sets the INamespace for the component. The namespace
should only be set once.
- Since:
- 2.2
setProperty
public void setProperty(java.lang.String propertyName, java.lang.Object value)
- Sets a property of a component.
getProperty
public java.lang.Object getProperty(java.lang.String propertyName)
- Gets a property of a component.
|
|||||||||
| Home >> All >> org >> apache >> [ tapestry overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC