Class A_CmsSelectWidget
- java.lang.Object
-
- org.opencms.widgets.A_CmsWidget
-
- org.opencms.widgets.A_CmsSelectWidget
-
- All Implemented Interfaces:
I_CmsADEWidget
,I_CmsWidget
- Direct Known Subclasses:
CmsComboWidget
,CmsMultiSelectWidget
,CmsOrgUnitWidget
,CmsRadioSelectWidget
,CmsSelectWidget
public abstract class A_CmsSelectWidget extends A_CmsWidget implements I_CmsADEWidget
Base class for select widgets.- Since:
- 6.0.0
- See Also:
CmsSelectWidgetOption
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opencms.widgets.A_CmsWidget
A_CmsWidget.CmsDummyWidgetDialog
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONFIGURATION_HEIGHT
Configuration parameter to set the height from the select widget in pixel.-
Fields inherited from class org.opencms.widgets.A_CmsWidget
HELP_POSTFIX, LABEL_PREFIX
-
-
Constructor Summary
Constructors Constructor Description A_CmsSelectWidget()
Creates a new select widget.A_CmsSelectWidget(java.lang.String configuration)
Creates a select widget with the select options specified in the given configuration String.A_CmsSelectWidget(java.util.List<CmsSelectWidgetOption> configuration)
Creates a select widget with the select options specified in the given configuration List.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSelectOption(CmsSelectWidgetOption option)
Adds a new select option to this widget.java.lang.String
getConfiguration()
Returns the configuration string.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.java.util.List<java.lang.String>
getCssResourceLinks(CmsObject cms)
Returns a list of CSS resources required by the widget.I_CmsXmlContentHandler.DisplayType
getDefaultDisplayType()
Returns the default display type of this widget.protected java.lang.String
getHeight()
Gets the configured select widget height.java.lang.String
getInitCall()
Returns the java script initialization call.java.util.List<java.lang.String>
getJavaScriptResourceLinks(CmsObject cms)
Returns a list of java script resources required by the widget.protected java.lang.String
getResourcePath(CmsObject cms, I_CmsWidgetDialog dialog)
Gets the resource path for the given dialog.protected java.lang.String
getSelectedValue(CmsObject cms, I_CmsWidgetParameter param)
Returns the currently selected value of the select widget.protected java.util.List<java.lang.String>
getSelectedValues(CmsObject cms, I_CmsWidgetParameter param)
Returns the currently selected values of the select widget.protected java.util.List<CmsSelectWidgetOption>
getSelectOptions()
Returns the list of configured select options.java.lang.String
getWidgetName()
Returns the class name of the widget.boolean
isInternal()
Returns if this is an internal widget.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.void
setConfiguration(java.lang.String configuration)
Sets the configuration of this widget.protected void
setSelectOptions(java.util.List<CmsSelectWidgetOption> selectOptions)
Sets the list of configured select options.-
Methods inherited from class org.opencms.widgets.A_CmsWidget
equals, getDialogHtmlEnd, getDialogIncludes, getDialogInitCall, getDialogInitMethod, getHelpBubble, getHelpKey, getHelpText, getJsHelpMouseHandler, getJSIncludeFile, getLabelKey, getWidgetStringValue, 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, getDialogWidget, getHelpBubble, getHelpText, getWidgetStringValue, isCompactViewEnabled, newInstance, setEditorValue
-
-
-
-
Field Detail
-
CONFIGURATION_HEIGHT
public static final java.lang.String CONFIGURATION_HEIGHT
Configuration parameter to set the height from the select widget in pixel.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
A_CmsSelectWidget
public A_CmsSelectWidget()
Creates a new select widget.
-
A_CmsSelectWidget
public A_CmsSelectWidget(java.util.List<CmsSelectWidgetOption> configuration)
Creates a select widget with the select options specified in the given configuration List.The list elements must be of type
.CmsSelectWidgetOption
- Parameters:
configuration
- the configuration (possible options) for the select widget- See Also:
CmsSelectWidgetOption
-
A_CmsSelectWidget
public A_CmsSelectWidget(java.lang.String configuration)
Creates a select widget with the select options specified in the given configuration String.Please see
for a description of the syntax of the configuration String.CmsSelectWidgetOption
- Parameters:
configuration
- the configuration (possible options) for the select widget- See Also:
CmsSelectWidgetOption
-
-
Method Detail
-
addSelectOption
public void addSelectOption(CmsSelectWidgetOption option)
Adds a new select option to this widget.- Parameters:
option
- the select option to add
-
getConfiguration
public java.lang.String getConfiguration()
Description copied from class:A_CmsWidget
Returns the configuration string.- Specified by:
getConfiguration
in interfaceI_CmsWidget
- Overrides:
getConfiguration
in classA_CmsWidget
- Returns:
- the configuration string
- See Also:
A_CmsWidget.getConfiguration()
-
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
- 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)
-
getCssResourceLinks
public java.util.List<java.lang.String> getCssResourceLinks(CmsObject cms)
Returns a list of CSS resources required by the widget.- Specified by:
getCssResourceLinks
in interfaceI_CmsADEWidget
- Parameters:
cms
- the current OpenCms context- Returns:
- the required CSS resource links
-
getDefaultDisplayType
public I_CmsXmlContentHandler.DisplayType getDefaultDisplayType()
Description copied from interface:I_CmsADEWidget
Returns the default display type of this widget.- Specified by:
getDefaultDisplayType
in interfaceI_CmsADEWidget
- Returns:
- the default display type
- See Also:
I_CmsADEWidget.getDefaultDisplayType()
-
getInitCall
public java.lang.String getInitCall()
Returns the java script initialization call.- Specified by:
getInitCall
in interfaceI_CmsADEWidget
- Returns:
- the java script initialization call
-
getJavaScriptResourceLinks
public java.util.List<java.lang.String> getJavaScriptResourceLinks(CmsObject cms)
Returns a list of java script resources required by the widget.- Specified by:
getJavaScriptResourceLinks
in interfaceI_CmsADEWidget
- Parameters:
cms
- the current OpenCms context- Returns:
- the required java script resource links
-
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
- Returns:
- the class name
- See Also:
I_CmsADEWidget.getWidgetName()
-
isInternal
public boolean isInternal()
Returns if this is an internal widget.Only widgets belonging to the OpenCms core should be marked as internal.
- Specified by:
isInternal
in interfaceI_CmsADEWidget
- Returns:
true
if this is an internal widget
-
setConfiguration
public void setConfiguration(java.lang.String configuration)
Description copied from interface:I_CmsWidget
Sets the configuration of this widget.This can be used to enable / disable certain widget features that should not always be available, or to pass specific initialization information to the widget. It depends on the widget implementation on how this information is used.
- Specified by:
setConfiguration
in interfaceI_CmsWidget
- Overrides:
setConfiguration
in classA_CmsWidget
- Parameters:
configuration
- the configuration to set- See Also:
A_CmsWidget.setConfiguration(java.lang.String)
-
getHeight
protected java.lang.String getHeight()
Gets the configured select widget height.- Returns:
- the configured select widget height
-
getResourcePath
protected java.lang.String getResourcePath(CmsObject cms, I_CmsWidgetDialog dialog)
Gets the resource path for the given dialog.- Parameters:
cms
- TODOdialog
- the dialog- Returns:
- the resource path
-
getSelectedValue
protected java.lang.String getSelectedValue(CmsObject cms, I_CmsWidgetParameter param)
Returns the currently selected value of the select widget.If a value is found in the given parameter, this is used. Otherwise the default value of the select options are used. If there is neither a parameter value nor a default value,
null
is returned.- Parameters:
cms
- the current users OpenCms contextparam
- the widget parameter of this dialog- Returns:
- the currently selected value of the select widget
-
getSelectedValues
protected java.util.List<java.lang.String> getSelectedValues(CmsObject cms, I_CmsWidgetParameter param)
Returns the currently selected values of the select widget.If a value is found in the given parameter, this is used. Otherwise the default value of the select options are used. If there is neither a parameter value nor a default value,
null
is used.- Parameters:
cms
- the current users OpenCms contextparam
- the widget parameter of this dialog- Returns:
- a list of the currently selected values of the select widget
-
getSelectOptions
protected java.util.List<CmsSelectWidgetOption> getSelectOptions()
Returns the list of configured select options.The list elements are of type
.CmsSelectWidgetOption
- Returns:
- the list of select options
-
parseSelectOptions
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.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 dialog- Returns:
- the list of select options
- See Also:
CmsSelectWidgetOption
-
setSelectOptions
protected void setSelectOptions(java.util.List<CmsSelectWidgetOption> selectOptions)
Sets the list of configured select options.The list elements must be of type
.CmsSelectWidgetOption
- Parameters:
selectOptions
- the list of select options to set
-
-