org.apache.myfaces.trinidad.skin

## Class SkinFactory

- java.lang.Object
- - org.apache.myfaces.trinidad.skin.SkinFactory

-     public abstract class SkinFactory
      extends Object

  All methods in this class dealing with skin management activities such as loading, creating, managing and disposing skins are deprecated. It is recommended to use SkinProvider instead of SkinFactory for the deprecated APIs. SkinProvider introduces lazy / on-demand loading of skins as opposed to eager loading done by SkinFactory. SkinProvider also introduces the flexibility to create and manage external skin repositories. Thus we have better manageability of Skins and clear separation of external skins and trinidad provided / supported skins.

  SkinFactory exists today to provide SkinProvider implementers an easy way to create a Skin object without having to implement Skin interface.This is done using SkinFactory#createSkin API. Skin object created using this API can be used by the SkinProvider implementation's SkinProvider#getSkin methods. SkinProvider implementation should take care of managing the skin and destroy it when required.

  Creating a Skin using this SkinFactory#createSkin API is different from adding a Skin into SkinFactory using SkinFactory#addSkin. With SkinFactory#createSkin the responsibility of managing the Skin and returning is in response to SkinProvider#getSkin calls is with the SkinProvider and with SkinFactory#addSkin, this responsibility is with the SkinFactory.
  See Also:
    `SkinProvider`, `Skin`, `SkinMetadata`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SkinFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `addSkin(String skinId, Skin skin)` Deprecated. use SkinProvider SPI to deal with externals skins Implementing SkinProvider and exposing skins using SkinProvider#getSkin() method is recommended than using this API to make skins available at runtime.
    `Skin` | `createSkin(javax.faces.context.ExternalContext externalContext, SkinMetadata skinMetadata)` Creates a Skin based on the supplied base skin information and skinMetadata information.
    `Skin` | `createSkin(javax.faces.context.ExternalContext externalContext, SkinMetadata baseSkinMetadata, SkinMetadata skinMetadata)` Creates a Skin based on the supplied base skin information and skinMetadata information.
    `static SkinFactory` | `getFactory()` Retrieve the current SkinFactory.
    `abstract Skin` | `getSkin(javax.faces.context.FacesContext context, String skinId)` Deprecated. use SkinProvider#getSkin method to query skins
    `abstract Skin` | `getSkin(javax.faces.context.FacesContext context, String family, String renderKitId)` Deprecated. use SkinProvider#getSkin method to query skins
    `abstract Skin` | `getSkin(javax.faces.context.FacesContext context, String family, String renderKitId, String version)` Deprecated. use SkinProvider#getSkin method to query skins
    `abstract Iterator<String>` | `getSkinIds()` Deprecated. use SkinProvider#getSkinMetadata to get the list of skins supported
    `void` | `reload()` Deprecated. use SkinProvider SPI to deal with externals skins this functionality will now be replaced by having the SkinProvider implementations reloading skins themselves as and when required.
    `static void` | `setFactory(SkinFactory factory)` Store the current SkinFactory.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SkinFactory

          public SkinFactory()

  - ### Method Detail

    - #### getFactory

          public static SkinFactory getFactory()

      Retrieve the current SkinFactory.

    - #### setFactory

          public static void setFactory(SkinFactory factory)

      Store the current SkinFactory.

    - #### createSkin

          public Skin createSkin(javax.faces.context.ExternalContext externalContext,
                        SkinMetadata baseSkinMetadata,
                        SkinMetadata skinMetadata)

      Creates a Skin based on the supplied base skin information and skinMetadata information. This API can be used by SkinProvider implementers to create Skin objects which their SkinProvider implementation supports. As a minimum, the user of this API should pass information to obtain the base skin through 'baseSkinMetadata' and provide information such as id, family, renderkit etc for the new skin through 'skinMetadata'.
      Parameters:
        `externalContext` - valid ExternalContext
        `baseSkinMetadata` - `SkinMetadata` metadata to find the base skin for the new skin to be created. The user should pass enough information to pick the base skin with id / family / version / renderkit. Base skin is obtained using SkinProvider#getSkin API.
        `skinMetadata` - `SkinMetadata` metadata to create new Skin. The user should pass all information such as id, family, version, renderkit, styleSheetName, features, metadata etc. for the new skin.
      Returns:
        a new skin `Skin` object created using the skinMetadata `SkinMetadata` supplied
      Throws:
        `IllegalArgumentException` - if the baseSkinId contained in the supplied skinMetadata did not match the id of the baseSkin obtained using baseSkinMetadata
        `ClassCastException` - if SkinProvider does not provide as matching base skin as per metadata passed in baseSkinMetadata

    - #### createSkin

          public Skin createSkin(javax.faces.context.ExternalContext externalContext,
                        SkinMetadata skinMetadata)

      Creates a Skin based on the supplied base skin information and skinMetadata information. This API can be used by SkinProvider implementers to create Skin objects which their SkinProvider implementation supports. As a minimum, the user of this API should pass information such as baseSkinId, id, family, renderkit etc for the new skin through 'skinMetadata'.
      Parameters:
        `externalContext` - valid ExternalContext
        `skinMetadata` - `SkinMetadata` metadata to create new Skin. The user should pass all information such as baseSkinId, id, family, version, renderkit, styleSheetName, features, metadata etc. for the new skin. baseSkinId is mandatory, since it is used to query the base skin for the new skin using SkinProvider#getSkin API.
      Returns:
        a new skin `Skin` object created using the skinMetadata `SkinMetadata` supplied
      Throws:
        `IllegalArgumentException` - if the baseSkinId contained in the supplied skinMetadata did not match the id of the baseSkin obtained from SkinProvider#getSkin

    - #### reload

          @Deprecated
          public void reload()

      Deprecated. use SkinProvider SPI to deal with externals skins this functionality will now be replaced by having the SkinProvider implementations reloading skins themselves as and when required.
      Reloads the skins that was registered with this factory. Subclassers can choose to provide the implementation.

    - #### addSkin

          @Deprecated
          public abstract void addSkin(String skinId,
                                Skin skin)

      Deprecated. use SkinProvider SPI to deal with externals skins Implementing SkinProvider and exposing skins using SkinProvider#getSkin() method is recommended than using this API to make skins available at runtime.

      Register the specified `Skin` instance, associated with the specified `skinId`, to be supported by this `SkinFactory`, replacing any previously registered `Skin` for this identifier.

      Parameters:
        `skinId` - Identifier of the `Skin` to register
        `skin` - `Skin` instance that we are registering

    - #### getSkin

          @Deprecated
          public abstract Skin getSkin(javax.faces.context.FacesContext context,
                                String skinId)

      Deprecated. use SkinProvider#getSkin method to query skins

      Return a `Skin` instance for the specified skinId. If there is no registered `Skin` for the specified identifier, return `null`. The set of available skin identifiers is available via the `getSkinIds()` method.

      Parameters:
        `context` - FacesContext for the request currently being processed, or `null` if none is available.
        `skinId` - Skin identifier of the requested `Skin` instance

    - #### getSkin

          @Deprecated
          public abstract Skin getSkin(javax.faces.context.FacesContext context,
                                String family,
                                String renderKitId)

      Deprecated. use SkinProvider#getSkin method to query skins

      Return a `Skin` instance for the specified skinFamily and renderKitId. If there is no registered `Skin` for the specified identifier, return `null`. The set of available skin identifiers is available via the `getSkinIds()` method.

      Parameters:
        `context` - FacesContext for the request currently being processed, or `null` if none is available.
        `family` - family of the requested `Skin` instance
        `renderKitId` - RenderKit identifier of the requested `Skin` instance

    - #### getSkin

          @Deprecated
          public abstract Skin getSkin(javax.faces.context.FacesContext context,
                                String family,
                                String renderKitId,
                                String version)

      Deprecated. use SkinProvider#getSkin method to query skins

      Return a `Skin` instance for the specified skinFamily and renderKitId, and skin version. The best matched skin is returned. If there is no registered `Skin` for the specified identifier, return `null`. The set of available skin identifiers is available via the `getSkinIds()` method.

      Parameters:
        `context` - FacesContext for the request currently being processed, or `null` if none is available.
        `family` - family of the requested `Skin` instance
        `renderKitId` - RenderKit identifier of the requested `Skin` instance
        `version` - A string that denotes the skin version name. It can be "default" or the name of the version (see the Skin's SkinVersion#getName) or null which returns the skin with no version set.

    - #### getSkinIds

          @Deprecated
          public abstract Iterator<String> getSkinIds()

      Deprecated. use SkinProvider#getSkinMetadata to get the list of skins supported

      Return an `Iterator` over the set of skin identifiers registered with this factory.

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.