org.richfaces.skin
Class SkinFactoryImpl

java.lang.Object
  extended by org.richfaces.skin.SkinFactory
      extended by org.richfaces.skin.SkinFactoryImpl

public class SkinFactoryImpl
extends org.richfaces.skin.SkinFactory

Implementation of SkinFactory with building skins from properties files.

Author:
shura

Field Summary
static java.lang.String RENDER_KIT_PARAMETER
          Name of web application init parameter for current default RenderKit interaction.
 
Fields inherited from class org.richfaces.skin.SkinFactory
BASE_SKIN_PARAMETER, DEFAULT_SKIN_FACTORY_IMPL_CLASS, SERVICE_RESOURCE, SKIN_PARAMETER
 
Constructor Summary
SkinFactoryImpl()
           
 
Method Summary
protected  org.richfaces.skin.Skin buildSkin(javax.faces.context.FacesContext context, java.lang.String name, boolean isBase)
          Factory method for build skin from properties files.
 org.richfaces.skin.Skin getBaseSkin(javax.faces.context.FacesContext context)
           
protected  java.lang.ClassLoader getClassLoader()
           
 org.richfaces.skin.Skin getDefaultSkin(javax.faces.context.FacesContext context)
           
 org.richfaces.skin.Skin getSkin(javax.faces.context.FacesContext context)
           
protected  org.richfaces.skin.Skin getSkinByName(javax.faces.context.FacesContext facesContext, java.lang.Object currentSkinOrName, boolean isBase)
           
protected  java.lang.Object getSkinOrName(javax.faces.context.FacesContext context, boolean useBase)
          Calculate name for current skin.
 org.richfaces.skin.Theme getTheme(javax.faces.context.FacesContext facesContext, java.lang.String name)
           
protected  boolean loadProperties(java.lang.ClassLoader loader, java.util.Properties properties, java.lang.String location)
           
protected  java.util.Properties loadProperties(java.lang.String name, java.lang.String[] paths)
           
 
Methods inherited from class org.richfaces.skin.SkinFactory
getInstance, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RENDER_KIT_PARAMETER

public static final java.lang.String RENDER_KIT_PARAMETER
Name of web application init parameter for current default RenderKit interaction. by default - org.exadel.chameleon.RENDERKIT_DEFINITION . TODO Possible Values

See Also:
Constant Field Values
Constructor Detail

SkinFactoryImpl

public SkinFactoryImpl()
Method Detail

getSkinByName

protected org.richfaces.skin.Skin getSkinByName(javax.faces.context.FacesContext facesContext,
                                                java.lang.Object currentSkinOrName,
                                                boolean isBase)

getDefaultSkin

public org.richfaces.skin.Skin getDefaultSkin(javax.faces.context.FacesContext context)
Specified by:
getDefaultSkin in class org.richfaces.skin.SkinFactory

getSkin

public org.richfaces.skin.Skin getSkin(javax.faces.context.FacesContext context)
Specified by:
getSkin in class org.richfaces.skin.SkinFactory

getBaseSkin

public org.richfaces.skin.Skin getBaseSkin(javax.faces.context.FacesContext context)
Specified by:
getBaseSkin in class org.richfaces.skin.SkinFactory

getSkinOrName

protected java.lang.Object getSkinOrName(javax.faces.context.FacesContext context,
                                         boolean useBase)
Calculate name for current skin. For EL init parameter store value binding for speed calculations.

Parameters:
context -
useBase -
Returns:
name of currens skin from init parameter ( "DEFAULT" if no parameter ) or Skin as result of evaluation EL expression.

buildSkin

protected org.richfaces.skin.Skin buildSkin(javax.faces.context.FacesContext context,
                                            java.lang.String name,
                                            boolean isBase)
                                     throws org.richfaces.skin.SkinNotFoundException
Factory method for build skin from properties files. for given skin name, search in classpath all resources with name 'name'.skin.properties and append in content to default properties. First, get it from META-INF/skins/ , next - from root package. for any place search order determined by ClassLoader realisation.

Parameters:
name - name for builded skin.
defaultProperties -
Returns:
skin instance for current name
Throws:
SkinNotFoundException - - if no skin properies found for name.

loadProperties

protected java.util.Properties loadProperties(java.lang.String name,
                                              java.lang.String[] paths)
                                       throws org.richfaces.skin.SkinNotFoundException,
                                              javax.faces.FacesException
Parameters:
name -
defaultProperties -
Returns:
Throws:
SkinNotFoundException
javax.faces.FacesException
javax.faces.el.ReferenceSyntaxException

getClassLoader

protected java.lang.ClassLoader getClassLoader()
Returns:

loadProperties

protected boolean loadProperties(java.lang.ClassLoader loader,
                                 java.util.Properties properties,
                                 java.lang.String location)
Parameters:
loader -
properties -
location -

getTheme

public org.richfaces.skin.Theme getTheme(javax.faces.context.FacesContext facesContext,
                                         java.lang.String name)
Specified by:
getTheme in class org.richfaces.skin.SkinFactory


Copyright © 2009. All Rights Reserved.