Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5
Interface ComponentResources

All Superinterfaces:
  ComponentResourcesCommon, Locatable

All Known Subinterfaces:
  InternalComponentResources

All Known Implementing Classes:
  InternalComponentResourcesImpl

    public interface ComponentResources

extends ComponentResourcesCommon

Provides a component instance with the resources provided by the framework. In many circumstances, the resources object can be considered the component itself; in others, it is the component property, an instance of a class provided by the application developer (though transformed in many ways while being loaded) that is the true component. In reality, it is the combination of the resources object with the user class instance that forms the components; neither is useful without the other.

Method Summary
`void` | `addPageLifecycleListener(PageLifecycleListener listener)` Deprecated. In 5.3.4, use `getPageLifecycleCallbackHub()` instead
`void` | `discardPersistentFieldChanges()` Discards all persistent field changes for the page containing the component.
`AnnotationProvider` | `getAnnotationProvider(java.lang.String parameterName)` Returns an annotation provider, used to obtain annotations related to the parameter.
`Resource` | `getBaseResource()` Returns the base resource for the component, which will represent the class's location within the classpath (this is used to resolve relative assets).
`Block` | `getBlockParameter(java.lang.String parameterName)` Used to access an informal parameter that's a Block.
`java.lang.Class` | `getBoundType(java.lang.String parameterName)` Returns the actual type of the bound parameter, or null if the parameter is not bound.
`Component` | `getComponent()` Returns the component this object provides resources for.
`ComponentModel` | `getComponentModel()` Returns the component model object that defines the behavior of the component.
`Component` | `getContainer()` Returns the component which contains this component, or null for the root component.
`Messages` | `getContainerMessages()` Returns the `Messages` from the container, or null if this is the root component (with no container).
`ComponentResources` | `getContainerResources()` Returns the `ComponentResources` for the container, or null if the this is the root component (that has no container).
`java.lang.String` | `getElementName()` Returns the name of element that represents the component in its template, or null if not known.
`Component` | `getEmbeddedComponent(java.lang.String embeddedId)` Returns an embedded component, given the component's id.
`
`<T> T`
` | `getInformalParameter(java.lang.String name, java.lang.Class<T> type)` Reads an informal parameter and coercers the bound value to the indicated type.
`java.util.List<java.lang.String>` | `getInformalParameterNames()` Returns a list of the names of any informal parameters bound to this component.
`Messages` | `getMessages()` Returns the message catalog for this component.
`Component` | `getPage()` Returns the page that contains this component.
`PageLifecycleCallbackHub` | `getPageLifecycleCallbackHub()` Provides access to an object that can be used to register callbacks for page lifecycle events.
`
`<T extends java.lang.annotation.Annotation> T`
` | `getParameterAnnotation(java.lang.String parameterName, java.lang.Class<T> annotationType)` Obtains an annotation provided by a parameter.
`java.lang.Object` | `getRenderVariable(java.lang.String name)` Returns a previously stored render variable.
`boolean` | `isBound(java.lang.String parameterName)` Returns true if the named parameter is bound, false if not.
`boolean` | `isMixin()` Returns true if these resources represent a mixin to another component.
`void` | `removePageLifecycleListener(PageLifecycleListener listener)` Deprecated. in 5.3.4, not necessary with `PageLifecycleCallbackHub.addPageLoadedCallback(Runnable)`.
`void` | `renderInformalParameters(MarkupWriter writer)` Indentifies all parameters that are not formal parameters and writes each as a attribute/value pair into the current element of the markup writer.
`void` | `storeRenderVariable(java.lang.String name, java.lang.Object value)` Stores a render variable, accessible with the provided name.

Methods inherited from interface org.apache.tapestry5.ComponentResourcesCommon
`createActionLink, createEventLink, createFormEventLink, createPageLink, createPageLink, findBlock, getBlock, getBody, getCompleteId, getElementName, getId, getLocale, getLogger, getNestedId, getPageName, getResourceSelector, hasBody, isRendering, triggerContextEvent, triggerEvent`

Methods inherited from interface org.apache.tapestry5.ioc.Locatable
`getLocation`

Method Detail

### getBaseResource

    Resource getBaseResource()

  Returns the base resource for the component, which will represent the class's location within the classpath (this is used to resolve relative assets).

### getComponentModel

    ComponentModel getComponentModel()

  Returns the component model object that defines the behavior of the component.

### getComponent

    Component getComponent()

  Returns the component this object provides resources for.

### getContainer

    Component getContainer()

  Returns the component which contains this component, or null for the root component. For mixins, this returns the componet to which the mixin is attached.

### getContainerResources

    ComponentResources getContainerResources()

  Returns the `ComponentResources` for the container, or null if the this is the root component (that has no container). As a special case, for a mixin, this returns the core component's resources.

### getContainerMessages

    Messages getContainerMessages()

  Returns the `Messages` from the container, or null if this is the root component (with no container). As a special case, for a mixin, this return the core component's messages.

### getPage

    Component getPage()

  Returns the page that contains this component. Technically, the page itself is an internal object in Tapestry and this returns the root component of the actual page, but from an application developer point of view, this is the page.

### getEmbeddedComponent

    Component getEmbeddedComponent(java.lang.String embeddedId)

  Returns an embedded component, given the component's id.

  Parameters:
    `embeddedId` - selects the embedded component (case is ignored)
  Throws:
    `UnknownValueException` - if this component does not contain a component with the given id

### isBound

    boolean isBound(java.lang.String parameterName)

  Returns true if the named parameter is bound, false if not.

### getParameterAnnotation

    <T extends java.lang.annotation.Annotation> T getParameterAnnotation(java.lang.String parameterName,
                                                                         java.lang.Class<T> annotationType)

  Obtains an annotation provided by a parameter.

  Parameters:
    `parameterName` - name of parameter to search for the annotation
    `annotationType` - the type of annotation
  Returns:
    the annotation if found or null otherwise

### renderInformalParameters

    void renderInformalParameters(MarkupWriter writer)

  Indentifies all parameters that are not formal parameters and writes each as a attribute/value pair into the current element of the markup writer.

  Parameters:
    `writer` - to which `attributes` will be written

### getMessages

    Messages getMessages()

  Returns the message catalog for this component.

### getBoundType

    java.lang.Class getBoundType(java.lang.String parameterName)

  Returns the actual type of the bound parameter, or null if the parameter is not bound. This is primarily used with property bindings, and is used to determine the actual type of the property, rather than the type of parameter (remember that type coercion automatically occurs, which can mask significant differences between the parameter type and the bound property type).

  Parameters:
    `parameterName` - used to select the parameter (case is ignored)
  Returns:
    the type of the bound parameter, or null if the parameter is not bound
  See Also:
    `Binding.getBindingType()`

### getAnnotationProvider

    AnnotationProvider getAnnotationProvider(java.lang.String parameterName)

  Returns an annotation provider, used to obtain annotations related to the parameter.

  Parameters:
    `parameterName` - used to select the parameter (case is ignored)
  Returns:
    the annotation provider, or null if the parameter is not bound

### getBlockParameter

    Block getBlockParameter(java.lang.String parameterName)

  Used to access an informal parameter that's a Block.

  Parameters:
    `parameterName` - the name of the informal parameter (case is ignored)
  Returns:
    the informal Block parameter, or null if not bound

### getRenderVariable

    java.lang.Object getRenderVariable(java.lang.String name)

  Returns a previously stored render variable.

  Parameters:
    `name` - of the variable (case will be ignored)
  Returns:
    the variable's value
  Throws:
    `java.lang.IllegalArgumentException` - if the name doesn't correspond to a stored value

### storeRenderVariable

    void storeRenderVariable(java.lang.String name,
                             java.lang.Object value)

  Stores a render variable, accessible with the provided name.

  Parameters:
    `name` - of value to store
    `value` - value to store (may not be null)
  Throws:
    `java.lang.IllegalStateException` - if the component is not currently rendering

### addPageLifecycleListener

    void addPageLifecycleListener(PageLifecycleListener listener)

  Deprecated. In 5.3.4, use `getPageLifecycleCallbackHub()` instead

  Adds a listener object that will be notified about page lifecycle events.

### getPageLifecycleCallbackHub

    PageLifecycleCallbackHub getPageLifecycleCallbackHub()

  Provides access to an object that can be used to register callbacks for page lifecycle events.

  Returns:
    the hub
  Since:
    5.3.4

### removePageLifecycleListener

    void removePageLifecycleListener(PageLifecycleListener listener)

  Deprecated. in 5.3.4, not necessary with `PageLifecycleCallbackHub.addPageLoadedCallback(Runnable)`.

  Removes a previously added listener.

  Since:
    5.2.0

### discardPersistentFieldChanges

    void discardPersistentFieldChanges()

  Discards all persistent field changes for the page containing the component. Changes are eliminated from persistent storage (such as the `Session`) which will take effect in the next request (the attached page instance is not affected).

### getElementName

    java.lang.String getElementName()

  Returns the name of element that represents the component in its template, or null if not known.

  Returns:
    the element name or null

### getInformalParameterNames

    java.util.List<java.lang.String> getInformalParameterNames()

  Returns a list of the names of any informal parameters bound to this component.

  Returns:
    the name sorted alphabetically
  See Also:
    `SupportsInformalParameters`

### getInformalParameter

    <T> T getInformalParameter(java.lang.String name,
                               java.lang.Class<T> type)

  Reads an informal parameter and coercers the bound value to the indicated type.

  Parameters:
    `name` - name of informal parameter
    `type` - output value type
  Returns:
    instance of type

### isMixin

    boolean isMixin()

  Returns true if these resources represent a mixin to another component. The component is the container of this resources.

  Since:
    5.2.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.