org.apache.jetspeed.decoration
Class BaseDecoration

java.lang.Object
  extended by org.apache.jetspeed.decoration.BaseDecoration
All Implemented Interfaces:
java.io.Serializable, Decoration
Direct Known Subclasses:
LayoutDecorationImpl, PortletDecorationImpl

public class BaseDecoration
extends java.lang.Object
implements Decoration, java.io.Serializable

Base class implementing the most common methods shared between LayoutDecorations and PortletDecorations.

Author:
Scott T. Weaver, Steve Milek
See Also:
Decoration, LayoutDecoration, PortletDecoration, Serialized Form

Field Summary
protected  java.util.Properties config
           
protected static java.lang.String NO_SUCH_RESOURCE
           
 
Fields inherited from interface org.apache.jetspeed.decoration.Decoration
BASE_CSS_CLASS_PROP, CONFIG_DESKTOP_FILE_NAME, CONFIG_FILE_NAME, DEFAULT_COMMON_STYLE_SHEET, DEFAULT_DESKTOP_STYLE_SHEET, DEFAULT_PORTAL_STYLE_SHEET, DESKTOP_SUPPORTED_PROPERTY, RESOURCE_BUNDLE_PROP, RESOURCES_DIRECTORY_NAME
 
Constructor Summary
BaseDecoration(java.util.Properties config, ResourceValidator validator, Path basePath, Path baseClientPath, PathResolverCache cache)
           
 
Method Summary
 java.util.List getActions()
          Returns the list of DecoratorActions to be displayed within the portlet window.
 java.lang.String getBaseCSSClass()
          Returns the base CSS class the template should use to create a proper CSS cascade and style isolation for a decoration.
 java.lang.String getBasePath()
           Returns the base path for the decoration.
 java.lang.String getBasePath(java.lang.String relativePath)
           Returns the base path for the decoration with the relativePath argument added.
 java.lang.String getCurrentModeAction()
          Returns the name of the currently active mode action
 java.lang.String getCurrentStateAction()
          Returns the name of the currently active state action
 java.lang.String getName()
          The name of this Decoration.
 java.lang.String getProperty(java.lang.String name)
          Allows access to abritrary properties configured within your decorator.properties config file.
protected  java.lang.String getResource(Path rootPath, Path searchPath)
          Recursively tries to locate a resource.
 java.lang.String getResource(java.lang.String path)
           Returns the correct path to the resource based on the relative path argument.
 java.util.ResourceBundle getResourceBundle(java.util.Locale locale, RequestContext context)
           
 java.lang.String getResourceBundleName()
           
 java.lang.String getStyleSheet()
           
 java.lang.String getStyleSheetDesktop()
           
 java.lang.String getStyleSheetPortal()
           
 void init(java.util.Properties config, ResourceValidator validator, PathResolverCache cache)
           
 void setActions(java.util.List actions)
          Set the list of DecoratorActions to be displayed within the portlet window.
 void setCurrentModeAction(java.lang.String currentModeAction)
          Set the name of the currently active mode action
 void setCurrentStateAction(java.lang.String currentStateAction)
          Set the name of the currently active state action
 boolean supportsDesktop()
          Indicates whether the decorator supports /desktop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_SUCH_RESOURCE

protected static final java.lang.String NO_SUCH_RESOURCE
See Also:
Constant Field Values

config

protected transient java.util.Properties config
Constructor Detail

BaseDecoration

public BaseDecoration(java.util.Properties config,
                      ResourceValidator validator,
                      Path basePath,
                      Path baseClientPath,
                      PathResolverCache cache)
Parameters:
config - java.util.Properties object containing configuration infomation for this Decoration.
validator - The ResourceValidator to be used in looking up fully-qualified resource pathes
baseClientPath - The "root" of the decroation hierarchy.
Throws:
InvalidDecorationConfigurationException
Method Detail

init

public void init(java.util.Properties config,
                 ResourceValidator validator,
                 PathResolverCache cache)

getName

public java.lang.String getName()
Description copied from interface: Decoration
The name of this Decoration.

Specified by:
getName in interface Decoration
Returns:
Name of this decoration.

getBasePath

public java.lang.String getBasePath()
Description copied from interface: Decoration

Returns the base path for the decoration.

Specified by:
getBasePath in interface Decoration
Returns:
the base path for the decoration.

getBasePath

public java.lang.String getBasePath(java.lang.String relativePath)
Description copied from interface: Decoration

Returns the base path for the decoration with the relativePath argument added.

Specified by:
getBasePath in interface Decoration
Returns:
the base path for the decoration with the relativePath argument added.

getResource

public java.lang.String getResource(java.lang.String path)
Description copied from interface: Decoration

Returns the correct path to the resource based on the relative path argument. This usually entails locating the resource that is most appropriate for the current users client and locale.

 Example Criterion:
 
 Relative Path: images/myimage.gif
 Client:        web browser
 Language:      en 
 Country:       US 
 
 

The implementation should now attempt to resolve the resource using logic that starts at the most specific and ends at the most general path.

For exmaples sake, lets say we are concerned with finding the image, myimage.gif, within the layout decoration, tigris. The logical progression to find the resourc, myimage.gif, would be as follows:

 
 /decorations/layout/tigris/html/en/US/images/myimage.gif
 /decorations/layout/tigris/html/en/images/myimage.gif
 /decorations/layout/tigris/html/images/myimage.gif
 /decorations/layout/tigris/images/myimage.gif
 /decorations/layout/images/myimage.gif
 /decorations/layout/images/myimage.gif
 

Specified by:
getResource in interface Decoration
Returns:
the correct path to the resource based on the relative path argument.

getResource

protected java.lang.String getResource(Path rootPath,
                                       Path searchPath)
Recursively tries to locate a resource.

Parameters:
rootPath - initial path to start looking for the searchPath. The "pruning" of the rootPath of subsequest recursive calls follows the logic detailed in the Decoration.getResource(String) method.
searchPath - relative path to the resource we wish to locate.
Returns:
See Also:
Decoration

getStyleSheet

public java.lang.String getStyleSheet()
Specified by:
getStyleSheet in interface Decoration
Returns:
The appropriate stylesheet to be used with this decoration.

getStyleSheetPortal

public java.lang.String getStyleSheetPortal()
Specified by:
getStyleSheetPortal in interface Decoration
Returns:
the /portal specific stylesheet to be used with this decoration; defined only when decoration supports /desktop.

getStyleSheetDesktop

public java.lang.String getStyleSheetDesktop()
Specified by:
getStyleSheetDesktop in interface Decoration
Returns:
the /desktop specific stylesheet to be used with this decoration; defined only when decoration supports /desktop.

getActions

public java.util.List getActions()
Description copied from interface: Decoration
Returns the list of DecoratorActions to be displayed within the portlet window.

Specified by:
getActions in interface Decoration
Returns:
the list of DecoratorActions to be displayed within the portlet window.
See Also:
DecoratorAction

setActions

public void setActions(java.util.List actions)
Description copied from interface: Decoration
Set the list of DecoratorActions to be displayed within the portlet window.

Specified by:
setActions in interface Decoration
Parameters:
actions - actions to displayed within this portlet window.
See Also:
DecoratorAction

getProperty

public java.lang.String getProperty(java.lang.String name)
Description copied from interface: Decoration
Allows access to abritrary properties configured within your decorator.properties config file.

Specified by:
getProperty in interface Decoration
Returns:
value of decoration property which matches name argument.

getBaseCSSClass

public java.lang.String getBaseCSSClass()
Description copied from interface: Decoration
Returns the base CSS class the template should use to create a proper CSS cascade and style isolation for a decoration.

Specified by:
getBaseCSSClass in interface Decoration
Returns:
the base CSS class the template should use.

getCurrentModeAction

public java.lang.String getCurrentModeAction()
Description copied from interface: Decoration
Returns the name of the currently active mode action

Specified by:
getCurrentModeAction in interface Decoration
Returns:
the name of the currently active mode action

setCurrentModeAction

public void setCurrentModeAction(java.lang.String currentModeAction)
Description copied from interface: Decoration
Set the name of the currently active mode action

Specified by:
setCurrentModeAction in interface Decoration

getCurrentStateAction

public java.lang.String getCurrentStateAction()
Description copied from interface: Decoration
Returns the name of the currently active state action

Specified by:
getCurrentStateAction in interface Decoration
Returns:
the name of the currently active state action

setCurrentStateAction

public void setCurrentStateAction(java.lang.String currentStateAction)
Description copied from interface: Decoration
Set the name of the currently active state action

Specified by:
setCurrentStateAction in interface Decoration

getResourceBundleName

public java.lang.String getResourceBundleName()
Specified by:
getResourceBundleName in interface Decoration
Returns:
the resource bundle locator prefix.

getResourceBundle

public java.util.ResourceBundle getResourceBundle(java.util.Locale locale,
                                                  RequestContext context)
Specified by:
getResourceBundle in interface Decoration
Returns:
the resource bundle for the given Locale and RequestContext.

supportsDesktop

public boolean supportsDesktop()
Description copied from interface: Decoration
Indicates whether the decorator supports /desktop

Specified by:
supportsDesktop in interface Decoration


Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.