Package org.opencms.widgets
Class CmsVfsImageWidgetConfiguration
java.lang.Object
org.opencms.widgets.CmsGalleryWidgetConfiguration
org.opencms.widgets.CmsVfsImageWidgetConfiguration
Configuration options for the VFS image widget.
The configuration options are read from the configuration String of the widget.
The configuration String has to be formatted as JSON object, with the following possible keys:
class
: optional class implementingI_CmsImageWidgetDynamicConfiguration
to dynamically configure startup parameters and format values.formatnames
: list of format names to select, with pairs of selectable value and selectable text, e.g. value1:optiontext1|value2:optiontext2formatvalues
: corresponding format values to the format names list, can be dynamically generated by the dynamic configuration class. The list of values should contain width and height information, with a '?' as sign for dynamic size and with an 'x' as separator for width and height. Example: ['200x?', '800x600']scaleparams
: default scale parameters (no width, height or crop information should be provided!)startup
: the startup folder, can be dynamically generated by the provided class, in that case, use 'dynamic' as value.type
: the startup folder type, can be 'gallery' or 'category'. Can be dynamically generated by the provided class, in that case, use 'dynamic' as value.usedescription
: indicates if the description input field for the image should be shown or not.useformat
: indicates if the format select box for the image should be shown or not.
{scaleparams: 'q:70,r:2,c:CCCC00', type: 'gallery', startup: '/demo_en/images/',
usedescription: true, useformat: true, formatnames: 'imageleft:Image left|imageright:Image right|imagetop:Image top',
formatvalues: ['150x?', '250x300', '?x250']}
- Since:
- 7.5.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Configuration key name for the formatnames configuration.static final String
Configuration key name for the formatvalues configuration.static final String
Configuration key name for the scaleparams configuration.static final String
Configuration key name for the usedescription configuration.static final String
Configuration key name for the useformat configuration.static final String
The type "category" for the initial image list to load.static final String
The type "gallery" for the initial image list to load.Fields inherited from class org.opencms.widgets.CmsGalleryWidgetConfiguration
CONFIG_KEY_CLASS, CONFIG_KEY_GALLERYTYPES, CONFIG_KEY_STARTUP, CONFIG_KEY_TYPE, CONFIG_VALUE_DYNAMIC, m_className, m_startup, m_type
-
Constructor Summary
ConstructorDescriptionCmsVfsImageWidgetConfiguration
(CmsObject cms, CmsMessages widgetDialog, I_CmsWidgetParameter param, String configuration) Generates an initialized configuration for the image widget using the given configuration string. -
Method Summary
Modifier and TypeMethodDescriptionReturns the values as a parameter string.Returns the list of image format values matching the options for the format select box.Returns the scale parameters to apply to a scaled image (e.g.Returns the list of select options for the format select box, must containCmsSelectWidgetOption
objects.Returns the select options for the format select box as String.protected void
init
(CmsObject cms, CmsMessages widgetDialog, I_CmsWidgetParameter param, String configuration) Initializes the widget configuration using the given configuration string.boolean
Returns if the description field should be shown.boolean
Returns if the format select box should be shown.Methods inherited from class org.opencms.widgets.CmsGalleryWidgetConfiguration
getClassName, getGalleryTypes, getStartup, getType, setClassName, setGalleryTypes, setStartup, setType
-
Field Details
-
CONFIG_KEY_FORMATNAMES
Configuration key name for the formatnames configuration.- See Also:
-
CONFIG_KEY_FORMATVALUES
Configuration key name for the formatvalues configuration.- See Also:
-
CONFIG_KEY_SCALEPARAMS
Configuration key name for the scaleparams configuration.- See Also:
-
CONFIG_KEY_USEDESCRIPTION
Configuration key name for the usedescription configuration.- See Also:
-
CONFIG_KEY_USEFORMAT
Configuration key name for the useformat configuration.- See Also:
-
TYPE_CATEGORY
The type "category" for the initial image list to load.- See Also:
-
TYPE_GALLERY
The type "gallery" for the initial image list to load.- See Also:
-
-
Constructor Details
-
CmsVfsImageWidgetConfiguration
public CmsVfsImageWidgetConfiguration(CmsObject cms, CmsMessages widgetDialog, I_CmsWidgetParameter param, String configuration) Generates an initialized configuration for the image widget using the given configuration string.- Parameters:
cms
- an initialized instance of a CmsObjectwidgetDialog
- the dialog where the widget is used onparam
- the widget parameter to generate the widget forconfiguration
- the widget configuration string
-
-
Method Details
-
getFormatValues
Returns the list of image format values matching the options for the format select box.- Returns:
- the list of image format values matching the options for the format select box
-
getScaleParams
Returns the scale parameters to apply to a scaled image (e.g. quality, type).- Returns:
- scale the parameters to apply to a scaled image
-
getSelectFormat
Returns the list of select options for the format select box, must containCmsSelectWidgetOption
objects.- Returns:
- the list of select options for the format select box
-
getSelectFormatString
Returns the select options for the format select box as String.The String has the following structure
format name 1:localized name 1|format name 2:localized name 2|...
.- Returns:
- the select options for the format select box
-
isShowDescription
Returns if the description field should be shown.- Returns:
- true if the description field should be shown, otherwise false
-
isShowFormat
Returns if the format select box should be shown.- Returns:
- true if the format select box should be shown, otherwise false
-
init
protected void init(CmsObject cms, CmsMessages widgetDialog, I_CmsWidgetParameter param, String configuration) Initializes the widget configuration using the given configuration string.- Overrides:
init
in classCmsGalleryWidgetConfiguration
- Parameters:
cms
- an initialized instance of a CmsObjectwidgetDialog
- the dialog where the widget is used onparam
- the widget parameter to generate the widget forconfiguration
- the widget configuration string
-
getConfigString
Returns the values as a parameter string.- Overrides:
getConfigString
in classCmsGalleryWidgetConfiguration
- Returns:
- the values as a parameter string
-