When using Tapestry, an important aspect of your work is to leverage the properties exposed
by the various objects within Tapestry. A page has properties (inherited from base classes
such as AbstractComponent
and BasePage
) and contains components and other objects
with more properties. Pages are connected to an engine, which exports its own set of properties.
This appendix is a quick guide to the most common objects and their properties.
Table A.1. Tapestry Object Properties
Property name | Defining class | Property type | Description |
---|---|---|---|
activePageNames | BaseEngine | Collection of String | Names of all pages for which a page recorder has been created. |
assets | IComponent | Map of IAsset | Localized assets as defined in the component's specification. |
beans | IComponent | IBeanProvider | Used to access beans defined using the <bean> specification element. |
bindingNames | IComponent | Collection of String | The names of all formal and informal parameter bindings for the component. |
bindings | IComponent | Map of IBinding | All bindings (for both formal and informal parameters) for this component, keyed on the parameter name. |
body | AbstractComponent | IRender [] |
The body of the component: the text (as IRender ) and components (which inherit from
IRender ) that the component directly encloses within its container's template.
|
bodyCount | AbstractComponent | int |
The active number of elements in the body property array.
|
componentClassEnhancer | IEngine | IComponentClassEnhancer | Object responsible for dynamic creation of enhanced subclasses of Tapestry pages and components. |
components | IComponent | Map of IComponent | All components contained by this component, keyed on the component id. |
contextPath | IEngine | String | The path, if any, for the web application context. |
changeObserver | IPage | ChangeObserver | An object that recieves notifications about changes to persistent page properties. |
componentMessagesSource | IEngine | IComponentMessagesSource | An object that allows components to find their set of localized messages. |
container | IComponent | IComponent | The page or component which contains this component. Pages will return null. |
dataSqueezer | IEngine | DataSqueezer | Object used to encode and decode arbitrary values into a URL while maintaining their type. |
dirty | AbstractEngine | boolean |
True if the engine has been (potentially) modified, and should be stored
into the HttpSession .
|
disabled | IFormComponent | boolean | If true, the component should be disabled (and not respond to query parameters passed up in the request). |
displayName | IFormComponent | String | Localized string to be displayed as a label for the form control. Most implementations leave this undefined (as null). |
engine | IPage | IEngine | The engine to which the page is currently attached. |
extendedId | IComponent | String |
An "extended" version of the idPath property that
includes the name of the page containing the component as well.
|
form | IFormComponent | IForm | The form which encloses the form control component. |
global | IEngine , IPage | Object | The Global object for the application. |
hasVisit | AbstractEngine | boolean | Returns true if the Visit object has been created, false initially. |
id | IComponent | String | The id of the component, which is unique within its container. In many cases, the framework may have assigned an automatically generated id. Pages do not have an id and return null. |
idPath | IComponent | String | A sequence of id's used to locate a component within a page. A component bar
within a component foo within a page will have an idPath
of foo.bar . Pages return null.
|
listeners | AbstractComponent , AbstractEngine | ListenerMap |
Used to map listener methods as objects that implement the IActionListener interface.
|
locale | IEngine | Locale | The locale for the current client; this is used when loading pages from the page pool, or when instantiating new page instances. |
locale | IPage | Locale | The locale to which the page and all components within the page is localized. |
location | many | ILocation | The location that should be used with any error messages generated about the object. This is ultimately the file, line (and even column) of the template or specification file responsible for defining the object (be it a component, a page, or some other kind of object). |
messages | IComponent | IMessages | Localized messages for the component. |
name | IFormComponent | String |
The name, or element id, assigned to the form control by the IForm . This is set as the component
renders (but the property can then be read after the component renders).
|
namespace | IComponent | INamespace | The namespace containing the component. Components are always within some namespace, whether it is the default (application) namespace, the framework namespace, or a namespace for a component library. |
outputEncoding | AbstractPage | String | Output encoding for the page. |
page | IComponent | IPage | The page which ultimately contains the component. |
propertySource | IEngine | IPropertySource | Source for configuration properties. |
pageName | IPage | String | The fully qualified page name (possibly including a namespace prefix). |
pageSource | IEngine | IPageSource | The object used to obtain page instances. |
pool | IEngine | Pool | Stores objects that are expensive to create. |
requestCycle | IPage | IRequestCycle | The request cycle to which the page is currently attached. |
resetServiceEnabled | IEngine | boolean | If true, the reset service is enabled. The reset service is disabled by default. |
resourceResolver | IEngine | IResourceResolver | Object responsible for locating classes and classpath resources. |
scriptSource | IEngine | IScriptSource | Object that parses and caches script specifications. |
servletPath | IEngine | String | The URL path used to reference the application servlet (including the context path, if any). |
specification | IComponent | IComponentSpecification |
The specification which defines this component. Often used to access
meta data defined in the component's specification using the
<property> element.
|
specification | IEngine | IApplicationSpecification | The specification for the application. |
specificationSource | IEngine | ISpecificationSource | Object responsible for reading and caching page and component specifications. |
stateful | IEngine | boolean |
If true, then an HttpSession has been created for the client to store server-side state. Initially false.
|
templateSource | IEngine | ITemplateSource | Object responsible for reading and caching page and component templates. |
visit | IEngine | Object | Returns the Visit object for the current client, or null if the Visit object has not yet been created. |
visit | IPage | Object | Returns the Visit object for the current client, creating it if necessary. |