org.apache.myfaces.trinidadinternal.skin
Class SkinFactoryImpl

java.lang.Object
  extended by org.apache.myfaces.trinidad.skin.SkinFactory
      extended by org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl

public class SkinFactoryImpl
extends org.apache.myfaces.trinidad.skin.SkinFactory

Factory for creating Skin objects.


Constructor Summary
SkinFactoryImpl()
          Constructor registers default and custom skins
 
Method Summary
 void addSkin(java.lang.String skinId, org.apache.myfaces.trinidad.skin.Skin skin)
          Register the specified Skin instance, associated with the specified skinId, to be supported by this SkinFactory, replacing any previously registered Skin for this identifier.
 org.apache.myfaces.trinidad.skin.Skin getSkin(javax.faces.context.FacesContext context, java.lang.String skinId)
          given the skinId, pass back the Skin.
 org.apache.myfaces.trinidad.skin.Skin getSkin(javax.faces.context.FacesContext context, java.lang.String family, java.lang.String renderKitId)
          given the skinFamily and renderKitId, pass back the Skin.
 org.apache.myfaces.trinidad.skin.Skin getSkin(javax.faces.context.FacesContext context, java.lang.String family, java.lang.String renderKitId, java.lang.String version)
          Given the skin family, renderKitId, and version, return the best matched skin.
 java.util.Iterator<java.lang.String> getSkinIds()
           
 
Methods inherited from class org.apache.myfaces.trinidad.skin.SkinFactory
getFactory, setFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SkinFactoryImpl

public SkinFactoryImpl()
Constructor registers default and custom skins

Method Detail

addSkin

public void addSkin(java.lang.String skinId,
                    org.apache.myfaces.trinidad.skin.Skin skin)

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

A warning will be logged if a previously registered Skin was replaced, since it could produce inconsistent results if the application cached the previously registered Skin.

Specified by:
addSkin in class org.apache.myfaces.trinidad.skin.SkinFactory
Parameters:
skinId - Identifier of the Skin to register
skin - Skin instance that we are registering

getSkin

public org.apache.myfaces.trinidad.skin.Skin getSkin(javax.faces.context.FacesContext context,
                                                     java.lang.String skinId)
given the skinId, pass back the Skin.

Specified by:
getSkin in class org.apache.myfaces.trinidad.skin.SkinFactory
Parameters:
context - FacesContext. If not available, pass in null.
skinId -
Returns:
Skin that is in this SkinFactory and has the skinId.

getSkin

public org.apache.myfaces.trinidad.skin.Skin getSkin(javax.faces.context.FacesContext context,
                                                     java.lang.String family,
                                                     java.lang.String renderKitId)
given the skinFamily and renderKitId, pass back the Skin.

Specified by:
getSkin in class org.apache.myfaces.trinidad.skin.SkinFactory
Parameters:
context - FacesContext for the request currently being processed, or null if none is available.
family - skin family of the requested Skin instance
renderKitId - RenderKit identifier of the requested: XhtmlConstants.APACHE_TRINIDAD_DESKTOP, XhtmlConstants.APACHE_TRINIDAD_PDA, or XhtmlConstants.APACHE_TRINIDAD_PORTLET Skin instance

getSkin

public org.apache.myfaces.trinidad.skin.Skin getSkin(javax.faces.context.FacesContext context,
                                                     java.lang.String family,
                                                     java.lang.String renderKitId,
                                                     java.lang.String version)
Given the skin family, renderKitId, and version, return the best matched skin. The skin picking logic is: If an exact family, renderKitId, and version (including null or "") is found, return that skin Else if the user asks for version "default", return the skin with family and renderKitId with version marked default. If version wasn't default and does not match any version for the skins with family and renderKitId, then return the 'default' skin if there is one marked or return the last entry in the list of matching family/renderKitId skins.

Specified by:
getSkin in class org.apache.myfaces.trinidad.skin.SkinFactory
Parameters:
context -
family -
renderKitId -
version - The version of the skin you want to return. This can be "default", or a version name (e.g., "v1"), or null or "" (if you want the skin that does not have a version set).
Returns:
the best matched Skin given the family, renderKitId, and version.

getSkinIds

public java.util.Iterator<java.lang.String> getSkinIds()
Specified by:
getSkinIds in class org.apache.myfaces.trinidad.skin.SkinFactory


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