Class CmsFormatterBean
- All Implemented Interfaces:
Cloneable
,I_CmsFormatterBean
- Direct Known Subclasses:
CmsFlexFormatterBean
,CmsFunctionFormatterBean
,CmsMacroFormatterBean
- Since:
- 8.0.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Default rank for formatters from formatter configuration files.static final int
Default rank for formatters defined in schema.Set of alias keys.The formatter container type.CSS Head includes.protected String
The description text for the formatter.protected String
Provides the display type.protected String
The id for this formatter.protected String
Inline CSS snippets.protected String
Inline Javascript snippets.protected boolean
Is the formatter automatically enabled?protected boolean
True if this formatter can be used for detail views.protected boolean
Is the formatter from a formatter configuration file?protected boolean
Indicates if this formatter is to be used as preview in the ADE gallery GUI.JavaScript head includes.protected String
The formatter JSP.protected CmsUUID
The UUID of the JSP resource for this formatter.protected String
The formatter key.protected String
The location this formatter was configured in.protected boolean
If true, will match any container/width combination.protected int
The formatter max width.protected List<CmsMetaMapping>
The meta mappings.protected int
The formatter min width.protected boolean
Indicates whether nested formatter settings should be displayed.protected String
The nice name.protected List<CmsTemplatePlugin>
The referenced plugins.protected int
The rank.protected Collection<String>
The resource type name.protected boolean
Indicates if the content should be searchable in the online index when this formatter is used.protected boolean
Indicating if this formatter will always render all nested containers.protected boolean
Indicates whether meta mappings should be applied for all elements.static final String
Default formatter type constant.static final int
The width of the preview window for the formatters.static final String
Wildcard formatter type for width based formatters. -
Constructor Summary
ConstructorDescriptionCmsFormatterBean
(String containerType, String jspRootPath, String minWidthStr, String maxWidthStr, String preview, String searchContent, String location) Constructor for creating a new formatter configuration without resource structure id.CmsFormatterBean
(String containerType, String rootPath, CmsUUID structureId, int minWidth, int maxWidth, boolean preview, boolean searchContent, String location) Constructor for creating a new formatter configuration with resource structure id.CmsFormatterBean
(Set<String> containerTypes, String jspRootPath, CmsUUID jspStructureId, String key, Set<String> aliasKeys, int minWidth, int maxWidth, boolean preview, boolean searchContent, String location, List<String> cssHeadIncludes, String inlineCss, List<String> javascriptHeadIncludes, String inlineJavascript, List<CmsTemplatePlugin> plugins, String niceName, String description, Collection<String> resourceTypeNames, int rank, String id, CmsSettingConfiguration settingConfig, boolean isFromConfigFile, boolean isAutoEnabled, boolean isDetail, String displayType, boolean isAllowsSettingsInEditor, boolean strictContainers, boolean nestedFormatterSettings, List<CmsMetaMapping> metaMappings, Map<String, String> attributes, boolean useMetaMappingsForNormalElements) Constructor for creating a new formatter configuration with resource structure id. -
Method Summary
Modifier and TypeMethodDescriptionGets the set of alias keys for the formatter.Gets the complete set of keys for the formatter, i.e.Gets the map of attributes.Returns the formatter container type.Gets the CSS head includes.getDescription
(Locale locale) Gets the formatter description.The display type of this formatter ornull
in case this is not a display formatter.getId()
Returns the id of this formatter.Gets the inline CSS snippets.Gets the inline JS snippets.Gets the Javascript head includes.Returns the root path of the formatter JSP in the OpenCms VFS.Returns the structure id of the JSP resource for this formatter.getKey()
Gets the formatter key, or null if no formatter key is set.Returns the location this formatter was defined in.int
Returns the maximum formatter width.Returns the meta mappings.int
Returns the minimum formatter width.getNiceName
(Locale locale) Gets the nice name for this formatter.int
getRank()
Gets the rank.Gets the resource type names.getSettings
(CmsADEConfigData config) Gets the defined settings.Gets the template plugins.int
hashCode()
boolean
Returns if nested formatter settings should be displayed.boolean
Returns whether this formatter allows settings to be edited in the content editor.boolean
Returns true if the formatter is automatically enabled.boolean
Returns true if the formatter can be used for detail views.boolean
Returns whether this formatter should be used by the 'display' tag.boolean
Returns true if the formatter is from a formatter configuration file.boolean
Returns true if this formatter should match all type/width combinations.boolean
Indicates if this formatter is to be used as preview in the ADE gallery GUI.static boolean
isPreviewType
(String containerType) Checks if the given container type matches the ADE gallery preview type.boolean
Returnstrue
in case an XML content formatted with this formatter should be included in the online full text search.boolean
Returns whether this formatter will always render all nested containers.boolean
Returnstrue
in case this formatter is based on type information.void
setJspStructureId
(CmsUUID jspStructureId) Sets the structure id of the JSP for this formatter.toString()
boolean
Returns true if meta mappings should be evaluated for normal container elements using this formatter, not just detail elements.withKeys
(Collection<String> keys) If possible, returns a formatter bean that is basically a copy of this one, but has the keys supplied as a parameter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opencms.xml.containerpage.I_CmsFormatterBean
getKeyOrId
-
Field Details
-
DEFAULT_CONFIGURATION_RANK
Default rank for formatters from formatter configuration files.- See Also:
-
DEFAULT_SCHEMA_RANK
Default rank for formatters defined in schema.- See Also:
-
PREVIEW_TYPE
Default formatter type constant.- See Also:
-
PREVIEW_WIDTH
The width of the preview window for the formatters.- See Also:
-
WILDCARD_TYPE
Wildcard formatter type for width based formatters.- See Also:
-
m_containerTypes
The formatter container type. -
m_cssHeadIncludes
CSS Head includes. -
m_description
The description text for the formatter. -
m_aliasKeys
Set of alias keys. -
m_displayType
Provides the display type. If empty if this formatter should not be used by the display tag. -
m_id
The id for this formatter. -
m_inlineCss
Inline CSS snippets. -
m_inlineJavascript
Inline Javascript snippets. -
m_isAutoEnabled
Is the formatter automatically enabled? -
m_isDetail
True if this formatter can be used for detail views. -
m_isFromFormatterConfigFile
Is the formatter from a formatter configuration file? -
m_isPreviewFormatter
Indicates if this formatter is to be used as preview in the ADE gallery GUI. -
m_javascriptHeadIncludes
JavaScript head includes. -
m_jspRootPath
The formatter JSP. -
m_jspStructureId
The UUID of the JSP resource for this formatter. -
m_key
The formatter key. -
m_location
The location this formatter was configured in. -
m_matchAll
If true, will match any container/width combination. -
m_maxWidth
The formatter max width. -
m_metaMappings
The meta mappings. -
m_minWidth
The formatter min width. -
m_nestedFormatterSettings
Indicates whether nested formatter settings should be displayed. -
m_niceName
The nice name. -
m_plugins
The referenced plugins. -
m_rank
The rank. -
m_resourceTypeNames
The resource type name. -
m_search
Indicates if the content should be searchable in the online index when this formatter is used. -
m_strictContainers
Indicating if this formatter will always render all nested containers. -
m_useMetaMappingsForNormalElements
Indicates whether meta mappings should be applied for all elements.
-
-
Constructor Details
-
CmsFormatterBean
public CmsFormatterBean(Set<String> containerTypes, String jspRootPath, CmsUUID jspStructureId, String key, Set<String> aliasKeys, int minWidth, int maxWidth, boolean preview, boolean searchContent, String location, List<String> cssHeadIncludes, String inlineCss, List<String> javascriptHeadIncludes, String inlineJavascript, List<CmsTemplatePlugin> plugins, String niceName, String description, Collection<String> resourceTypeNames, int rank, String id, CmsSettingConfiguration settingConfig, boolean isFromConfigFile, boolean isAutoEnabled, boolean isDetail, String displayType, boolean isAllowsSettingsInEditor, boolean strictContainers, boolean nestedFormatterSettings, List<CmsMetaMapping> metaMappings, Map<String, String> attributes, boolean useMetaMappingsForNormalElements) Constructor for creating a new formatter configuration with resource structure id.- Parameters:
containerTypes
- the formatter container typesjspRootPath
- the formatter JSP VFS root pathjspStructureId
- the structure id of the formatter JSPkey
- the formatter keyaliasKeys
- the alias keysminWidth
- the formatter min widthmaxWidth
- the formatter max widthpreview
- indicates if this formatter is to be used for the preview in the ADE gallery GUIsearchContent
- indicates if the content should be searchable in the online index when this formatter is usedlocation
- the location where this formatter was defined, should be an OpenCms VFS resource pathcssHeadIncludes
- the CSS head includesinlineCss
- the in-line CSSjavascriptHeadIncludes
- the JavaScript headincludesinlineJavascript
- the in-line JavaScriptplugins
- the template pluginsniceName
- the configuration display namedescription
- the description text for the formatterresourceTypeNames
- the resource type namesrank
- the configuration rankid
- the configuration idsettingConfig
- the settings configurationisFromConfigFile
-true
if configuration file basedisAutoEnabled
-true
if auto enabledisDetail
-true
if detail formatterdisplayType
- the display typeisAllowsSettingsInEditor
- whether this formatter allows settings to be edited in the content editorstrictContainers
-true
if this formatter will always render all nested containersnestedFormatterSettings
- indicates whether nested formatter settings should be displayedmetaMappings
- the meta mappingsattributes
- the formatter attributesuseMetaMappingsForNormalElements
- if true, meta mappings will be evaluated for normal container elements, not just detail elements
-
CmsFormatterBean
public CmsFormatterBean(String containerType, String rootPath, CmsUUID structureId, int minWidth, int maxWidth, boolean preview, boolean searchContent, String location) Constructor for creating a new formatter configuration with resource structure id.- Parameters:
containerType
- the formatter container typesrootPath
- the formatter JSP VFS root pathstructureId
- the structure id of the formatter JSPminWidth
- the formatter min widthmaxWidth
- the formatter max widthpreview
- indicates if this formatter is to be used for the preview in the ADE gallery GUIsearchContent
- indicates if the content should be searchable in the online index when this formatter is usedlocation
- the location where this formatter was defined, should be an OpenCms VFS resource path
-
CmsFormatterBean
public CmsFormatterBean(String containerType, String jspRootPath, String minWidthStr, String maxWidthStr, String preview, String searchContent, String location) Constructor for creating a new formatter configuration without resource structure id.- Parameters:
containerType
- the formatter container typejspRootPath
- the formatter JSP VFS root pathminWidthStr
- the formatter min widthmaxWidthStr
- the formatter max widthpreview
- indicates if this formatter is to be used for the preview in the ADE gallery GUIsearchContent
- indicates if the content should be searchable in the online index when this formatter is usedlocation
- the location where this formatter was defined, should be an OpenCms VFS resource path
-
-
Method Details
-
isPreviewType
Checks if the given container type matches the ADE gallery preview type.- Parameters:
containerType
- the container type to check- Returns:
true
if the given container type matches the ADE gallery preview type
-
getAliasKeys
Description copied from interface:I_CmsFormatterBean
Gets the set of alias keys for the formatter.- Specified by:
getAliasKeys
in interfaceI_CmsFormatterBean
- Returns:
- the set of alias keys
- See Also:
-
getAllKeys
Description copied from interface:I_CmsFormatterBean
Gets the complete set of keys for the formatter, i.e. its main key and all alias keys.- Specified by:
getAllKeys
in interfaceI_CmsFormatterBean
- Returns:
- the complete set of keys
- See Also:
-
getAttributes
Description copied from interface:I_CmsFormatterBean
Gets the map of attributes.- Specified by:
getAttributes
in interfaceI_CmsFormatterBean
- Returns:
- the attribute map
- See Also:
-
getContainerTypes
Description copied from interface:I_CmsFormatterBean
Returns the formatter container type.If this is "*", then the formatter is a width based formatter.
- Specified by:
getContainerTypes
in interfaceI_CmsFormatterBean
- Returns:
- the formatter container type
- See Also:
-
getCssHeadIncludes
Description copied from interface:I_CmsFormatterBean
Gets the CSS head includes.- Specified by:
getCssHeadIncludes
in interfaceI_CmsFormatterBean
- Returns:
- the CSS head includes
- See Also:
-
getDescription
Description copied from interface:I_CmsFormatterBean
Gets the formatter description.If a locale is passed in, macros in the configured description will be resolved with a macro resolver set to that locale. If null is passed in as a locale, the raw configured description will be returned.
- Specified by:
getDescription
in interfaceI_CmsFormatterBean
- Parameters:
locale
- the locale (may be null)- Returns:
- the formatter description
- See Also:
-
getDisplayType
Description copied from interface:I_CmsFormatterBean
The display type of this formatter ornull
in case this is not a display formatter.- Specified by:
getDisplayType
in interfaceI_CmsFormatterBean
- Returns:
- the display type
- See Also:
-
getId
Description copied from interface:I_CmsFormatterBean
Returns the id of this formatter.This method may return null because the id is not always defined for formatters, e.g. for those formatters declared in a schema.
- Specified by:
getId
in interfaceI_CmsFormatterBean
- Returns:
- the formatter id
- See Also:
-
getInlineCss
Description copied from interface:I_CmsFormatterBean
Gets the inline CSS snippets.- Specified by:
getInlineCss
in interfaceI_CmsFormatterBean
- Returns:
- the inline CSS snippets
- See Also:
-
getInlineJavascript
Description copied from interface:I_CmsFormatterBean
Gets the inline JS snippets.- Specified by:
getInlineJavascript
in interfaceI_CmsFormatterBean
- Returns:
- the inline JS snippets
- See Also:
-
getJavascriptHeadIncludes
Description copied from interface:I_CmsFormatterBean
Gets the Javascript head includes.- Specified by:
getJavascriptHeadIncludes
in interfaceI_CmsFormatterBean
- Returns:
- the head includes
- See Also:
-
getJspRootPath
Description copied from interface:I_CmsFormatterBean
Returns the root path of the formatter JSP in the OpenCms VFS.- Specified by:
getJspRootPath
in interfaceI_CmsFormatterBean
- Returns:
- the root path of the formatter JSP in the OpenCms VFS.
- See Also:
-
getJspStructureId
Description copied from interface:I_CmsFormatterBean
Returns the structure id of the JSP resource for this formatter.- Specified by:
getJspStructureId
in interfaceI_CmsFormatterBean
- Returns:
- the structure id of the JSP resource for this formatter
- See Also:
-
getKey
Description copied from interface:I_CmsFormatterBean
Gets the formatter key, or null if no formatter key is set.A formatter key is used to allow dynamic switching between formatters with the same key by enabling/disabling the formatters in the sitemap configuration. I.e. if a formatter referenced in a container page has been disabled in the sitemap configuration, but a different formatter with the same key is enabled, the second formatter will be used instead when rendering the page .
- Specified by:
getKey
in interfaceI_CmsFormatterBean
- Returns:
- the formatter key, or null
- See Also:
-
getLocation
Description copied from interface:I_CmsFormatterBean
Returns the location this formatter was defined in.This will be an OpenCms VFS root path, either to the XML schema XSD, or the configuration file this formatter was defined in, or to the JSP that makes up this formatter.
- Specified by:
getLocation
in interfaceI_CmsFormatterBean
- Returns:
- the location this formatter was defined in
- See Also:
-
getMaxWidth
Description copied from interface:I_CmsFormatterBean
Returns the maximum formatter width.If this is not set, then
Integer.MAX_VALUE
is returned.- Specified by:
getMaxWidth
in interfaceI_CmsFormatterBean
- Returns:
- the maximum formatter width
- See Also:
-
getMetaMappings
Description copied from interface:I_CmsFormatterBean
Returns the meta mappings.- Specified by:
getMetaMappings
in interfaceI_CmsFormatterBean
- Returns:
- the meta mappings
- See Also:
-
getMinWidth
Description copied from interface:I_CmsFormatterBean
Returns the minimum formatter width.If this is not set, then
-1
is returned.- Specified by:
getMinWidth
in interfaceI_CmsFormatterBean
- Returns:
- the minimum formatter width
- See Also:
-
getNiceName
Description copied from interface:I_CmsFormatterBean
Gets the nice name for this formatter.- Specified by:
getNiceName
in interfaceI_CmsFormatterBean
- Parameters:
locale
- the locale- Returns:
- the nice name for this formatter
- See Also:
-
getRank
Description copied from interface:I_CmsFormatterBean
Gets the rank.- Specified by:
getRank
in interfaceI_CmsFormatterBean
- Returns:
- the rank
- See Also:
-
getResourceTypeNames
Description copied from interface:I_CmsFormatterBean
Gets the resource type names.- Specified by:
getResourceTypeNames
in interfaceI_CmsFormatterBean
- Returns:
- the resource type names
- See Also:
-
getSettings
Description copied from interface:I_CmsFormatterBean
Gets the defined settings.- Specified by:
getSettings
in interfaceI_CmsFormatterBean
- Parameters:
config
- the sitemap configuration for which the settings should be retrieved- Returns:
- the defined settings
- See Also:
-
getTemplatePlugins
Description copied from interface:I_CmsFormatterBean
Gets the template plugins.- Specified by:
getTemplatePlugins
in interfaceI_CmsFormatterBean
- Returns:
- the template plugins
- See Also:
-
hashCode
-
hasNestedFormatterSettings
Description copied from interface:I_CmsFormatterBean
Returns if nested formatter settings should be displayed.- Specified by:
hasNestedFormatterSettings
in interfaceI_CmsFormatterBean
- Returns:
true
if nested formatter settings should be displayed- See Also:
-
isAllowsSettingsInEditor
Description copied from interface:I_CmsFormatterBean
Returns whether this formatter allows settings to be edited in the content editor.- Specified by:
isAllowsSettingsInEditor
in interfaceI_CmsFormatterBean
- Returns:
true
in case editing the settings is allowed in the content editor- See Also:
-
isAutoEnabled
Description copied from interface:I_CmsFormatterBean
Returns true if the formatter is automatically enabled.- Specified by:
isAutoEnabled
in interfaceI_CmsFormatterBean
- Returns:
- true if the formatter is automatically enabled
- See Also:
-
isDetailFormatter
Description copied from interface:I_CmsFormatterBean
Returns true if the formatter can be used for detail views.- Specified by:
isDetailFormatter
in interfaceI_CmsFormatterBean
- Returns:
- true if the formatter can be used for detail views
- See Also:
-
isDisplayFormatter
Description copied from interface:I_CmsFormatterBean
Returns whether this formatter should be used by the 'display' tag.- Specified by:
isDisplayFormatter
in interfaceI_CmsFormatterBean
- Returns:
true
if this formatter should be used by the 'display' tag- See Also:
-
isFromFormatterConfigFile
Description copied from interface:I_CmsFormatterBean
Returns true if the formatter is from a formatter configuration file.- Specified by:
isFromFormatterConfigFile
in interfaceI_CmsFormatterBean
- Returns:
- formatter f
- See Also:
-
isMatchAll
Description copied from interface:I_CmsFormatterBean
Returns true if this formatter should match all type/width combinations.- Specified by:
isMatchAll
in interfaceI_CmsFormatterBean
- Returns:
- true if this formatter should match all type/width combinations
- See Also:
-
isPreviewFormatter
Description copied from interface:I_CmsFormatterBean
Indicates if this formatter is to be used as preview in the ADE gallery GUI.- Specified by:
isPreviewFormatter
in interfaceI_CmsFormatterBean
- Returns:
true
if this formatter is to be used as preview in the ADE gallery GUI- See Also:
-
isSearchContent
Description copied from interface:I_CmsFormatterBean
Returnstrue
in case an XML content formatted with this formatter should be included in the online full text search.- Specified by:
isSearchContent
in interfaceI_CmsFormatterBean
- Returns:
true
in case an XML content formatted with this formatter should be included in the online full text search- See Also:
-
isStrictContainers
Returns whether this formatter will always render all nested containers.- Returns:
true
if this formatter will always render all nested containers
-
isTypeFormatter
Description copied from interface:I_CmsFormatterBean
Returnstrue
in case this formatter is based on type information.- Specified by:
isTypeFormatter
in interfaceI_CmsFormatterBean
- Returns:
true
in case this formatter is based on type information- See Also:
-
setJspStructureId
Sets the structure id of the JSP for this formatter.This is "package visible" as it should be only called from
CmsFormatterConfiguration.initialize(org.opencms.file.CmsObject)
.- Specified by:
setJspStructureId
in interfaceI_CmsFormatterBean
- Parameters:
jspStructureId
- the structure id of the JSP for this formatter
-
toString
-
useMetaMappingsForNormalElements
Description copied from interface:I_CmsFormatterBean
Returns true if meta mappings should be evaluated for normal container elements using this formatter, not just detail elements.- Specified by:
useMetaMappingsForNormalElements
in interfaceI_CmsFormatterBean
- Returns:
- true if meta mappings should be evaluated for normal container elements
- See Also:
-
withKeys
Description copied from interface:I_CmsFormatterBean
If possible, returns a formatter bean that is basically a copy of this one, but has the keys supplied as a parameter.Note that this only works for formatters which already have a key, and can not replace the main key. If the keys already match, the current instance may be returned rather than a copy.
If the formatter bean implementation does not support key replacement, or an error occurs, an empty Optional is returned
- Specified by:
withKeys
in interfaceI_CmsFormatterBean
- Parameters:
keys
- the keys to use (should include the current key of the formatter- Returns:
- the copy with the replaced keys
- See Also:
-