org.opencms.xml.containerpage
Class CmsFormatterConfiguration

java.lang.Object
  extended by org.opencms.xml.containerpage.CmsFormatterConfiguration

public final class CmsFormatterConfiguration
extends java.lang.Object

Represents a formatter configuration.

A formatter configuration can be either defined in the XML schema XSD of a XML content, or in a special sitemap configuration file.

Since:
8.0.0

Field Summary
static CmsFormatterConfiguration EMPTY_CONFIGURATION
          The empty formatter configuration.
static org.apache.commons.logging.Log LOG
          The log instance for this class.
 
Method Summary
static CmsFormatterConfiguration create(CmsObject cms, java.util.List<CmsFormatterBean> formatters)
          Returns the formatter configuration for the current project based on the given list of formatters.
 java.util.List<CmsFormatterBean> getAllFormatters()
          Gets a list of all defined formatters.
 CmsFormatterBean getFormatter(java.lang.String containerType, int containerWidth)
          Selects the matching formatter for the provided type and width from this configuration.
 CmsFormatterBean getPreviewFormatter()
          Returns the formatter from this configuration that is to be used for the preview in the ADE gallery GUI, or null if there is no preview formatter configured.
 boolean hasFormatter(java.lang.String containerType, int containerWidth)
          Returns the provided true in case this configuration has a formatter for the given type / width parameters.
 boolean hasFormatters()
          Returns true in case there is at least one usable formatter configured in this configuration.
static void initialize(CmsObject cms)
          Initialize the formatter configuration.
 boolean isSearchContent(CmsUUID formatterStructureId)
          Returns true in case this configuration contains a formatter with the provided structure id that has been configured for including the formatted content in the online search.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_CONFIGURATION

public static final CmsFormatterConfiguration EMPTY_CONFIGURATION
The empty formatter configuration.


LOG

public static final org.apache.commons.logging.Log LOG
The log instance for this class.

Method Detail

create

public static CmsFormatterConfiguration create(CmsObject cms,
                                               java.util.List<CmsFormatterBean> formatters)
Returns the formatter configuration for the current project based on the given list of formatters.

Parameters:
cms - the current users OpenCms context, required to know which project to read the JSP from
formatters - the list of configured formatters
Returns:
the formatter configuration for the current project based on the given list of formatters

initialize

public static void initialize(CmsObject cms)
                       throws CmsException
Initialize the formatter configuration.

Parameters:
cms - an initialized admin OpenCms user context
Throws:
CmsException - in case the initialization fails

getAllFormatters

public java.util.List<CmsFormatterBean> getAllFormatters()
Gets a list of all defined formatters.

Returns:
the list of all formatters

getFormatter

public CmsFormatterBean getFormatter(java.lang.String containerType,
                                     int containerWidth)
Selects the matching formatter for the provided type and width from this configuration.

This method first tries to find the formatter for the provided container type. If this fails, it returns the width based formatter that matched the container width.

Parameters:
containerType - the container type
containerWidth - the container width
Returns:
the matching formatter, or null if none was found

getPreviewFormatter

public CmsFormatterBean getPreviewFormatter()
Returns the formatter from this configuration that is to be used for the preview in the ADE gallery GUI, or null if there is no preview formatter configured.

Returns:
the formatter from this configuration that is to be used for the preview in the ADE gallery GUI, or null if there is no preview formatter configured

hasFormatter

public boolean hasFormatter(java.lang.String containerType,
                            int containerWidth)
Returns the provided true in case this configuration has a formatter for the given type / width parameters.

Parameters:
containerType - the container type
containerWidth - the container width
Returns:
the provided true in case this configuration has a formatter for the given type / width parameters.

hasFormatters

public boolean hasFormatters()
Returns true in case there is at least one usable formatter configured in this configuration.

Returns:
true in case there is at least one usable formatter configured in this configuration

isSearchContent

public boolean isSearchContent(CmsUUID formatterStructureId)
Returns true in case this configuration contains a formatter with the provided structure id that has been configured for including the formatted content in the online search.

Parameters:
formatterStructureId -
Returns:
true in case this configuration contains a formatter with the provided structure id that has been configured for including the formatted content in the online search