org.apache.tapestry5.runtime

## Interface Component

- All Superinterfaces:
    ComponentResourcesAware

      public interface Component
      extends ComponentResourcesAware

  Interface that defines the lifecycle of a component, within a page, allowing for callbacks into the component for many different events. This interface is part of the public API for Tapestry, but is not expected to be directly implemented by component classes; it should only be implemented as part of the component class transformation process. Most of the methods are related to render phases; see the corresponding annotations and component rendering documentation to see how they relate to each other. Starting in 5.3 this interface no longer implements `PageLifecycleListener`. Normally, this would be an incompatible change, but Component is not supposed to be directly implemented by user code.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterRender(MarkupWriter writer, Event event)` Generally used to write the close tag matching any open tag written by `beginRender(org.apache.tapestry5.MarkupWriter, Event)`.
    `void` | `afterRenderBody(MarkupWriter writer, Event event)` Invoked just after rendering the body of the component.
    `void` | `afterRenderTemplate(MarkupWriter writer, Event event)` Invoked after rendering the template for a component (only for components with a template).
    `void` | `beforeRenderBody(MarkupWriter writer, Event event)` Invoked just before rendering the body of component.
    `void` | `beforeRenderTemplate(MarkupWriter writer, Event event)` This phase is only invoked for components with templates.
    `void` | `beginRender(MarkupWriter writer, Event event)` Invoked to allow a component to render its tag (start tag and attributes).
    `void` | `cleanupRender(MarkupWriter writer, Event event)` Generally used to perform final cleanup of the component after rendering.
    `boolean` | `dispatchComponentEvent(ComponentEvent event)` Invoked to handle a component event.
    `void` | `postRenderCleanup()` Lifecycle method invoked at the end of the `CleanupRender` render phase.
    `void` | `setupRender(MarkupWriter writer, Event event)` Invoked before rendering a component (or its template).

    - ### Methods inherited from interface org.apache.tapestry5.runtime.ComponentResourcesAware

      `getComponentResources`

- - ### Method Detail

    - #### postRenderCleanup

          void postRenderCleanup()

      Lifecycle method invoked at the end of the `CleanupRender` render phase. There is no annotation for this method, it is part of CleanupRender, but is always invoked. Its specific use is to allow components to clean up cached parameter values.

    - #### setupRender

          void setupRender(MarkupWriter writer,
                           Event event)

      Invoked before rendering a component (or its template).

    - #### beginRender

          void beginRender(MarkupWriter writer,
                           Event event)

      Invoked to allow a component to render its tag (start tag and attributes).

    - #### beforeRenderTemplate

          void beforeRenderTemplate(MarkupWriter writer,
                                    Event event)

      This phase is only invoked for components with templates.

    - #### afterRenderTemplate

          void afterRenderTemplate(MarkupWriter writer,
                                   Event event)

      Invoked after rendering the template for a component (only for components with a template).

    - #### beforeRenderBody

          void beforeRenderBody(MarkupWriter writer,
                                Event event)

      Invoked just before rendering the body of component.

    - #### afterRenderBody

          void afterRenderBody(MarkupWriter writer,
                               Event event)

      Invoked just after rendering the body of the component.

    - #### afterRender

          void afterRender(MarkupWriter writer,
                           Event event)

      Generally used to write the close tag matching any open tag written by `beginRender(org.apache.tapestry5.MarkupWriter, Event)`.

    - #### cleanupRender

          void cleanupRender(MarkupWriter writer,
                             Event event)

      Generally used to perform final cleanup of the component after rendering.

    - #### dispatchComponentEvent

          boolean dispatchComponentEvent(ComponentEvent event)

      Invoked to handle a component event. Methods with the `OnEvent` annotation (or the matching naming convention) will be invoked until one returns a non-null value.
      Parameters:
        `event` -
      Returns:
        true if any handler was found (and invoked), false otherwise
      Throws:
        `RuntimeException` - wrapping any checked exceptions that are thrown by individual event handler methods

5.6.0 - Copyright © 2003-2020 The Apache Software Foundation.