Class CmsHtmlWidgetOption
Options can be defined for each element of the type OpenCmsHtml
using the widget HtmlWidget
.
They have to be placed in the annotation section of a XSD describing an XML content. The configuration
attribute
in the layout
node for the element must contain the activated options as a comma separated String value:
Available options are:
anchor
: the anchor dialog buttonbuttonbar:${button bar items, separated by ';'}
: an individual button bar configuration, seeBUTTONBAR_DEFAULT
for an example.css:/vfs/path/to/cssfile.css
: the absolute path in the OpenCms VFS to the CSS style sheet to use to render the contents in the editor (availability depends on the integrated editor)formatselect
: the format selector for selecting text format like paragraph or headingsformatselect.options:${list of options, separated by ';'}
: the options that should be available in the format selector, e.g.formatselect.options:p;h1;h2
fullpage
: the editor creates an entire HTML page code${gallerytype}
: Shows a gallery dialog button, e.g.imagegallery
displays the image gallery button ordownloadgallery
displays the download gallery buttonheight:${editorheight}
: the editor height, where the height can be specified in px or %, e.g.400px
hidebuttons:${list of buttons to hide, separated by ';'}
: the buttons to hide that usually appear in the default button bar, e.g.hidebuttons:bold;italic;underline;strikethrough
hides some formatting buttonsimage
: the image dialog button (availability depends on the integrated editor)link
: the link dialog buttonsource
: shows the source code toggle button(s)stylesxml:/vfs/path/to/stylefile.xml
: the absolute path in the OpenCms VFS to the user defined styles that should be displayed in the style selector (availability depends on the integrated editor)stylesformat:/vfs/path/to/stylefile.xml
: the absolute path in the OpenCms VFS to the user defined styles format that should be displayed in the style selector (availability depends on the integrated editor)table
: the table dialog button (availability depends on the integrated editor)
opencms-vfs.xml
.- Since:
- 6.0.1
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The button bar end block indicator.static final String
The button bar start block indicator.static final String
The default editor widget button bar configuration.The default button bar configuration as List.static final String
The button bar separator.static final String
The delimiter to use in the configuration String.static final char
The delimiter to use for separation of option values.static final String
The editor widget default maximum height to use.static final String
Option for the "abbreviation" button.static final String
Option for the "absolute" button.static final String
Option for the "acronym" button.static final String
Option for the "advanced hr" button.static final String
Allow scripts in source code editor.static final String
Option for the "anchor" dialog.static final String
Option for the "insert/edit attributes" button.static final String
Option for the "background color" button.static final String
Option for the "block quote" button.static final String
Option for the "buttonbar" configuration.static final String
Option for the "citation" button.static final String
Option for the "clean up messy code" button.static final String
Option for the css style sheet VFS path to use in the widget area.static final String
Option for the "mark text as deletion" button.static final String
If this is set, the contents of the path following the ':' will be interpreted as JSON and passed to TinyMCE directly.static final String
Option for the "editor link" dialog (editor specific).static final String
Option for the "emotions" button.static final String
Option for the "find" dialog.static final String
Option for the "font select" button.static final String
Option for the "font size" button.static final String
Option for the "text color" button.static final String
Option for the "formatselect" selector.static final String
Option for the "formatselect" options selector.static final String
Option for the "fullpage" editor variant.static final String
Option for the "height" configuration.static final String
Option for the "hidebuttons" configuration.static final String
Option for the "hr" button.static final String
Option for the "image" dialog.static final String
Option to import styles from stylesheet into the style selector.static final String
Option for the "mark text as insertion" button.static final String
Option for the "insert date" button.static final String
Option for the "insert layer" button.static final String
Option for the "insert time" button.static final String
Option for the "link" dialog.static final String
Option for the default protocol for linksstatic final String
Option for the "left to right text" button.static final String
Option for the "insert media (flash, video, audio)" button.static final String
Option for the "move backward (layer context)" button.static final String
Option for the "move forward (layer context)" button.static final String
Option for the "new document (remove existing content)" button.static final String
Option for the "non breaking white space" button.static final String
Option for the "page break" button.static final String
Option for the "paste from word" button.static final String
Option for the "print" button.static final String
Option for the "replace" dialog.static final String
Option for the "right to left text" button.static final String
Option for the "source" code mode.static final String
Option for the "special char dialog" button.static final String
Option for the "spell check" dialog.static final String
Option for the style select box.static final String
Option for the "edit CSS style" button.static final String
Option for the styles XML VFS path to use in the widget area.static final String
Option for the styles format VFS path to use in the widget area.static final String
Option for the "table" dialog.static final String
Option for the "insert predefined template content" button.static final String
Typography button.static final String
Option for the "unlink" button.static final String
Option for the "show/hide guidelines/invisible elements" button.static final String
Option for the "show/hide visual control characters" button.static final String[]
The optional buttons that can be additionally added to the button bar.The optional buttons that can be additionally added to the button bar as list.static final Pattern
Pattern used for matching embedded gallery configurations. -
Constructor Summary
ConstructorDescriptionCreates a new empty HTML widget object object.CmsHtmlWidgetOption
(String configuration) Creates a new HTML widget object object, configured by the given configuration String. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAdditionalButton
(String buttonName) Adds a button to the list of defined additional buttons.static String
Returns a HTML widget configuration String created from the given HTML widget option.Returns the buttons to show additionally as list with button names.getButtonBar
(Map<String, String> buttonNamesLookUp, String itemSeparator) Returns the specific editor button bar string generated from the configuration.getButtonBar
(Map<String, String> buttonNamesLookUp, String itemSeparator, boolean addMissingBlock) Returns the specific editor button bar string generated from the configuration.Returns the individual button bar configuration option.Returns the individual button bar configuration option string.Returns the calculated button bar items, including blocks and separators, considering the current widget configuration.protected String
getButtonName
(String barItem, Map<String, String> buttonNamesLookUp) Returns the real button name matched with the look up map.Returns the original configuration String that was used to initialize the HTML widget options.Returns the CSS style sheet VFS path to use in the widget area.Gets the path of a JSON file containing options to be passed directly into TinyMCE.Returns the widget editor height.Gets the embedded gallery configurations.Returns the options for the format select box as String.Returns the buttons to hide as list with button names.Returns the link default protocol to use when inserting/editing links via the link dialog.Returns the styles format VFS path to use in the widget area.Returns the styles XML VFS path to use in the widget area.void
Initializes the widget options from the given configuration String.boolean
Returns true if scripts should be allowed in the source code editor.boolean
isButtonAdditional
(String buttonName) Returns if the button with the given name should be additionally shown.boolean
isButtonHidden
(String buttonName) Returns if the button with the given name should be hidden.boolean
isButtonOptional
(String buttonName) Returns if the button with the given name is optional.boolean
Returns if the editor should be used in full page mode.boolean
Return true if the content stylesheet's styles should be imported into the style selector.parseEmbeddedGalleryOptions
(String configuration) Parses and removes embedded gallery configuration strings.protected void
parseOptions
(String configuration) Parses the given configuration String.void
setAdditionalButtons
(List<String> buttons) Sets the buttons to show additionally as list with button names.void
setButtonBarOption
(List<String> buttonBar) Sets the individual button bar configuration option.void
setButtonBarOptionString
(String buttonBar) Sets the individual button bar configuration option string.void
setCssPath
(String cssPath) Sets the CSS style sheet VFS path to use in the widget area.void
setEditorConfigPath
(String optionJsonPath) Sets the path for a file containing JSON options to be passed directly into TinyMCE.void
setEditorHeight
(String editorHeight) Sets the widget editor height.void
setFormatSelectOptions
(String formatSelectOptions) Sets the options for the format select box as String.void
setFullPage
(boolean fullPage) Sets if the editor should be used in full page mode.void
setHiddenButtons
(List<String> buttons) Sets the buttons to hide as list with button names.void
setLinkDefaultProtocol
(String linkDefaultProtocol) Set the link default protocol to use when inserting/editing links via the link dialogvoid
setStylesFormatPath
(String stylesFormatPath) Sets the styles format VFS path to use in the widget area.void
setStylesXmlPath
(String stylesXmlPath) Sets the styles XML VFS path to use in the widget area.boolean
Returns true if the anchor dialog button should be available.boolean
Returns true if the format selector should be available.boolean
showGalleryDialog
(String galleryType) Returns true if the specified gallery type dialog button is shown.boolean
Returns true if the image dialog button should be available.boolean
Returns true if the link dialog button should be available.boolean
Returns true if the source code button should be available.boolean
Returns true if the styles format selector should be available.boolean
Returns true if the styles selector should be available.boolean
Returns true if the table dialog button should be available.boolean
useCss()
Returns true if the widget editor should use a defined CSS style sheet.
-
Field Details
-
BUTTONBAR_BLOCK_END
The button bar end block indicator.- See Also:
-
BUTTONBAR_BLOCK_START
The button bar start block indicator.- See Also:
-
BUTTONBAR_DEFAULT
The default editor widget button bar configuration.- See Also:
-
BUTTONBAR_DEFAULT_LIST
The default button bar configuration as List. -
BUTTONBAR_SEPARATOR
The button bar separator.- See Also:
-
DELIMITER_OPTION
The delimiter to use in the configuration String.- See Also:
-
DELIMITER_VALUE
The delimiter to use for separation of option values.- See Also:
-
EDITOR_DEFAULMAXTHEIGHT
The editor widget default maximum height to use.- See Also:
-
OPTION_ABBR
Option for the "abbreviation" button.- See Also:
-
OPTION_ABSOLUTE
Option for the "absolute" button.- See Also:
-
OPTION_ACRONYM
Option for the "acronym" button.- See Also:
-
OPTION_ADVHR
Option for the "advanced hr" button.- See Also:
-
OPTION_ALLOWSCRIPTS
Allow scripts in source code editor.- See Also:
-
OPTION_ANCHOR
Option for the "anchor" dialog.- See Also:
-
OPTION_ATTRIBS
Option for the "insert/edit attributes" button.- See Also:
-
OPTION_BACKCOLOR
Option for the "background color" button.- See Also:
-
OPTION_BLOCKQUOTE
Option for the "block quote" button.- See Also:
-
OPTION_BUTTONBAR
Option for the "buttonbar" configuration.- See Also:
-
OPTION_CITE
Option for the "citation" button.- See Also:
-
OPTION_CLEANUP
Option for the "clean up messy code" button.- See Also:
-
OPTION_CSS
Option for the css style sheet VFS path to use in the widget area.- See Also:
-
OPTION_DEL
Option for the "mark text as deletion" button.- See Also:
-
OPTION_EDITORCONFIG
If this is set, the contents of the path following the ':' will be interpreted as JSON and passed to TinyMCE directly.- See Also:
-
OPTION_EDITORLINK
Option for the "editor link" dialog (editor specific).- See Also:
-
OPTION_EMOTIONS
Option for the "emotions" button.- See Also:
-
OPTION_FIND
Option for the "find" dialog.- See Also:
-
OPTION_FONTSELECT
Option for the "font select" button.- See Also:
-
OPTION_FONTSIZESELECT
Option for the "font size" button.- See Also:
-
OPTION_FORECOLOR
Option for the "text color" button.- See Also:
-
OPTION_FORMATSELECT
Option for the "formatselect" selector.- See Also:
-
OPTION_FORMATSELECT_OPTIONS
Option for the "formatselect" options selector.- See Also:
-
OPTION_FULLPAGE
Option for the "fullpage" editor variant.- See Also:
-
OPTION_HEIGHT
Option for the "height" configuration.- See Also:
-
OPTION_HIDEBUTTONS
Option for the "hidebuttons" configuration.- See Also:
-
OPTION_HR
Option for the "hr" button.- See Also:
-
OPTION_IMAGE
Option for the "image" dialog.- See Also:
-
OPTION_IMPORTCSS
Option to import styles from stylesheet into the style selector.- See Also:
-
OPTION_INS
Option for the "mark text as insertion" button.- See Also:
-
OPTION_INSERTDATE
Option for the "insert date" button.- See Also:
-
OPTION_INSERTLAYER
Option for the "insert layer" button.- See Also:
-
OPTION_INSERTTIME
Option for the "insert time" button.- See Also:
-
OPTION_LINK
Option for the "link" dialog.- See Also:
-
OPTION_LINKDEFAULTPROTOCOL
Option for the default protocol for links- See Also:
-
OPTION_LTR
Option for the "left to right text" button.- See Also:
-
OPTION_MEDIA
Option for the "insert media (flash, video, audio)" button.- See Also:
-
OPTION_MOVEBACKWARD
Option for the "move backward (layer context)" button.- See Also:
-
OPTION_MOVEFORWARD
Option for the "move forward (layer context)" button.- See Also:
-
OPTION_NEWDOCUMENT
Option for the "new document (remove existing content)" button.- See Also:
-
OPTION_NONBREAKING
Option for the "non breaking white space" button.- See Also:
-
OPTION_PAGEBREAK
Option for the "page break" button.- See Also:
-
OPTION_PASTEWORD
Option for the "paste from word" button.- See Also:
-
OPTION_PRINT
Option for the "print" button.- See Also:
-
OPTION_REPLACE
Option for the "replace" dialog.- See Also:
-
OPTION_RTL
Option for the "right to left text" button.- See Also:
-
OPTION_SOURCE
Option for the "source" code mode.- See Also:
-
OPTION_SPECIALCHAR
Option for the "special char dialog" button.- See Also:
-
OPTION_SPELLCHECK
Option for the "spell check" dialog.- See Also:
-
OPTION_STYLE
Option for the style select box.- See Also:
-
OPTION_STYLEPROPS
Option for the "edit CSS style" button.- See Also:
-
OPTION_STYLES
Option for the styles XML VFS path to use in the widget area.- See Also:
-
OPTION_STYLES_FORMAT
Option for the styles format VFS path to use in the widget area.- See Also:
-
OPTION_TABLE
Option for the "table" dialog.- See Also:
-
OPTION_TEMPLATE
Option for the "insert predefined template content" button.- See Also:
-
OPTION_TYPOGRAPHY
Typography button.- See Also:
-
OPTION_UNLINK
Option for the "unlink" button.- See Also:
-
OPTION_VISUALAID
Option for the "show/hide guidelines/invisible elements" button.- See Also:
-
OPTION_VISUALCHARS
Option for the "show/hide visual control characters" button.- See Also:
-
OPTIONAL_BUTTONS
The optional buttons that can be additionally added to the button bar. -
OPTIONAL_BUTTONS_LIST
The optional buttons that can be additionally added to the button bar as list. -
PATTERN_EMBEDDED_GALLERY_CONFIG
Pattern used for matching embedded gallery configurations.
-
-
Constructor Details
-
CmsHtmlWidgetOption
public CmsHtmlWidgetOption()Creates a new empty HTML widget object object. -
CmsHtmlWidgetOption
Creates a new HTML widget object object, configured by the given configuration String.- Parameters:
configuration
- configuration String to parse
-
-
Method Details
-
createConfigurationString
Returns a HTML widget configuration String created from the given HTML widget option.- Parameters:
option
- the HTML widget options to create the configuration String for- Returns:
- a select widget configuration String created from the given HTML widget option object
-
parseEmbeddedGalleryOptions
Parses and removes embedded gallery configuration strings.- Parameters:
configuration
- the configuration string to parse- Returns:
- a map containing both the string resulting from removing the embedded configurations, and the embedded configurations as a a map
-
getAdditionalButtons
Returns the buttons to show additionally as list with button names.- Returns:
- the buttons to show additionally as list with button names
-
getButtonBar
Returns the specific editor button bar string generated from the configuration.The lookup map can contain translations for the button names, the separator and the block names. The button bar will be automatically surrounded by block start and end items if they are not explicitly defined.
It may be necessary to write your own method to generate the button bar string for a specific editor widget. In this case, use the method
getButtonBarShownItems()
to get the calculated list of shown button bar items.- Parameters:
buttonNamesLookUp
- the lookup map with translations for the button names, the separator and the block names ornull
itemSeparator
- the separator for the tool bar items- Returns:
- the button bar string generated from the configuration
-
getButtonBar
public String getButtonBar(Map<String, String> buttonNamesLookUp, String itemSeparator, boolean addMissingBlock) Returns the specific editor button bar string generated from the configuration.The lookup map can contain translations for the button names, the separator and the block names.
It may be necessary to write your own method to generate the button bar string for a specific editor widget. In this case, use the method
getButtonBarShownItems()
to get the calculated list of shown button bar items.- Parameters:
buttonNamesLookUp
- the lookup map with translations for the button names, the separator and the block names ornull
itemSeparator
- the separator for the tool bar itemsaddMissingBlock
- flag indicating if the button bar should be automatically surrounded by a block if not explicitly defined- Returns:
- the button bar string generated from the configuration
-
getButtonBarOption
Returns the individual button bar configuration option.- Returns:
- the individual button bar configuration option
-
getButtonBarOptionString
Returns the individual button bar configuration option string.- Returns:
- the individual button bar configuration option string
-
getButtonBarShownItems
Returns the calculated button bar items, including blocks and separators, considering the current widget configuration.Use this method to get the calculated list of button bar items if
getButtonBar(Map, String)
can not be used for a specific editor widget.- Returns:
- the calculated button bar items
-
getConfiguration
Returns the original configuration String that was used to initialize the HTML widget options.- Returns:
- the original configuration String
-
getCssPath
Returns the CSS style sheet VFS path to use in the widget area.- Returns:
- the CSS style sheet VFS path to use in the widget area
-
getEditorConfigPath
Gets the path of a JSON file containing options to be passed directly into TinyMCE.- Returns:
- the path of a JSON with direct TinyMCE options
-
getEditorHeight
Returns the widget editor height.- Returns:
- the widget editor height
-
getEmbeddedConfigurations
Gets the embedded gallery configurations.- Returns:
- the embedded gallery configurations
-
getFormatSelectOptions
Returns the options for the format select box as String.- Returns:
- the options for the format select box as String
-
getHiddenButtons
Returns the buttons to hide as list with button names.- Returns:
- the buttons to hide as list with button names
-
getLinkDefaultProtocol
Returns the link default protocol to use when inserting/editing links via the link dialog.- Returns:
- the link default protocol to use when inserting/editing links via the link dialog
-
getStylesFormatPath
Returns the styles format VFS path to use in the widget area.- Returns:
- the styles XML format path to use in the widget area
-
getStylesXmlPath
Returns the styles XML VFS path to use in the widget area.- Returns:
- the styles XML VFS path to use in the widget area
-
init
Initializes the widget options from the given configuration String.- Parameters:
configuration
- the configuration String
-
isAllowScripts
Returns true if scripts should be allowed in the source code editor.- Returns:
- true if scripts should be allowed in the source code editor
-
isButtonAdditional
Returns if the button with the given name should be additionally shown.- Parameters:
buttonName
- the button name to check- Returns:
true
if the button with the given name should be additionally shown, otherwisefalse
-
isButtonHidden
Returns if the button with the given name should be hidden.- Parameters:
buttonName
- the button name to check- Returns:
true
if the button with the given name should be hidden, otherwisefalse
-
isButtonOptional
Returns if the button with the given name is optional.- Parameters:
buttonName
- the button name to check- Returns:
true
if the button with the given name is optional, otherwisefalse
-
isFullPage
Returns if the editor should be used in full page mode.- Returns:
- true if the editor should be used in full page mode, otherwise false
-
isImportCss
Return true if the content stylesheet's styles should be imported into the style selector.- Returns:
- true if the content stylesheet's styles should be imported into the style selector
-
setAdditionalButtons
Sets the buttons to show additionally as list with button names.- Parameters:
buttons
- the buttons to show additionally as list with button names
-
setButtonBarOption
Sets the individual button bar configuration option.- Parameters:
buttonBar
- the individual button bar configuration option
-
setButtonBarOptionString
Sets the individual button bar configuration option string.- Parameters:
buttonBar
- the individual button bar configuration option string
-
setCssPath
Sets the CSS style sheet VFS path to use in the widget area.- Parameters:
cssPath
- the CSS style sheet VFS path to use in the widget area
-
setEditorConfigPath
Sets the path for a file containing JSON options to be passed directly into TinyMCE.- Parameters:
optionJsonPath
- the path of a JSON file
-
setEditorHeight
Sets the widget editor height.- Parameters:
editorHeight
- the widget editor height
-
setFormatSelectOptions
Sets the options for the format select box as String.- Parameters:
formatSelectOptions
- the options for the format select box as String
-
setFullPage
Sets if the editor should be used in full page mode.- Parameters:
fullPage
- true if the editor should be used in full page mode, otherwise false
-
setHiddenButtons
Sets the buttons to hide as list with button names.- Parameters:
buttons
- the buttons to hide as list with button names
-
setLinkDefaultProtocol
Set the link default protocol to use when inserting/editing links via the link dialog- Parameters:
linkDefaultProtocol
- the link default protocol to use when inserting/editing links via the link dialog
-
setStylesFormatPath
Sets the styles format VFS path to use in the widget area.- Parameters:
stylesFormatPath
- the styles XML VFS path to use in the widget area
-
setStylesXmlPath
Sets the styles XML VFS path to use in the widget area.- Parameters:
stylesXmlPath
- the styles XML VFS path to use in the widget area
-
showAnchorDialog
Returns true if the anchor dialog button should be available.- Returns:
- if the anchor dialog button should be available
-
showFormatSelect
Returns true if the format selector should be available.- Returns:
- if the format selector should be available
-
showGalleryDialog
Returns true if the specified gallery type dialog button is shown.- Parameters:
galleryType
- the gallery type to check- Returns:
- true if the specified gallery type dialog button is shown, otherwise false
-
showImageDialog
Returns true if the image dialog button should be available.- Returns:
- if the image dialog button should be available
-
showLinkDialog
Returns true if the link dialog button should be available.- Returns:
- if the link dialog button should be available
-
showSourceEditor
Returns true if the source code button should be available.- Returns:
- if the source code button should be available
-
showStylesFormat
Returns true if the styles format selector should be available.- Returns:
- if the styles format selector should be available
-
showStylesXml
Returns true if the styles selector should be available.- Returns:
- if the styles selector should be available
-
showTableDialog
Returns true if the table dialog button should be available.- Returns:
- if the table dialog button should be available
-
useCss
Returns true if the widget editor should use a defined CSS style sheet.- Returns:
- if the widget editor should use a defined CSS style sheet
-
addAdditionalButton
Adds a button to the list of defined additional buttons.- Parameters:
buttonName
- the button name to add
-
getButtonName
Returns the real button name matched with the look up map.If no value is found in the look up map, the button name is returned unchanged.
- Parameters:
barItem
- the button bar item name to look upbuttonNamesLookUp
- the look up map containing the button names and/or separator name to use- Returns:
- the translated button name
-
parseOptions
Parses the given configuration String.- Parameters:
configuration
- the configuration String to parse
-