public final class CmsFormatterConfiguration extends java.lang.Object
A formatter configuration can be either defined in the XML schema XSD of a XML content, or in a special sitemap configuration file.
| Modifier and Type | Class and Description |
|---|---|
static class |
CmsFormatterConfiguration.FormatterComparator
This class is used to sort lists of formatter beans in order of importance.
|
static class |
CmsFormatterConfiguration.IsDetail
Predicate which checks whether the given formatter is a detail formatter.
|
static class |
CmsFormatterConfiguration.IsDisplay
Predicate which checks whether the given formatter is a display formatter.
|
static class |
CmsFormatterConfiguration.IsSchemaFormatter
Predicate to check whether the formatter is from a schema.
|
| Modifier and Type | Field and Description |
|---|---|
static CmsFormatterConfiguration |
EMPTY_CONFIGURATION
The empty formatter configuration.
|
static org.apache.commons.logging.Log |
LOG
The log instance for this class.
|
static int |
MATCH_ALL_CONTAINER_WIDTH
The container width to match all width configured formatters.
|
| Modifier and Type | Method and Description |
|---|---|
static CmsFormatterConfiguration |
create(CmsObject cms,
java.util.List<I_CmsFormatterBean> formatters)
Returns the formatter configuration for the current project based on the given list of formatters.
|
java.util.List<I_CmsFormatterBean> |
getAllFormatters()
Gets a list of all defined formatters.
|
java.util.List<I_CmsFormatterBean> |
getAllMatchingFormatters(java.lang.String containerTypes,
int containerWidth)
Gets the formatters which are available for the given container type and width.
|
I_CmsFormatterBean |
getDefaultFormatter(java.lang.String containerTypes,
int containerWidth)
Selects the best matching formatter for the provided type and width from this configuration.
|
I_CmsFormatterBean |
getDefaultSchemaFormatter(java.lang.String containerTypes,
int containerWidth)
Selects the best matching schema formatter for the provided type and width from this configuration.
|
I_CmsFormatterBean |
getDetailFormatter(java.lang.String types,
int containerWidth)
Gets the detail formatter to use for the given type and container width.
|
java.util.Collection<I_CmsFormatterBean> |
getDetailFormatters()
Gets all detail formatters.
|
I_CmsFormatterBean |
getDisplayFormatter()
Returns the display formatter for this type.
|
java.util.List<I_CmsFormatterBean> |
getDisplayFormatters()
Returns the available display formatters.
|
java.util.Map<java.lang.String,I_CmsFormatterBean> |
getFormatterSelection(java.lang.String containerTypes,
int containerWidth)
Returns the formatters available for selection for the given container type and width.
|
I_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 containerTypes,
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. |
static boolean |
matchFormatter(I_CmsFormatterBean formatter,
java.util.Set<java.lang.String> types,
int width)
Checks whether the given formatter bean matches the container types, width and nested flag.
|
public static final CmsFormatterConfiguration EMPTY_CONFIGURATION
public static final org.apache.commons.logging.Log LOG
public static final int MATCH_ALL_CONTAINER_WIDTH
public static CmsFormatterConfiguration create(CmsObject cms, java.util.List<I_CmsFormatterBean> formatters)
cms - the current users OpenCms context, required to know which project to read the JSP fromformatters - the list of configured formatterspublic static void initialize(CmsObject cms) throws CmsException
cms - an initialized admin OpenCms user contextCmsException - in case the initialization failspublic static boolean matchFormatter(I_CmsFormatterBean formatter, java.util.Set<java.lang.String> types, int width)
formatter - the formatter beantypes - the container typeswidth - the container widthtrue in case the formatter matchespublic java.util.List<I_CmsFormatterBean> getAllFormatters()
public java.util.List<I_CmsFormatterBean> getAllMatchingFormatters(java.lang.String containerTypes, int containerWidth)
containerTypes - the container types (comma separated)containerWidth - the container widthpublic I_CmsFormatterBean getDefaultFormatter(java.lang.String containerTypes, int containerWidth)
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.
containerTypes - the container types (comma separated)containerWidth - the container widthnull if none was foundpublic I_CmsFormatterBean getDefaultSchemaFormatter(java.lang.String containerTypes, int containerWidth)
containerTypes - the container types (comma separated)containerWidth - the container widthnull if none was foundpublic I_CmsFormatterBean getDetailFormatter(java.lang.String types, int containerWidth)
types - the container types (comma separated)containerWidth - the container widthpublic java.util.Collection<I_CmsFormatterBean> getDetailFormatters()
public I_CmsFormatterBean getDisplayFormatter()
public java.util.List<I_CmsFormatterBean> getDisplayFormatters()
public java.util.Map<java.lang.String,I_CmsFormatterBean> getFormatterSelection(java.lang.String containerTypes, int containerWidth)
containerTypes - the container types (comma separated)containerWidth - the container widthpublic I_CmsFormatterBean getPreviewFormatter()
null if there is no preview formatter configured.null if there is no preview formatter configuredpublic boolean hasFormatter(java.lang.String containerTypes, int containerWidth)
true in case this configuration has a formatter
for the given type / width parameters.containerTypes - the container types (comma separated)containerWidth - the container widthtrue in case this configuration has a formatter
for the given type / width parameters.public boolean hasFormatters()
true in case there is at least one usable formatter configured in this configuration.true in case there is at least one usable formatter configured in this configurationpublic boolean isSearchContent(CmsUUID formatterStructureId)
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.formatterStructureId - the formatter structure idtrue 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