org.apache.myfaces.trinidad.skin
Class Skin

java.lang.Object
  extended by org.apache.myfaces.trinidad.skin.Skin

public abstract class Skin
extends Object

Defines the components (icons, styles, etc) which are used to implement a particular skin.

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/skin/Skin.java#0 $) $Date: 10-nov-2005.18:58:54 $
See Also:
SkinFactory

Constructor Summary
Skin()
           
 
Method Summary
abstract  void addSkinAddition(SkinAddition skinAddition)
          Adds a SkinAddition on this Skin.
abstract  String getFamily()
          Returns the name of the skin "family" for this skin.
abstract  Icon getIcon(String iconName)
          Our renderers call this to get the icon.
abstract  Icon getIcon(String iconName, boolean resolveIcon)
          Returns an Icon object; can be a ReferenceIcon.
abstract  String getId()
          Returns an string identifier which uniquely identies this Skin implementation.
abstract  Object getProperty(Object key)
          Retrieves a property that was set via a call to setProperty().
abstract  String getRenderKitId()
          Returns the renderKitId for the Skin.
abstract  List<SkinAddition> getSkinAdditions()
          Gets a List of SkinAdditions that have been added on this Skin.
abstract  Map<String,String> getStyleClassMap(RenderingContext arc)
          Returns the style class map, or null if there is no map.
abstract  String getStyleSheetDocumentId(RenderingContext arc)
          Returns the id of the Skin's stylesheet document.
abstract  String getStyleSheetName()
          Returns the name of the style sheet for this Skin.
abstract  String getTranslatedString(LocaleContext lContext, String key)
          Returns a translated String in the LocaleContext's translation Locale.
abstract  Object getTranslatedValue(LocaleContext lContext, String key)
          Returns a translated value in the LocaleContext's translation Locale.
 SkinVersion getVersion()
          Returns the (@link SkinVersion} instance of the "version" for this skin.
abstract  boolean isDirty()
          Check to see if this Skin has been marked dirty.
abstract  void registerIcon(String iconName, Icon icon)
          Registers an Icon for the specified icon name.
abstract  void registerStyleSheet(String styleSheetName)
          Deprecated. Use addSkinAddition(SkinAddition) instead.
abstract  void setDirty(boolean dirty)
          Sets the dirty flag of the Skin.
abstract  void setProperty(Object key, Object value)
          Sets a value for the specified property key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Skin

public Skin()
Method Detail

getId

public abstract String getId()
Returns an string identifier which uniquely identies this Skin implementation. Skin implementations can be retrieved by id via SkinFactory.getSkin().

See Also:
SkinFactory.getSkin(javax.faces.context.FacesContext, java.lang.String)

getFamily

public abstract String getFamily()
Returns the name of the skin "family" for this skin. The family name is used when specifying a preferred skin in trinidad-config.xml. This provides a way to refer to a group of related skin implementations while allowing the particular skin instance to be selected based on the current render-kit-id.


getVersion

public SkinVersion getVersion()
Returns the (@link SkinVersion} instance of the "version" for this skin. When a Skin instance is created, a SkinVersion instance can be a part of it. In trinidad-skins.xml this is the version element. In the trinidad-config.xml, the application developer can set the skin-version to a skin version, or to 'default'. This returns SkinVersion.EMPTY_SKIN_VERSION if no version is set.


getRenderKitId

public abstract String getRenderKitId()
Returns the renderKitId for the Skin.


getStyleSheetDocumentId

public abstract String getStyleSheetDocumentId(RenderingContext arc)
Returns the id of the Skin's stylesheet document.


getStyleClassMap

public abstract Map<String,String> getStyleClassMap(RenderingContext arc)
Returns the style class map, or null if there is no map. It should be a map that contains the full style class name as the key, and the value could be a shortened style class name, or a portlet style class name, etc.


getStyleSheetName

public abstract String getStyleSheetName()
Returns the name of the style sheet for this Skin.


getTranslatedString

public abstract String getTranslatedString(LocaleContext lContext,
                                           String key)
                                    throws MissingResourceException
Returns a translated String in the LocaleContext's translation Locale.

Throws:
MissingResourceException

getTranslatedValue

public abstract Object getTranslatedValue(LocaleContext lContext,
                                          String key)
                                   throws MissingResourceException
Returns a translated value in the LocaleContext's translation Locale. This value may or may not be a String, and developers should avoid calling toString() unless absolutely necessary.

Parameters:
lContext - The LocaleContext which provides the translation Locale. Cannot be null.
key - The key of the translation to retrieve. Cannot be null.
Throws:
NullPointerException - if lContext or key is null.
MissingResourceException

getIcon

public abstract Icon getIcon(String iconName)
Our renderers call this to get the icon. This returns a renderable icon. (ReferenceIcons are resolved -- the real icon they point to is returned)


getIcon

public abstract Icon getIcon(String iconName,
                             boolean resolveIcon)
Returns an Icon object; can be a ReferenceIcon.

Parameters:
iconName - The name of the icon to retrieve. Cannot be null
Throws:
NullPointerException - if iconName is null.

getProperty

public abstract Object getProperty(Object key)
Retrieves a property that was set via a call to setProperty(). Some Renderer implementations may store properties on the Skin instance to avoid having to re-compute Skin-specific values on each render.


setProperty

public abstract void setProperty(Object key,
                                 Object value)
Sets a value for the specified property key. Some Renderer implementations may store properties on the Skin instance to avoid having to re-compute Skin-specific values on each render.


registerIcon

public abstract void registerIcon(String iconName,
                                  Icon icon)
Registers an Icon for the specified icon name.

Parameters:
iconName - The name of the icon. Cannot be null.
icon - The Icon to register.
Throws:
NullPointerException - if iconName is null.

registerStyleSheet

@Deprecated
public abstract void registerStyleSheet(String styleSheetName)
Deprecated. Use addSkinAddition(SkinAddition) instead.

Registers a style sheet which defines extension-specific styles. The styles specified by this style sheet will be merged with the Skin's own styles.

Parameters:
styleSheetName - The name of the style sheet which defines the extension's styles.
Throws:
NullPointerException - if styleSheetName is null.
See Also:
addSkinAddition(SkinAddition)

addSkinAddition

public abstract void addSkinAddition(SkinAddition skinAddition)
Adds a SkinAddition on this Skin. You can call this method as many times as you like for the Skin, and it will add the SkinAddition to the list of SkinAdditions. However, it does not make sense to call this method more than once with the same SkinAddition object. This is meant for the skin-addition use-cases, where a custom component developer has a style sheet and/or resource bundle for their custom components, and they want the style sheet and/or resource bundle to work for this Skin and the children Skins. The stylesheets specified in the SkinAdditions will be merged with the Skin's own styles. The resource bundles specified in the SkinAdditions will be looked into if the translated key is not found in the Skin's own resource bundle during the call to getTranslatedString or getTranslatedValue.

Parameters:
skinAddition - The SkinAddition object to add to the Skin.
Throws:
NullPointerException - if SkinAddition is null.

getSkinAdditions

public abstract List<SkinAddition> getSkinAdditions()
Gets a List of SkinAdditions that have been added on this Skin.

Returns:
List a List of SkinAdditions.

isDirty

public abstract boolean isDirty()
Check to see if this Skin has been marked dirty. The only way to mark a Skin dirty is to call setDirty(true).

Returns:
true if the Skin is marked dirty.

setDirty

public abstract void setDirty(boolean dirty)
Sets the dirty flag of the Skin. Use this if you want to regenerate the skin. During rendering, if isDirty is true, the skin's css file will be reprocessed regardless of whether the css file has been modified or if the CHECK_FILE_MODIFICATION flag was set. The Skinning Framework calls setDirty(false) after the skin has been reprocessed.



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