Package org.opencms.widgets
Class A_CmsFormatterWidget
- java.lang.Object
-
- org.opencms.widgets.A_CmsWidget
-
- org.opencms.widgets.A_CmsSelectWidget
-
- org.opencms.widgets.CmsSelectWidget
-
- org.opencms.widgets.A_CmsFormatterWidget
-
- All Implemented Interfaces:
I_CmsADEWidget
,I_CmsWidget
- Direct Known Subclasses:
CmsAddFormatterWidget
,CmsRemoveFormatterWidget
public abstract class A_CmsFormatterWidget extends CmsSelectWidget
Abstract superclass for widgets used to enable or disable formatters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
A_CmsFormatterWidget.FormatterSelectComparator
Comparator used to sort formatter beans in the order in which they should be displayed in the selection.-
Nested classes/interfaces inherited from class org.opencms.widgets.A_CmsWidget
A_CmsWidget.CmsDummyWidgetDialog
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.commons.logging.Log
LOG
The logger instance for this class.-
Fields inherited from class org.opencms.widgets.A_CmsSelectWidget
CONFIGURATION_HEIGHT
-
Fields inherited from class org.opencms.widgets.A_CmsWidget
HELP_POSTFIX, LABEL_PREFIX
-
-
Constructor Summary
Constructors Constructor Description A_CmsFormatterWidget()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
getConfiguration(CmsObject cms, A_CmsXmlContentValue schemaType, CmsMessages messages, CmsResource resource, java.util.Locale contentLocale)
Returns the configuration string for the ADE content editor widget.protected abstract java.util.List<CmsSelectWidgetOption>
getFormatterOptions(CmsObject cms, CmsADEConfigData config, java.lang.String rootPath, boolean allRemoved)
Gets the options corresponding to external (non-schema) formatters.protected abstract java.util.Set<java.lang.String>
getSelectedInFile(CmsConfigurationReader reader, CmsXmlContent content)
Gets the values which have already been selected in the edited resource on the VFS.protected abstract java.util.List<CmsSelectWidgetOption>
getTypeOptions(CmsObject cms, CmsADEConfigData config, boolean allRemoved)
Gets the options corresponding to the schemas which define formatters.java.lang.String
getWidgetName()
Returns the class name of the widget.static CmsSelectWidgetOption
getWidgetOptionForFormatter(CmsObject cms, I_CmsFormatterBean formatter)
Creates a widget option corresponding to a formatter bean for an external formatter.static CmsSelectWidgetOption
getWidgetOptionForType(CmsObject cms, java.lang.String typeName)
Creates a widget option for a resource type.protected java.util.List<CmsSelectWidgetOption>
parseSelectOptions(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param)
Returns the list of configured select options, parsing the configuration String if required.protected java.util.List<CmsSelectWidgetOption>
parseSelectOptions(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param, boolean allRemoved)
Returns the list of configured select options, parsing the configuration String if required.-
Methods inherited from class org.opencms.widgets.CmsSelectWidget
getDialogWidget, getWidgetStringValue, newInstance
-
Methods inherited from class org.opencms.widgets.A_CmsSelectWidget
addSelectOption, getConfiguration, getCssResourceLinks, getDefaultDisplayType, getHeight, getInitCall, getJavaScriptResourceLinks, getResourcePath, getSelectedValue, getSelectedValues, getSelectOptions, isInternal, setConfiguration, setSelectOptions
-
Methods inherited from class org.opencms.widgets.A_CmsWidget
equals, getDialogHtmlEnd, getDialogIncludes, getDialogInitCall, getDialogInitMethod, getHelpBubble, getHelpKey, getHelpText, getJsHelpMouseHandler, getJSIncludeFile, getLabelKey, hashCode, isCompactViewEnabled, setEditorValue
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opencms.widgets.I_CmsWidget
getDialogHtmlEnd, getDialogIncludes, getDialogInitCall, getDialogInitMethod, getHelpBubble, getHelpText, isCompactViewEnabled, setEditorValue
-
-
-
-
Field Detail
-
LOG
protected static final org.apache.commons.logging.Log LOG
The logger instance for this class.
-
-
Constructor Detail
-
A_CmsFormatterWidget
public A_CmsFormatterWidget()
-
-
Method Detail
-
getWidgetOptionForFormatter
public static CmsSelectWidgetOption getWidgetOptionForFormatter(CmsObject cms, I_CmsFormatterBean formatter) throws java.lang.Exception
Creates a widget option corresponding to a formatter bean for an external formatter.- Parameters:
cms
- the current CMS contextformatter
- the formatter bean- Returns:
- the select option which was created
- Throws:
java.lang.Exception
- in case reading the formatter configuration file fails
-
getWidgetOptionForType
public static CmsSelectWidgetOption getWidgetOptionForType(CmsObject cms, java.lang.String typeName)
Creates a widget option for a resource type.- Parameters:
cms
- the current CMS contexttypeName
- the type for which we want a widget option- Returns:
- the created widget option
-
getConfiguration
public java.lang.String getConfiguration(CmsObject cms, A_CmsXmlContentValue schemaType, CmsMessages messages, CmsResource resource, java.util.Locale contentLocale)
Description copied from interface:I_CmsADEWidget
Returns the configuration string for the ADE content editor widget.- Specified by:
getConfiguration
in interfaceI_CmsADEWidget
- Overrides:
getConfiguration
in classA_CmsSelectWidget
- Parameters:
cms
- the OpenCms contextschemaType
- the schema typemessages
- the messagesresource
- the edited resourcecontentLocale
- the content locale- Returns:
- the configuration string
- See Also:
I_CmsADEWidget.getConfiguration(org.opencms.file.CmsObject, org.opencms.xml.types.A_CmsXmlContentValue, org.opencms.i18n.CmsMessages, org.opencms.file.CmsResource, java.util.Locale)
-
getWidgetName
public java.lang.String getWidgetName()
Description copied from interface:I_CmsADEWidget
Returns the class name of the widget.- Specified by:
getWidgetName
in interfaceI_CmsADEWidget
- Overrides:
getWidgetName
in classCmsSelectWidget
- Returns:
- the class name
- See Also:
I_CmsADEWidget.getWidgetName()
-
getFormatterOptions
protected abstract java.util.List<CmsSelectWidgetOption> getFormatterOptions(CmsObject cms, CmsADEConfigData config, java.lang.String rootPath, boolean allRemoved)
Gets the options corresponding to external (non-schema) formatters.- Parameters:
cms
- the CMS contextconfig
- the ADE configurationrootPath
- the root path of the edited fileallRemoved
- flag, indicating if all inheritedly available formatters should be disabled- Returns:
- the select widget options for the external formatters
-
getSelectedInFile
protected abstract java.util.Set<java.lang.String> getSelectedInFile(CmsConfigurationReader reader, CmsXmlContent content)
Gets the values which have already been selected in the edited resource on the VFS.- Parameters:
reader
- a sitemap configuration readercontent
- the unmarshalled content- Returns:
- the set of values which have already been selected
-
getTypeOptions
protected abstract java.util.List<CmsSelectWidgetOption> getTypeOptions(CmsObject cms, CmsADEConfigData config, boolean allRemoved)
Gets the options corresponding to the schemas which define formatters.- Parameters:
cms
- the current CMS contextconfig
- the ADE configurationallRemoved
- flag, indicating if all inheritedly available formatters should be disabled- Returns:
- the select widget options for the content types with formatters in the schema
-
parseSelectOptions
protected java.util.List<CmsSelectWidgetOption> parseSelectOptions(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param)
Description copied from class:A_CmsSelectWidget
Returns the list of configured select options, parsing the configuration String if required.The list elements are of type
. The configuration String is parsed only once and then stored internally.CmsSelectWidgetOption
- Overrides:
parseSelectOptions
in classA_CmsSelectWidget
- Parameters:
cms
- the current users OpenCms contextwidgetDialog
- the dialog of this widgetparam
- the widget parameter of this dialog- Returns:
- the list of select options
- See Also:
A_CmsSelectWidget.parseSelectOptions(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter)
-
parseSelectOptions
protected java.util.List<CmsSelectWidgetOption> parseSelectOptions(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param, boolean allRemoved)
Returns the list of configured select options, parsing the configuration String if required.The list elements are of type
. The configuration String is parsed only once and then stored internally.CmsSelectWidgetOption
- Parameters:
cms
- the current users OpenCms contextwidgetDialog
- the dialog of this widgetparam
- the widget parameter of this dialogallRemoved
- flag, indicating if all inheritedly available formatters should be disabled- Returns:
- the list of select options
- See Also:
CmsSelectWidgetOption
-
-