Package org.apache.tapestry5.services

## Interface ComponentSource

- All Known Implementing Classes:
    `ComponentSourceImpl`

      public interface ComponentSource

  Used by classes that need to retrieve a component by its complete id, or a page by its logical page name or root component class. The complete id is the logical name of the containing page, a colon, and the nested component id. It may also just be the page name (for the root component of a page).

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Component` | `getActivePage()` | Returns the active page, as defined by `RequestGlobals.getActivePageName()`.
    `Component` | `getComponent​(String completeId)` | Gets a component by its complete id.
    `Component` | `getPage​(Class pageClass)` | A convienience for obtaining a page instance via a class instance.
    `Component` | `getPage​(String pageName)` | Returns the page identified by its logical page name.

- - ### Method Detail

    - #### getComponent

          Component getComponent​(String completeId)

      Gets a component by its complete id. If the component id is for a mixin, then the mixin attached to the component will be returned. A mixin's complete id is its container's complete id, suffixed with "$" and the mixin's id (its simple class name).
      Parameters:
        `completeId` - complete component id (case insensitive)
      Returns:
        the component
      Throws:
        `IllegalArgumentException` - if the component can not be found
      See Also:
        `ComponentResourcesCommon.getCompleteId()`

    - #### getPage

          Component getPage​(String pageName)

      Returns the page identified by its logical page name. A logical page name is the short form of a page name often emebedded into URLs.
      Parameters:
        `pageName` - the logical page name
      Returns:
        the corresponding page's root component
      Throws:
        `IllegalArgumentException` - if the page can not be found

    - #### getPage

          Component getPage​(Class pageClass)

      A convienience for obtaining a page instance via a class instance. This is provided so as to be refactoring safe. The pageClass is simply converted to a class name and this is used to locate a page instance.
      Parameters:
        `pageClass` - used to locate the page instance
      Returns:
        the page instance

    - #### getActivePage

          Component getActivePage()

      Returns the active page, as defined by `RequestGlobals.getActivePageName()`. This is the primary page for handling the current request, the page which will be activated for the request. The identity of the active page is not known until the correct `Dispatcher` determines this.
      Returns:
        the active page, or null if no active page is yet identified
      Since:
        5.2.0