org.richfaces.skin
Class SkinFactoryImpl

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

public class SkinFactoryImpl
extends 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  Skin buildSkin(javax.faces.context.FacesContext context, java.lang.String name, boolean isBase)
          Factory method for build skin from properties files.
 Skin getBaseSkin(javax.faces.context.FacesContext context)
           
protected  java.lang.ClassLoader getClassLoader()
           
 Skin getDefaultSkin(javax.faces.context.FacesContext context)
           
 Skin getSkin(javax.faces.context.FacesContext context)
           
protected  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.
 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 Skin getSkinByName(javax.faces.context.FacesContext facesContext,
                             java.lang.Object currentSkinOrName,
                             boolean isBase)

getDefaultSkin

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

getSkin

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

getBaseSkin

public Skin getBaseSkin(javax.faces.context.FacesContext context)
Specified by:
getBaseSkin in class 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 Skin buildSkin(javax.faces.context.FacesContext context,
                         java.lang.String name,
                         boolean isBase)
                  throws 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 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 Theme getTheme(javax.faces.context.FacesContext facesContext,
                      java.lang.String name)
Specified by:
getTheme in class SkinFactory


Copyright © 2010. All Rights Reserved.