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 ComponentResourcesCommon

All Superinterfaces:
  Locatable

All Known Subinterfaces:
  ComponentPageElement, ComponentResources, InternalComponentResources

All Known Implementing Classes:
  ComponentPageElementImpl, InternalComponentResourcesImpl

    public interface ComponentResourcesCommon

extends Locatable

Operations shared by the public `ComponentResources` interface and `ComponentPageElement` interface (on the internal side).

Method Summary
`Link` | `createActionLink(java.lang.String eventType, boolean forForm, java.lang.Object... context)` Deprecated. Use `createEventLink(String, Object[])` instead
`Link` | `createEventLink(java.lang.String eventType, java.lang.Object... context)` Creates a component event request link as a callback for this component.
`Link` | `createFormEventLink(java.lang.String eventType, java.lang.Object... context)` Creates a component event request link as a callback for this component.
`Link` | `createPageLink(java.lang.Class pageClass, boolean override, java.lang.Object... context)` Deprecated. Use `PageRenderLinkSource.createPageRenderLink(Class)` or `PageRenderLinkSource.createPageRenderLinkWithContext(Class, Object[])` instead
`Link` | `createPageLink(java.lang.String pageName, boolean override, java.lang.Object... context)` Deprecated. Use `PageRenderLinkSource.createPageRenderLink(String)` or `PageRenderLinkSource.createPageRenderLinkWithContext(String, Object[])` instead
`Block` | `findBlock(java.lang.String blockId)` As with `getBlock(String)`, but returns null if the block is not found.
`Block` | `getBlock(java.lang.String blockId)` Returns a block from the component's template, referenced by its id.
`Block` | `getBody()` Returns the body of this component as a (possibly empty) block.
`java.lang.String` | `getCompleteId()` Returns a string consisting of the logical name of the containing page, and the `nested id` of this component, separated by a colon.
`java.lang.String` | `getElementName(java.lang.String defaultElementName)` Returns the name of element that represents the component in its template, or the provided default element name if the element was a component type (in the Tapestry namespace).
`java.lang.String` | `getId()` Returns the simple (or local) id of the component.
`java.util.Locale` | `getLocale()` Returns the locale for the page containing this component.
`org.slf4j.Logger` | `getLogger()` Returns the log instance associated with the component (which is based on the component or mixin's class name).
`java.lang.String` | `getNestedId()` Return a string consisting the concatinated ids of all containing components, separated by periods.
`java.lang.String` | `getPageName()` Returns the logical name of the page containing this component.
`ComponentResourceSelector` | `getResourceSelector()` Returns the selector used when constructing the component and its containing page.
`boolean` | `hasBody()` Returns true if the element has a body and false otherwise.
`boolean` | `isRendering()` Returns true if the component is currently rendering, false otherwise.
`boolean` | `triggerContextEvent(java.lang.String eventType, EventContext context, ComponentEventCallback callback)` Triggers a component event.
`boolean` | `triggerEvent(java.lang.String eventType, java.lang.Object[] contextValues, ComponentEventCallback callback)` A convienience for invoking `triggerContextEvent(String, EventContext , ComponentEventCallback)`.

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

Method Detail

### getId

    java.lang.String getId()

  Returns the simple (or local) id of the component. The id will be unique within the component's immediate container. For a page's root component, the value null is returned.

### getNestedId

    java.lang.String getNestedId()

  Return a string consisting the concatinated ids of all containing components, separated by periods. In addition, nested ids are always all lower case. I.e., "foo.bar.baz". Returns null for the root component of a page.

### getCompleteId

    java.lang.String getCompleteId()

  Returns a string consisting of the logical name of the containing page, and the `nested id` of this component, separated by a colon. I.e., "MyPage:foo.bar.baz". For a page, returns just the page's name.

  This value is often used to obtain an equivalent component instance in a later request.

  See Also:
    `ComponentSource.getComponent(String)`

### triggerEvent

    boolean triggerEvent(java.lang.String eventType,
                         java.lang.Object[] contextValues,
                         ComponentEventCallback callback)

  A convienience for invoking `triggerContextEvent(String, EventContext , ComponentEventCallback)`. Wraps the context values into an `EventContext`.

  Parameters:
    `eventType` - event type (as determined from the request, or otherwise by design)
    `contextValues` - Values that may be provided to the event handler method as method parameters, or null if no context values are available
    `callback` - the handler to be informed of the result, or null if the event is a notification that does not support return values from event handler methods (the value true is allowed even if the handler is null).
  Returns:
    true if any event handler was invoked (even if no event handler method returns a non-null value)
  Throws:
    `ComponentEventException` - if an event handler method throws a checked or unchecked exception
  See Also:
    `OnEventWorker`, `OnEvent`

### triggerContextEvent

    boolean triggerContextEvent(java.lang.String eventType,
                                EventContext context,
                                ComponentEventCallback callback)

  Triggers a component event. A search for an event handling method will occur, first in the component, then its container, and so on. When a matching event handler method is located, it is invoked. If the method returns a value, the value is passed to the callback (if callback is null, then it is an error for a method to return a non-null value).

  Resolution of event type to event handler methods is case insensitive.

  Parameters:
    `eventType` - event type (as determined from the request, or otherwise by design)
    `context` - the context (as extracted from the request, or provided by the triggering component); these values may be provided to event handler methods via their parameters (may not be null)
    `callback` - the handler to be informed of the result, or null if the event is a notification that does not support return values from event handler methods (the value true is allowed even if the handler is null).
  Returns:
    true if any event handler was invoked (even if no event handler method returns a non-null value)
  Throws:
    `ComponentEventException` - if an event handler method throws a checked or unchecked exception
  See Also:
    `OnEventWorker`, `OnEvent`

### isRendering

    boolean isRendering()

  Returns true if the component is currently rendering, false otherwise. This is most often used to determine if parameter values should be cached.

### getLogger

    org.slf4j.Logger getLogger()

  Returns the log instance associated with the component (which is based on the component or mixin's class name).

  See Also:
    `ComponentModel.getLogger()`

### getLocale

    java.util.Locale getLocale()

  Returns the locale for the page containing this component.

  See Also:
    `getResourceSelector()`

### getResourceSelector

    ComponentResourceSelector getResourceSelector()

  Returns the selector used when constructing the component and its containing page.

  Since:
    5.3

### getElementName

    java.lang.String getElementName(java.lang.String defaultElementName)

  Returns the name of element that represents the component in its template, or the provided default element name if the element was a component type (in the Tapestry namespace).

  Parameters:
    `defaultElementName` - element name to return if the element name is not known (may be null)
  Returns:
    the element name

### getBlock

    Block getBlock(java.lang.String blockId)

  Returns a block from the component's template, referenced by its id.

  Parameters:
    `blockId` - the id of the block (case insensitive)
  Returns:
    the identified Block
  Throws:
    `BlockNotFoundException` - if no block with the given id exists
  See Also:
    `findBlock(String)`

### findBlock

    Block findBlock(java.lang.String blockId)

  As with `getBlock(String)`, but returns null if the block is not found.

  Parameters:
    `blockId` - the id of the block (case insensitive)
  Returns:
    the block, or null

### getPageName

    java.lang.String getPageName()

  Returns the logical name of the page containing this component. This is the short name (it often appears in URLs)

  Returns:
    the logical name of the page which contains this component

### hasBody

    boolean hasBody()

  Returns true if the element has a body and false otherwise. Only components may have a body; pages and mixins will return false.

### getBody

    Block getBody()

  Returns the body of this component as a (possibly empty) block. When invoked on a mixin, returns the containing component's body.

### createEventLink

    Link createEventLink(java.lang.String eventType,
                         java.lang.Object... context)

  Creates a component event request link as a callback for this component. The event type and context (as well as the page name and nested component id) will be encoded into a URL. A request for the URL will triggerEvent(String, Object[], org.apache.tapestry5.ComponentEventCallback) trigger} the named event on the component.

  Parameters:
    `eventType` - the type of event to be triggered. Event types should be Java identifiers (contain only letters, numbers and the underscore).
    `context` - additional objects to be encoded into the path portion of the link; each is converted to a string and URI encoded
  Returns:
    link object for the callback

### createActionLink

    Link createActionLink(java.lang.String eventType,
                          boolean forForm,
                          java.lang.Object... context)

  Deprecated. Use `createEventLink(String, Object[])` instead

  Creates a component event request link as a callback for this component. The event type and context (as well as the page name and nested component id) will be encoded into a URL. A request for the URL will triggerEvent(String, Object[], org.apache.tapestry5.ComponentEventCallback) trigger} the named event on the component.

  Parameters:
    `eventType` - the type of event to be triggered. Event types should be Java identifiers (contain only letters, numbers and the underscore).
    `forForm` - if true, the link will be used as the eventType for an HTML form submission, which may affect what information is encoded into the link
    `context` - additional objects to be encoded into the path portion of the link; each is converted to a string and URI encoded
  Returns:
    link object for the callback

### createFormEventLink

    Link createFormEventLink(java.lang.String eventType,
                             java.lang.Object... context)

  Creates a component event request link as a callback for this component. The event type and context (as well as the page name and nested component id) will be encoded into a URL. A request for the URL will triggerEvent(String, Object[], org.apache.tapestry5.ComponentEventCallback) trigger} the named event on the component. This is only used for form submission events, as extra data may be encoded in the form as hidden fields.

  Parameters:
    `eventType` - the type of event to be triggered. Event types should be Java identifiers (contain only letters, numbers and the underscore).
    `context` - additional objects to be encoded into the path portion of the link; each is converted to a string and URI encoded
  Returns:
    link object for the callback

### createPageLink

    Link createPageLink(java.lang.String pageName,
                        boolean override,
                        java.lang.Object... context)

  Deprecated. Use `PageRenderLinkSource.createPageRenderLink(String)` or `PageRenderLinkSource.createPageRenderLinkWithContext(String, Object[])` instead

  Creates a page render request link to render a specific page.

  Parameters:
    `pageName` - the logical name of the page to link to
    `override` - if true, the context is used even if empty (normally, the target page is allowed to passivate, providing a context, when the provided context is empty)
    `context` - the activation context for the page. If omitted, the activation context is obtained from the target page
  Returns:
    link for a render request to the targetted page

### createPageLink

    Link createPageLink(java.lang.Class pageClass,
                        boolean override,
                        java.lang.Object... context)

  Deprecated. Use `PageRenderLinkSource.createPageRenderLink(Class)` or `PageRenderLinkSource.createPageRenderLinkWithContext(Class, Object[])` instead

  Creates a page render request link to render a specific page. Using a page class, rather than a page name, is more refactoring safe (in the even the page is renamed or moved).

  Parameters:
    `pageClass` - identifies the page to link to
    `override` - if true, the context is used even if empty (normally, the target page is allowed to passivate, providing a context, when the provided context is empty)
    `context` - the activation context for the page. If omitted, the activation context is obtained from the target page
  Returns:
    link for a render request to the targetted page

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.