public class CmsHtmlWidgetOption extends java.lang.Object
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,
see BUTTONBAR_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 or downloadgallery
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
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUTTONBAR_BLOCK_END
The button bar end block indicator.
|
static java.lang.String |
BUTTONBAR_BLOCK_START
The button bar start block indicator.
|
static java.lang.String |
BUTTONBAR_DEFAULT
The default editor widget button bar configuration.
|
static java.util.List<java.lang.String> |
BUTTONBAR_DEFAULT_LIST
The default button bar configuration as List.
|
static java.lang.String |
BUTTONBAR_SEPARATOR
The button bar separator.
|
static java.lang.String |
DELIMITER_OPTION
The delimiter to use in the configuration String.
|
static char |
DELIMITER_VALUE
The delimiter to use for separation of option values.
|
static java.lang.String |
EDITOR_DEFAULTHEIGHT
The editor widget default height to use.
|
static java.lang.String |
OPTION_ABBR
Option for the "abbreviation" button.
|
static java.lang.String |
OPTION_ABSOLUTE
Option for the "absolute" button.
|
static java.lang.String |
OPTION_ACRONYM
Option for the "acronym" button.
|
static java.lang.String |
OPTION_ADVHR
Option for the "advanced hr" button.
|
static java.lang.String |
OPTION_ANCHOR
Option for the "anchor" dialog.
|
static java.lang.String |
OPTION_ATTRIBS
Option for the "insert/edit attributes" button.
|
static java.lang.String |
OPTION_BACKCOLOR
Option for the "background color" button.
|
static java.lang.String |
OPTION_BLOCKQUOTE
Option for the "block quote" button.
|
static java.lang.String |
OPTION_BUTTONBAR
Option for the "buttonbar" configuration.
|
static java.lang.String |
OPTION_CITE
Option for the "citation" button.
|
static java.lang.String |
OPTION_CLEANUP
Option for the "clean up messy code" button.
|
static java.lang.String |
OPTION_CSS
Option for the css style sheet VFS path to use in the widget area.
|
static java.lang.String |
OPTION_DEL
Option for the "mark text as deletion" button.
|
static java.lang.String |
OPTION_EDITORLINK
Option for the "editor link" dialog (editor specific).
|
static java.lang.String |
OPTION_EMOTIONS
Option for the "emotions" button.
|
static java.lang.String |
OPTION_FIND
Option for the "find" dialog.
|
static java.lang.String |
OPTION_FONTSELECT
Option for the "font select" button.
|
static java.lang.String |
OPTION_FONTSIZESELECT
Option for the "font size" button.
|
static java.lang.String |
OPTION_FORECOLOR
Option for the "text color" button.
|
static java.lang.String |
OPTION_FORMATSELECT
Option for the "formatselect" selector.
|
static java.lang.String |
OPTION_FORMATSELECT_OPTIONS
Option for the "formatselect" options selector.
|
static java.lang.String |
OPTION_FULLPAGE
Option for the "fullpage" editor variant.
|
static java.lang.String |
OPTION_HEIGHT
Option for the "height" configuration.
|
static java.lang.String |
OPTION_HIDEBUTTONS
Option for the "hidebuttons" configuration.
|
static java.lang.String |
OPTION_HR
Option for the "hr" button.
|
static java.lang.String |
OPTION_IMAGE
Option for the "image" dialog.
|
static java.lang.String |
OPTION_IMPORTCSS
Option to import styles from stylesheet into the style selector.
|
static java.lang.String |
OPTION_INS
Option for the "mark text as insertion" button.
|
static java.lang.String |
OPTION_INSERTDATE
Option for the "insert date" button.
|
static java.lang.String |
OPTION_INSERTLAYER
Option for the "insert layer" button.
|
static java.lang.String |
OPTION_INSERTTIME
Option for the "insert time" button.
|
static java.lang.String |
OPTION_LINK
Option for the "link" dialog.
|
static java.lang.String |
OPTION_LTR
Option for the "left to right text" button.
|
static java.lang.String |
OPTION_MEDIA
Option for the "insert media (flash, video, audio)" button.
|
static java.lang.String |
OPTION_MOVEBACKWARD
Option for the "move backward (layer context)" button.
|
static java.lang.String |
OPTION_MOVEFORWARD
Option for the "move forward (layer context)" button.
|
static java.lang.String |
OPTION_NEWDOCUMENT
Option for the "new document (remove existing content)" button.
|
static java.lang.String |
OPTION_NONBREAKING
Option for the "non breaking white space" button.
|
static java.lang.String |
OPTION_PAGEBREAK
Option for the "page break" button.
|
static java.lang.String |
OPTION_PASTEWORD
Option for the "paste from word" button.
|
static java.lang.String |
OPTION_REPLACE
Option for the "replace" dialog.
|
static java.lang.String |
OPTION_RTL
Option for the "right to left text" button.
|
static java.lang.String |
OPTION_SOURCE
Option for the "source" code mode.
|
static java.lang.String |
OPTION_SPELLCHECK
Option for the "spell check" dialog.
|
static java.lang.String |
OPTION_STYLE
Option for the style select box.
|
static java.lang.String |
OPTION_STYLEPROPS
Option for the "edit CSS style" button.
|
static java.lang.String |
OPTION_STYLES
Option for the styles XML VFS path to use in the widget area.
|
static java.lang.String |
OPTION_STYLES_FORMAT
Option for the styles format VFS path to use in the widget area.
|
static java.lang.String |
OPTION_TABLE
Option for the "table" dialog.
|
static java.lang.String |
OPTION_TEMPLATE
Option for the "insert predefined template content" button.
|
static java.lang.String |
OPTION_UNLINK
Option for the "unlink" button.
|
static java.lang.String |
OPTION_VISUALAID
Option for the "show/hide guidelines/invisible elements" button.
|
static java.lang.String |
OPTION_VISUALCHARS
Option for the "show/hide visual control characters" button.
|
static java.lang.String[] |
OPTIONAL_BUTTONS
The optional buttons that can be additionally added to the button bar.
|
static java.util.List<java.lang.String> |
OPTIONAL_BUTTONS_LIST
The optional buttons that can be additionally added to the button bar as list.
|
static java.util.regex.Pattern |
PATTERN_EMBEDDED_GALLERY_CONFIG
Pattern used for matching embedded gallery configurations.
|
Constructor and Description |
---|
CmsHtmlWidgetOption()
Creates a new empty HTML widget object object.
|
CmsHtmlWidgetOption(java.lang.String configuration)
Creates a new HTML widget object object, configured by the given configuration String.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAdditionalButton(java.lang.String buttonName)
Adds a button to the list of defined additional buttons.
|
static java.lang.String |
createConfigurationString(CmsHtmlWidgetOption option)
Returns a HTML widget configuration String created from the given HTML widget option.
|
java.util.List<java.lang.String> |
getAdditionalButtons()
Returns the buttons to show additionally as list with button names.
|
java.lang.String |
getButtonBar(java.util.Map<java.lang.String,java.lang.String> buttonNamesLookUp,
java.lang.String itemSeparator)
Returns the specific editor button bar string generated from the configuration.
|
java.lang.String |
getButtonBar(java.util.Map<java.lang.String,java.lang.String> buttonNamesLookUp,
java.lang.String itemSeparator,
boolean addMissingBlock)
Returns the specific editor button bar string generated from the configuration.
|
java.util.List<java.lang.String> |
getButtonBarOption()
Returns the individual button bar configuration option.
|
java.lang.String |
getButtonBarOptionString()
Returns the individual button bar configuration option string.
|
java.util.List<java.lang.String> |
getButtonBarShownItems()
Returns the calculated button bar items, including blocks and separators, considering the current widget configuration.
|
protected java.lang.String |
getButtonName(java.lang.String barItem,
java.util.Map<java.lang.String,java.lang.String> buttonNamesLookUp)
Returns the real button name matched with the look up map.
|
java.lang.String |
getConfiguration()
Returns the original configuration String that was used to initialize the HTML widget options.
|
java.lang.String |
getCssPath()
Returns the CSS style sheet VFS path to use in the widget area.
|
java.lang.String |
getEditorHeight()
Returns the widget editor height.
|
java.util.Map<java.lang.String,java.lang.String> |
getEmbeddedConfigurations()
Gets the embedded gallery configurations.
|
java.lang.String |
getFormatSelectOptions()
Returns the options for the format select box as String.
|
java.util.List<java.lang.String> |
getHiddenButtons()
Returns the buttons to hide as list with button names.
|
java.lang.String |
getStylesFormatPath()
Returns the styles format VFS path to use in the widget area.
|
java.lang.String |
getStylesXmlPath()
Returns the styles XML VFS path to use in the widget area.
|
void |
init(java.lang.String configuration)
Initializes the widget options from the given configuration String.
|
boolean |
isButtonAdditional(java.lang.String buttonName)
Returns if the button with the given name should be additionally shown.
|
boolean |
isButtonHidden(java.lang.String buttonName)
Returns if the button with the given name should be hidden.
|
boolean |
isButtonOptional(java.lang.String buttonName)
Returns if the button with the given name is optional.
|
boolean |
isFullPage()
Returns if the editor should be used in full page mode.
|
boolean |
isImportCss()
Return true if the content stylesheet's styles should be imported into the style selector.
|
static CmsPair<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> |
parseEmbeddedGalleryOptions(java.lang.String configuration)
Parses and removes embedded gallery configuration strings.
|
protected void |
parseOptions(java.lang.String configuration)
Parses the given configuration String.
|
void |
setAdditionalButtons(java.util.List<java.lang.String> buttons)
Sets the buttons to show additionally as list with button names.
|
void |
setButtonBarOption(java.util.List<java.lang.String> buttonBar)
Sets the individual button bar configuration option.
|
void |
setButtonBarOptionString(java.lang.String buttonBar)
Sets the individual button bar configuration option string.
|
void |
setCssPath(java.lang.String cssPath)
Sets the CSS style sheet VFS path to use in the widget area.
|
void |
setEditorHeight(java.lang.String editorHeight)
Sets the widget editor height.
|
void |
setFormatSelectOptions(java.lang.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(java.util.List<java.lang.String> buttons)
Sets the buttons to hide as list with button names.
|
void |
setStylesFormatPath(java.lang.String stylesFormatPath)
Sets the styles format VFS path to use in the widget area.
|
void |
setStylesXmlPath(java.lang.String stylesXmlPath)
Sets the styles XML VFS path to use in the widget area.
|
boolean |
showAnchorDialog()
Returns true if the anchor dialog button should be available.
|
boolean |
showFormatSelect()
Returns true if the format selector should be available.
|
boolean |
showGalleryDialog(java.lang.String galleryType)
Returns true if the specified gallery type dialog button is shown.
|
boolean |
showImageDialog()
Returns true if the image dialog button should be available.
|
boolean |
showLinkDialog()
Returns true if the link dialog button should be available.
|
boolean |
showSourceEditor()
Returns true if the source code button should be available.
|
boolean |
showStylesFormat()
Returns true if the styles format selector should be available.
|
boolean |
showStylesXml()
Returns true if the styles selector should be available.
|
boolean |
showTableDialog()
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.
|
public static final java.lang.String BUTTONBAR_BLOCK_END
public static final java.lang.String BUTTONBAR_BLOCK_START
public static final java.lang.String BUTTONBAR_DEFAULT
public static final java.util.List<java.lang.String> BUTTONBAR_DEFAULT_LIST
public static final java.lang.String BUTTONBAR_SEPARATOR
public static final java.lang.String DELIMITER_OPTION
public static final char DELIMITER_VALUE
public static final java.lang.String EDITOR_DEFAULTHEIGHT
public static final java.lang.String OPTION_ABBR
public static final java.lang.String OPTION_ABSOLUTE
public static final java.lang.String OPTION_ACRONYM
public static final java.lang.String OPTION_ADVHR
public static final java.lang.String OPTION_ANCHOR
public static final java.lang.String OPTION_ATTRIBS
public static final java.lang.String OPTION_BACKCOLOR
public static final java.lang.String OPTION_BLOCKQUOTE
public static final java.lang.String OPTION_BUTTONBAR
public static final java.lang.String OPTION_CITE
public static final java.lang.String OPTION_CLEANUP
public static final java.lang.String OPTION_CSS
public static final java.lang.String OPTION_DEL
public static final java.lang.String OPTION_EDITORLINK
public static final java.lang.String OPTION_EMOTIONS
public static final java.lang.String OPTION_FIND
public static final java.lang.String OPTION_FONTSELECT
public static final java.lang.String OPTION_FONTSIZESELECT
public static final java.lang.String OPTION_FORECOLOR
public static final java.lang.String OPTION_FORMATSELECT
public static final java.lang.String OPTION_FORMATSELECT_OPTIONS
public static final java.lang.String OPTION_FULLPAGE
public static final java.lang.String OPTION_HEIGHT
public static final java.lang.String OPTION_HIDEBUTTONS
public static final java.lang.String OPTION_HR
public static final java.lang.String OPTION_IMAGE
public static final java.lang.String OPTION_IMPORTCSS
public static final java.lang.String OPTION_INS
public static final java.lang.String OPTION_INSERTDATE
public static final java.lang.String OPTION_INSERTLAYER
public static final java.lang.String OPTION_INSERTTIME
public static final java.lang.String OPTION_LINK
public static final java.lang.String OPTION_LTR
public static final java.lang.String OPTION_MEDIA
public static final java.lang.String OPTION_MOVEBACKWARD
public static final java.lang.String OPTION_MOVEFORWARD
public static final java.lang.String OPTION_NEWDOCUMENT
public static final java.lang.String OPTION_NONBREAKING
public static final java.lang.String OPTION_PAGEBREAK
public static final java.lang.String OPTION_PASTEWORD
public static final java.lang.String OPTION_REPLACE
public static final java.lang.String OPTION_RTL
public static final java.lang.String OPTION_SOURCE
public static final java.lang.String OPTION_SPELLCHECK
public static final java.lang.String OPTION_STYLE
public static final java.lang.String OPTION_STYLEPROPS
public static final java.lang.String OPTION_STYLES
public static final java.lang.String OPTION_STYLES_FORMAT
public static final java.lang.String OPTION_TABLE
public static final java.lang.String OPTION_TEMPLATE
public static final java.lang.String OPTION_UNLINK
public static final java.lang.String OPTION_VISUALAID
public static final java.lang.String OPTION_VISUALCHARS
public static final java.lang.String[] OPTIONAL_BUTTONS
public static final java.util.List<java.lang.String> OPTIONAL_BUTTONS_LIST
public static final java.util.regex.Pattern PATTERN_EMBEDDED_GALLERY_CONFIG
public CmsHtmlWidgetOption()
public CmsHtmlWidgetOption(java.lang.String configuration)
configuration
- configuration String to parsepublic static java.lang.String createConfigurationString(CmsHtmlWidgetOption option)
option
- the HTML widget options to create the configuration String forpublic static CmsPair<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> parseEmbeddedGalleryOptions(java.lang.String configuration)
configuration
- the configuration string to parsepublic java.util.List<java.lang.String> getAdditionalButtons()
public java.lang.String getButtonBar(java.util.Map<java.lang.String,java.lang.String> buttonNamesLookUp, java.lang.String itemSeparator)
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.
buttonNamesLookUp
- the lookup map with translations for the button names, the separator and the block names or null
itemSeparator
- the separator for the tool bar itemspublic java.lang.String getButtonBar(java.util.Map<java.lang.String,java.lang.String> buttonNamesLookUp, java.lang.String itemSeparator, boolean addMissingBlock)
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.
buttonNamesLookUp
- the lookup map with translations for the button names, the separator and the block names or null
itemSeparator
- the separator for the tool bar itemsaddMissingBlock
- flag indicating if the button bar should be automatically surrounded by a block if not explicitly definedpublic java.util.List<java.lang.String> getButtonBarOption()
public java.lang.String getButtonBarOptionString()
public java.util.List<java.lang.String> getButtonBarShownItems()
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.
public java.lang.String getConfiguration()
public java.lang.String getCssPath()
public java.lang.String getEditorHeight()
public java.util.Map<java.lang.String,java.lang.String> getEmbeddedConfigurations()
public java.lang.String getFormatSelectOptions()
public java.util.List<java.lang.String> getHiddenButtons()
public java.lang.String getStylesFormatPath()
public java.lang.String getStylesXmlPath()
public void init(java.lang.String configuration)
configuration
- the configuration Stringpublic boolean isButtonAdditional(java.lang.String buttonName)
buttonName
- the button name to checktrue
if the button with the given name should be additionally shown, otherwise false
public boolean isButtonHidden(java.lang.String buttonName)
buttonName
- the button name to checktrue
if the button with the given name should be hidden, otherwise false
public boolean isButtonOptional(java.lang.String buttonName)
buttonName
- the button name to checktrue
if the button with the given name is optional, otherwise false
public boolean isFullPage()
public boolean isImportCss()
public void setAdditionalButtons(java.util.List<java.lang.String> buttons)
buttons
- the buttons to show additionally as list with button namespublic void setButtonBarOption(java.util.List<java.lang.String> buttonBar)
buttonBar
- the individual button bar configuration optionpublic void setButtonBarOptionString(java.lang.String buttonBar)
buttonBar
- the individual button bar configuration option stringpublic void setCssPath(java.lang.String cssPath)
cssPath
- the CSS style sheet VFS path to use in the widget areapublic void setEditorHeight(java.lang.String editorHeight)
editorHeight
- the widget editor heightpublic void setFormatSelectOptions(java.lang.String formatSelectOptions)
formatSelectOptions
- the options for the format select box as Stringpublic void setFullPage(boolean fullPage)
fullPage
- true if the editor should be used in full page mode, otherwise falsepublic void setHiddenButtons(java.util.List<java.lang.String> buttons)
buttons
- the buttons to hide as list with button namespublic void setStylesFormatPath(java.lang.String stylesFormatPath)
stylesFormatPath
- the styles XML VFS path to use in the widget areapublic void setStylesXmlPath(java.lang.String stylesXmlPath)
stylesXmlPath
- the styles XML VFS path to use in the widget areapublic boolean showAnchorDialog()
public boolean showFormatSelect()
public boolean showGalleryDialog(java.lang.String galleryType)
galleryType
- the gallery type to checkpublic boolean showImageDialog()
public boolean showLinkDialog()
public boolean showSourceEditor()
public boolean showStylesFormat()
public boolean showStylesXml()
public boolean showTableDialog()
public boolean useCss()
protected void addAdditionalButton(java.lang.String buttonName)
buttonName
- the button name to addprotected java.lang.String getButtonName(java.lang.String barItem, java.util.Map<java.lang.String,java.lang.String> buttonNamesLookUp)
If no value is found in the look up map, the button name is returned unchanged.
barItem
- the button bar item name to look upbuttonNamesLookUp
- the look up map containing the button names and/or separator name to useprotected void parseOptions(java.lang.String configuration)
configuration
- the configuration String to parse