org.opencms.jsp.decorator
Class CmsDecoratorConfiguration

java.lang.Object
  extended by org.opencms.jsp.decorator.CmsDecoratorConfiguration
All Implemented Interfaces:
I_CmsDecoratorConfiguration

public class CmsDecoratorConfiguration
extends java.lang.Object
implements I_CmsDecoratorConfiguration

The CmsDecoratorConfiguration initalizes and stores the text decorations.

It uses uses the information of one or more CmsDecorationDefintion to create the pre- and postfixs for text decorations.

Since:
6.1.3
Version:
$Revision: 1.11 $
Author:
Michael Emmerich

Field Summary
static java.lang.String XPATH_DECORATION
          The xpath for the decoration configuration.
static java.lang.String XPATH_EXCLUDE
          The xpath for the exclude configuration.
static java.lang.String XPATH_USELOCALE
          The xpath for the uselocale configuration.
 
Constructor Summary
CmsDecoratorConfiguration()
          Constructor, creates a new, empty CmsDecoratorConfiguration.
CmsDecoratorConfiguration(CmsObject cms)
          Constructor, creates a new, empty CmsDecoratorConfiguration.
CmsDecoratorConfiguration(CmsObject cms, java.lang.String configFile)
          Constructor, creates a new, CmsDecoratorConfiguration with a given config file.
CmsDecoratorConfiguration(CmsObject cms, java.lang.String configFile, java.util.Locale locale)
          Constructor, creates a new, CmsDecoratorConfiguration with a given config file and locale.
 
Method Summary
 void addDecorations(CmsDecorationDefintion decorationDefinition)
          Adds decorations defined in a CmsDecorationDefintion object to the map of all decorations.
 CmsObject getCms()
          Returns the cms.
 java.lang.String getConfigFile()
          Returns the configFile.
 java.util.Locale getConfigurationLocale()
          Returns the configurationLocale.
 CmsDecorationDefintion getDecorationDefinition(CmsXmlContent configuration, int i)
          Builds a CmsDecorationDefintion from a given configuration file.
 java.util.List getDecorationDefinitions()
          Returns the list with all CmsDecorationDefintion instances parsed from the config file.
 CmsDecorationBundle getDecorations()
          Gets the decoration bundle.
 java.util.List getExcludes()
          Returns the excludes.
 java.util.Locale getLocale()
          Returns the locale.
 java.util.List getUsedDecorations()
          Returns the usedDecorations.
 boolean hasUsed(java.lang.String key)
          Tests if a decoration key was used before in this configuration.
 void init(CmsObject cms, java.lang.String configFile, java.util.Locale locale)
          Initialises the configuration.
 boolean isExcluded(java.lang.String tag)
          Tests if a tag is contained in the exclude list of the decorator.
 void markAsUsed(java.lang.String key)
          Mark a decoration key as already used.
 void resetMarkedDecorations()
          Resets the used decoration keys.
 void setCms(CmsObject cms)
          Sets the cms.
 void setConfigFile(java.lang.String configFile)
          Sets the configFile.
 void setConfigurationLocale(java.util.Locale configurationLocale)
          Sets the configurationLocale.
 void setDecorationDefinitions(java.util.List decorationDefinitions)
          Sets the decorationDefinitions.
 void setDecorations(CmsDecorationBundle decorations)
          Sets the decoration bundle, overwriting an exiting one.
 void setExcludes(java.util.List excludes)
          Sets the excludes.
 void setLocale(java.util.Locale locale)
          Sets the locale.
 void setUsedDecorations(java.util.List usedDecorations)
          Sets the usedDecorations.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XPATH_DECORATION

public static final java.lang.String XPATH_DECORATION
The xpath for the decoration configuration.

See Also:
Constant Field Values

XPATH_EXCLUDE

public static final java.lang.String XPATH_EXCLUDE
The xpath for the exclude configuration.

See Also:
Constant Field Values

XPATH_USELOCALE

public static final java.lang.String XPATH_USELOCALE
The xpath for the uselocale configuration.

See Also:
Constant Field Values
Constructor Detail

CmsDecoratorConfiguration

public CmsDecoratorConfiguration()
Constructor, creates a new, empty CmsDecoratorConfiguration.


CmsDecoratorConfiguration

public CmsDecoratorConfiguration(CmsObject cms)
                          throws CmsException
Constructor, creates a new, empty CmsDecoratorConfiguration.

Parameters:
cms - the CmsObject
Throws:
CmsException - if something goes wrong

CmsDecoratorConfiguration

public CmsDecoratorConfiguration(CmsObject cms,
                                 java.lang.String configFile)
                          throws CmsException
Constructor, creates a new, CmsDecoratorConfiguration with a given config file.

Parameters:
cms - the CmsObject
configFile - the configuration file
Throws:
CmsException - if something goes wrong

CmsDecoratorConfiguration

public CmsDecoratorConfiguration(CmsObject cms,
                                 java.lang.String configFile,
                                 java.util.Locale locale)
                          throws CmsException
Constructor, creates a new, CmsDecoratorConfiguration with a given config file and locale.

Parameters:
cms - the CmsObject
configFile - the configuration file
locale - to locale to build this configuration for
Throws:
CmsException - if something goes wrong
Method Detail

addDecorations

public void addDecorations(CmsDecorationDefintion decorationDefinition)
                    throws CmsException
Adds decorations defined in a CmsDecorationDefintion object to the map of all decorations.

Parameters:
decorationDefinition - the CmsDecorationDefintion the decorations to be added
Throws:
CmsException - if something goes wrong

getCms

public CmsObject getCms()
Returns the cms.

Returns:
the cms

getConfigFile

public java.lang.String getConfigFile()
Returns the configFile.

Returns:
the configFile

getConfigurationLocale

public java.util.Locale getConfigurationLocale()
Returns the configurationLocale.

Returns:
the configurationLocale

getDecorationDefinition

public CmsDecorationDefintion getDecorationDefinition(CmsXmlContent configuration,
                                                      int i)
Builds a CmsDecorationDefintion from a given configuration file.

Specified by:
getDecorationDefinition in interface I_CmsDecoratorConfiguration
Parameters:
configuration - the configuration file
i - the number of the decoration definition to create
Returns:
CmsDecorationDefintion created form configuration file

getDecorationDefinitions

public java.util.List getDecorationDefinitions()
Returns the list with all CmsDecorationDefintion instances parsed from the config file.

Returns:
The list with all CmsDecorationDefintion instances parsed from the config file

getDecorations

public CmsDecorationBundle getDecorations()
Gets the decoration bundle.

Specified by:
getDecorations in interface I_CmsDecoratorConfiguration
Returns:
the decoration bundle to be used

getExcludes

public java.util.List getExcludes()
Returns the excludes.

Returns:
the excludes

getLocale

public java.util.Locale getLocale()
Returns the locale.

Returns:
the locale

getUsedDecorations

public java.util.List getUsedDecorations()
Returns the usedDecorations.

Returns:
the usedDecorations

hasUsed

public boolean hasUsed(java.lang.String key)
Tests if a decoration key was used before in this configuration.

Specified by:
hasUsed in interface I_CmsDecoratorConfiguration
Parameters:
key - the key to look for
Returns:
true if this key was already used

init

public void init(CmsObject cms,
                 java.lang.String configFile,
                 java.util.Locale locale)
          throws CmsException
Description copied from interface: I_CmsDecoratorConfiguration
Initialises the configuration.

Specified by:
init in interface I_CmsDecoratorConfiguration
Parameters:
cms - the CmsObject
configFile - the configuration file
locale - to locale to build this configuration for
Throws:
CmsException - if something goes wrong
See Also:
I_CmsDecoratorConfiguration.init(org.opencms.file.CmsObject, java.lang.String, java.util.Locale)

isExcluded

public boolean isExcluded(java.lang.String tag)
Tests if a tag is contained in the exclude list of the decorator.

Specified by:
isExcluded in interface I_CmsDecoratorConfiguration
Parameters:
tag - the tag to test
Returns:
true if the tag is in the exclode list, false othwerwise.

markAsUsed

public void markAsUsed(java.lang.String key)
Mark a decoration key as already used.

Specified by:
markAsUsed in interface I_CmsDecoratorConfiguration
Parameters:
key - the key to mark

resetMarkedDecorations

public void resetMarkedDecorations()
Resets the used decoration keys.

Specified by:
resetMarkedDecorations in interface I_CmsDecoratorConfiguration

setCms

public void setCms(CmsObject cms)
Sets the cms.

Parameters:
cms - the cms to set

setConfigFile

public void setConfigFile(java.lang.String configFile)
Sets the configFile.

Parameters:
configFile - the configFile to set

setConfigurationLocale

public void setConfigurationLocale(java.util.Locale configurationLocale)
Sets the configurationLocale.

Parameters:
configurationLocale - the configurationLocale to set

setDecorationDefinitions

public void setDecorationDefinitions(java.util.List decorationDefinitions)
Sets the decorationDefinitions.

Parameters:
decorationDefinitions - the decorationDefinitions to set

setDecorations

public void setDecorations(CmsDecorationBundle decorations)
Sets the decoration bundle, overwriting an exiting one.

Parameters:
decorations - new decoration bundle

setExcludes

public void setExcludes(java.util.List excludes)
Sets the excludes.

Parameters:
excludes - the excludes to set

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale.

Parameters:
locale - the locale to set

setUsedDecorations

public void setUsedDecorations(java.util.List usedDecorations)
Sets the usedDecorations.

Parameters:
usedDecorations - the usedDecorations to set

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()