org.apache.myfaces.trinidadinternal.skin
Class SkinStyleProvider

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache
      extended by org.apache.myfaces.trinidadinternal.skin.SkinStyleProvider
All Implemented Interfaces:
StyleProvider

public class SkinStyleProvider
extends FileSystemStyleCache

An extension of the FileSystemStyleCache which defers to a Skin for loading the StyleSheetDocument.

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/skin/SkinStyleProvider.java#0 $) $Date: 10-nov-2005.18:58:59 $
Author:
The Oracle ADF Faces Team

Constructor Summary
protected SkinStyleProvider(org.apache.myfaces.trinidad.skin.Skin skin, java.lang.String targetDirectoryPath)
          Creates SkinStyleProvider instance.
 
Method Summary
protected  StyleSheetDocument createStyleSheetDocument(StyleContext context)
          Override of FileSystemStyleCache.createStyleSheetDocument().
static StyleProvider getSkinStyleProvider(org.apache.myfaces.trinidad.skin.Skin skin, java.lang.String targetDirectoryPath)
          Returns a shared instance of the SkinStyleProvider.
protected  java.lang.String getTargetStyleSheetName(StyleContext context, StyleSheetDocument document)
          Override of FileSystemStyleCache.getTargetStyleSheetName().
protected  boolean hasSourceDocumentChanged(StyleContext context)
          Override of FileSystemStyleCache.hasSourceDocumentChanged() which checks for changes to the Skin's style sheet.
 
Methods inherited from class org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache
getContentStyleType, getShortStyleClasses, getStyleMap, getStyleSheetURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SkinStyleProvider

protected SkinStyleProvider(org.apache.myfaces.trinidad.skin.Skin skin,
                            java.lang.String targetDirectoryPath)
                     throws java.lang.IllegalArgumentException
Creates SkinStyleProvider instance. Only subclasses should call this method. All other clients should use getSkinStyleProvider().

Parameters:
skin - The Skin which defines the look and feel-specific style information for this StyleProvider.
targetDirectoryPath - The full file system path to the directory where generated CSS files will be stored.
Throws:
java.lang.IllegalArgumentException - This exception is thrown if no Skin is null, or if either of the paths are invalid.
See Also:
SkinStyleProvider(org.apache.myfaces.trinidad.skin.Skin, java.lang.String)
Method Detail

getSkinStyleProvider

public static StyleProvider getSkinStyleProvider(org.apache.myfaces.trinidad.skin.Skin skin,
                                                 java.lang.String targetDirectoryPath)
                                          throws java.lang.IllegalArgumentException
Returns a shared instance of the SkinStyleProvider. The StyleProvider combines styles from two sources. First, styles are pulled from the current Skin, which is retrieved from the RenderingContext. Then, styles are pulled from the custom style sheet, as identified by the (possibly null) customStyleSheetPath argument. Styles specified by the custom style sheet take precedence over styles provided by the Skin.

Parameters:
context - The current RenderingContext, which provides access to the current Skin.
targetDirectoryPath - The full file system path of the directory where generated CSS files are stored. If the directory does not exist and cannot be created, an IllegalArgumentException is thrown.
Throws:
java.lang.IllegalArgumentException - This exception is thrown if no Skin is found, or if either of the paths are invalid.

createStyleSheetDocument

protected StyleSheetDocument createStyleSheetDocument(StyleContext context)
Override of FileSystemStyleCache.createStyleSheetDocument(). Merges the Skin's styles with custom styles to produce a single StyleSheetDocument

Overrides:
createStyleSheetDocument in class FileSystemStyleCache
Parameters:
context - The StyleContext (not needed here, but is needed in subclass)
Returns:
The StyleSheetDocument which defines the styles for this StyleProvider.

hasSourceDocumentChanged

protected boolean hasSourceDocumentChanged(StyleContext context)
Override of FileSystemStyleCache.hasSourceDocumentChanged() which checks for changes to the Skin's style sheet.

Overrides:
hasSourceDocumentChanged in class FileSystemStyleCache
Returns:
true if the underlying source style sheets have been modified, false otherwise.

getTargetStyleSheetName

protected java.lang.String getTargetStyleSheetName(StyleContext context,
                                                   StyleSheetDocument document)
Override of FileSystemStyleCache.getTargetStyleSheetName().

Overrides:
getTargetStyleSheetName in class FileSystemStyleCache
Parameters:
context - The StyleContext
document - The StyleSheetDocument which provides the styles


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.