Class CmsFormatterConfiguration

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

public final class CmsFormatterConfiguration extends 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 Details

  • Method Details

    • create

      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
    • matchFormatter

      public static boolean matchFormatter(I_CmsFormatterBean formatter, Set<String> types, int width)
      Checks whether the given formatter bean matches the container types, width and nested flag.

      Parameters:
      formatter - the formatter bean
      types - the container types
      width - the container width
      Returns:
      true in case the formatter matches
    • matchFormatter

      public static boolean matchFormatter(I_CmsFormatterBean formatter, String types, int width)
      Checks whether the given formatter bean matches the container types, width and nested flag.

      Parameters:
      formatter - the formatter bean
      types - the container types
      width - the container width
      Returns:
      true in case the formatter matches
    • getAllFormatters

      Gets a list of all defined formatters.

      Returns:
      the list of all formatters
    • getAllMatchingFormatters

      public List<I_CmsFormatterBean> getAllMatchingFormatters(String containerTypes, int containerWidth)
      Gets the formatters which are available for the given container type and width.

      Parameters:
      containerTypes - the container types (comma separated)
      containerWidth - the container width
      Returns:
      the list of available formatters
    • getDefaultFormatter

      public I_CmsFormatterBean getDefaultFormatter(String containerTypes, int containerWidth)
      Selects the best 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:
      containerTypes - the container types (comma separated)
      containerWidth - the container width
      Returns:
      the matching formatter, or null if none was found
    • getDefaultSchemaFormatter

      public I_CmsFormatterBean getDefaultSchemaFormatter(String containerTypes, int containerWidth)
      Selects the best matching schema formatter for the provided type and width from this configuration.

      Parameters:
      containerTypes - the container types (comma separated)
      containerWidth - the container width
      Returns:
      the matching formatter, or null if none was found
    • getDetailFormatter

      public I_CmsFormatterBean getDetailFormatter(String types, int containerWidth)
      Gets the detail formatter to use for the given type and container width.

      Parameters:
      types - the container types (comma separated)
      containerWidth - the container width
      Returns:
      the detail formatter to use
    • getDetailFormatters

      Gets all detail formatters.

      Returns:
      the detail formatters
    • getDisplayFormatter

      Returns the display formatter for this type.

      Returns:
      the display formatter
    • getDisplayFormatters

      Returns the available display formatters.

      Returns:
      the display formatters
    • getFormatterSelection

      public Map<String,I_CmsFormatterBean> getFormatterSelection(String containerTypes, int containerWidth)
      Returns the formatters available for selection for the given container type and width.

      Parameters:
      containerTypes - the container types (comma separated)
      containerWidth - the container width
      Returns:
      the list of available formatters
    • getFormatterSelectionByKeyOrId

      public Map<String,I_CmsFormatterBean> getFormatterSelectionByKeyOrId(String containerTypes, int containerWidth)
    • getFormattersForKey

      Gets the list of formatters for the given key or id (also supports schema_formatter ids).
      Parameters:
      key - a formatter key or id
      Returns:
      the list of formatters for the given key
    • 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(String containerTypes, int containerWidth)
      Returns the provided true in case this configuration has a formatter for the given type / width parameters.

      Parameters:
      containerTypes - the container types (comma separated)
      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 - the formatter structure id
      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