Package org.opencms.jsp.decorator
Class CmsDecoratorConfiguration
- java.lang.Object
-
- 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
to create the pre- and postfixs for text decorations.CmsDecorationDefintion
- Since:
- 6.1.3
-
-
Field Summary
Fields Modifier and Type Field Description 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_EXCLUDEATTR
The xpath for the exclude configuration.static java.lang.String
XPATH_USELOCALE
The xpath for the uselocale configuration.
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDecorations(CmsDecorationDefintion decorationDefinition)
Adds decorations defined in a
object to the map of all decorations.CmsDecorationDefintion
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<CmsDecorationDefintion>
getDecorationDefinitions()
Returns the list with all
instances parsed from the config file.CmsDecorationDefintion
CmsDecorationBundle
getDecorations()
Gets the decoration bundle.java.util.List<java.lang.String>
getExcludeattr()
Returns the excludeattr.java.util.List<java.lang.String>
getExcludes()
Returns the excludes.java.util.Locale
getLocale()
Returns the locale.java.util.List<java.lang.String>
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.boolean
isExcludedAttr(org.htmlparser.Tag tag)
Tests if a tag has an attribute thatis 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<CmsDecorationDefintion> decorationDefinitions)
Sets the decorationDefinitions.void
setDecorations(CmsDecorationBundle decorations)
Sets the decoration bundle, overwriting an exiting one.void
setExcludeattr(java.util.List<java.lang.String> excludeattr)
Sets the excludeattr.void
setExcludes(java.util.List<java.lang.String> excludes)
Sets the excludes.void
setLocale(java.util.Locale locale)
Sets the locale.void
setUsedDecorations(java.util.List<java.lang.String> usedDecorations)
Sets the usedDecorations.java.lang.String
toString()
-
-
-
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_EXCLUDEATTR
public static final java.lang.String XPATH_EXCLUDEATTR
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 CmsObjectconfigFile
- 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 CmsObjectconfigFile
- the configuration filelocale
- 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
object to the map of all decorations.CmsDecorationDefintion
- Parameters:
decorationDefinition
- the
the decorations to be addedCmsDecorationDefintion
- Throws:
CmsException
- if something goes wrong
-
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 interfaceI_CmsDecoratorConfiguration
- Parameters:
configuration
- the configuration filei
- the number of the decoration definition to create- Returns:
- CmsDecorationDefintion created form configuration file
-
getDecorationDefinitions
public java.util.List<CmsDecorationDefintion> getDecorationDefinitions()
Returns the list with all
instances parsed from the config file.CmsDecorationDefintion
- Returns:
- The list with all
instances parsed from the config fileCmsDecorationDefintion
-
getDecorations
public CmsDecorationBundle getDecorations()
Gets the decoration bundle.- Specified by:
getDecorations
in interfaceI_CmsDecoratorConfiguration
- Returns:
- the decoration bundle to be used
-
getExcludeattr
public java.util.List<java.lang.String> getExcludeattr()
Returns the excludeattr.- Returns:
- the excludeattr
-
getExcludes
public java.util.List<java.lang.String> getExcludes()
Returns the excludes.- Returns:
- the excludes
-
getLocale
public java.util.Locale getLocale()
Returns the locale.- Returns:
- the locale
-
getUsedDecorations
public java.util.List<java.lang.String> 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 interfaceI_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 interfaceI_CmsDecoratorConfiguration
- Parameters:
cms
- the CmsObjectconfigFile
- the configuration filelocale
- 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 interfaceI_CmsDecoratorConfiguration
- Parameters:
tag
- the tag to test- Returns:
- true if the tag is in the exclode list, false othwerwise.
-
isExcludedAttr
public boolean isExcludedAttr(org.htmlparser.Tag tag)
Description copied from interface:I_CmsDecoratorConfiguration
Tests if a tag has an attribute thatis contained in the exclude list of the decorator.- Specified by:
isExcludedAttr
in interfaceI_CmsDecoratorConfiguration
- Parameters:
tag
- the tag to test- Returns:
- true if the tag is in the exclude list, false otherwise.
- See Also:
I_CmsDecoratorConfiguration.isExcludedAttr(org.htmlparser.Tag)
-
markAsUsed
public void markAsUsed(java.lang.String key)
Mark a decoration key as already used.- Specified by:
markAsUsed
in interfaceI_CmsDecoratorConfiguration
- Parameters:
key
- the key to mark
-
resetMarkedDecorations
public void resetMarkedDecorations()
Resets the used decoration keys.- Specified by:
resetMarkedDecorations
in interfaceI_CmsDecoratorConfiguration
-
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<CmsDecorationDefintion> 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
-
setExcludeattr
public void setExcludeattr(java.util.List<java.lang.String> excludeattr)
Sets the excludeattr.- Parameters:
excludeattr
- the excludeattr to set
-
setExcludes
public void setExcludes(java.util.List<java.lang.String> 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<java.lang.String> usedDecorations)
Sets the usedDecorations.- Parameters:
usedDecorations
- the usedDecorations to set
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-