public class RichTextEditorConfiguration
extends java.lang.Object
Note: This configuration class replaces the ToolbarConfiguration
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_LANGUAGE
Key for the default language configuration.
|
static java.lang.String |
LANGUAGE
Key for the language configuration.
|
static java.lang.String |
REMOVE_BUTTONS
Key for toolbar buttons that should not be rendered.
|
static java.lang.String |
REMOVE_PLUGINS
Key to configure a list of plugins that must not be loaded.
|
static java.lang.String |
RESIZE_DIR
Key to configure the dimensions for which the editor resizing is enabled.
|
static java.lang.String |
RESIZE_ENABLED
Key to configure whether to enable the resizing feature.
|
static java.lang.String |
RESIZE_MINHEIGHT
Key to configure the minimum editor height, in pixels, when resizing the editor interface by
using the resize handle..
|
static java.lang.String |
RESIZE_MINWIDTH
Key to configure the minimum editor width, in pixels, when resizing the editor interface by
using the resize handle..
|
static java.util.Collection<java.lang.String> |
SUPPORTED_LANGUAGES
Collection of languages that are supported by CKEditor.
|
static java.lang.String |
TOOLBAR_CAN_COLLAPSE
Key to configure whether the toolbar can be collapsed by the user.
|
static java.lang.String |
TOOLBAR_GROUPS
Key for toolbar groups configuration.
|
static java.lang.String |
TOOLBAR_STARTUP_EXPANDED
Key to configure whether the toolbar must start expanded when the editor is loaded.
|
Constructor and Description |
---|
RichTextEditorConfiguration()
Creates a new instance for general configurations that are added to the created CKEditor
instance at initialization.
|
RichTextEditorConfiguration(ToolbarConfiguration config)
Deprecated.
Use the no-arg constructor instead and set the values directly to the created
RichTextEditorConfiguration |
Modifier and Type | Method and Description |
---|---|
void |
addDefaultToolbarButton(java.lang.String... buttonNames)
Adds the CKEditor default button for the given name to the toolbar.
|
void |
addToolbarButton(ToolbarButton button)
Adds a custom button to the CKEditor toolbar.
|
void |
addToolbarButton(ToolbarButton button,
org.eclipse.swt.browser.BrowserFunction function)
Adds a custom button to the CKEditor toolbar.
|
void |
customizeToolbar()
Adds custom buttons to the toolbar of the CKEditor based on the configurations applied in
this
RichTextEditorConfiguration . |
void |
dispose()
Dispose the registered
BrowserFunction s. |
java.util.Map<java.lang.String,java.lang.Object> |
getAllOptions() |
org.eclipse.swt.browser.Browser |
getBrowser() |
protected java.lang.String |
getCustomButtonConfiguration() |
java.lang.Object |
getOption(java.lang.String key)
Returns a configuration option set in this
RichTextEditorConfiguration . |
void |
removeDefaultToolbarButton(java.lang.String... buttonNames)
Removes the CKEditor default button for the given name from the toolbar.
|
void |
removeToolbarButton(ToolbarButton button)
Removes the given
ToolbarButton from the local list of custom
toolbar buttons. |
void |
setBrowser(org.eclipse.swt.browser.Browser browser) |
void |
setDefaultLanguage(java.util.Locale locale) |
void |
setDefaultLanguage(java.lang.String lang) |
void |
setLanguage(java.util.Locale locale) |
void |
setLanguage(java.lang.String lang) |
void |
setMinSize(int minWidth,
int minHeight)
The minimum editor size, in pixels, when resizing the editor interface by using the resize
handle.
|
void |
setOption(java.lang.String key,
java.lang.Object value)
Adds a new option to the configuration.
|
void |
setRemoveFormat(boolean removeFormat) |
void |
setRemovePasteFromWord(boolean removePasteFromWord) |
void |
setRemovePasteText(boolean removePasteText) |
void |
setRemoveStyles(boolean removeStyles) |
void |
setResizable(boolean resizable)
Whether to enable the resizing feature.
|
void |
setResizeDirection(java.lang.String direction) |
void |
setToolbarCollapsible(boolean toolbarCollapsible)
Configure if the toolbar should be collapsible.
|
void |
setToolbarInitialExpanded(boolean toolbarInitialExpanded)
Configure if the toolbar should be initially expanded.
|
public static final java.lang.String DEFAULT_LANGUAGE
public static final java.lang.String LANGUAGE
public static final java.lang.String TOOLBAR_GROUPS
public static final java.lang.String REMOVE_BUTTONS
public static final java.lang.String TOOLBAR_CAN_COLLAPSE
public static final java.lang.String TOOLBAR_STARTUP_EXPANDED
public static final java.lang.String REMOVE_PLUGINS
public static final java.lang.String RESIZE_ENABLED
public static final java.lang.String RESIZE_DIR
public static final java.lang.String RESIZE_MINWIDTH
public static final java.lang.String RESIZE_MINHEIGHT
public static final java.util.Collection<java.lang.String> SUPPORTED_LANGUAGES
public RichTextEditorConfiguration()
@Deprecated public RichTextEditorConfiguration(ToolbarConfiguration config)
RichTextEditorConfiguration
RichTextEditorConfiguration
that is initialized with the configuration
values out of the given
ToolbarConfiguration
. This constructor is
used for backwards compatibility only in case adopters use the old ToolbarConfiguration.
Therefore it is deprecated from the beginning.config
- The ToolbarConfiguration
that
should be used to initialized the RichTextEditorConfiguration
.public void setOption(java.lang.String key, java.lang.Object value)
key
- The configuration option key.value
- The configuration option value.public java.lang.Object getOption(java.lang.String key)
RichTextEditorConfiguration
.key
- The configuration option key for which the value is requested.null
in case there
is nothing configured for that key.public java.util.Map<java.lang.String,java.lang.Object> getAllOptions()
public void setLanguage(java.lang.String lang)
lang
- The user interface language localization to use. If left empty, the editor will
automatically be localized to the user language. If the user language is not
supported, the language specified in the defaultLanguage configuration
setting is used.public void setLanguage(java.util.Locale locale)
locale
- The user interface language localization to use. If left empty, the editor will
automatically be localized to the user language. If the user language is not
supported, the language specified in the defaultLanguage configuration
setting is used.public void setDefaultLanguage(java.lang.String lang)
lang
- The language to be used if the language setting is left empty and it is not
possible to localize the editor to the user language.public void setDefaultLanguage(java.util.Locale locale)
locale
- The language to be used if the language setting is left empty and it is not
possible to localize the editor to the user language.public void setResizable(boolean resizable)
resizable
- true
to enable the resizing feature.public void setMinSize(int minWidth, int minHeight)
minWidth
- the minimum editor width, in pixelsminHeight
- the minimum editor height, in pixelspublic void setResizeDirection(java.lang.String direction)
direction
- The dimensions for which the editor resizing is enabled. Possible values are
both
, vertical
, and horizontal
.public void setToolbarCollapsible(boolean toolbarCollapsible)
false
.toolbarCollapsible
- true
if the toolbar should be collapsible, false
if not.public void setToolbarInitialExpanded(boolean toolbarInitialExpanded)
#toolbarCollapsible
is set to true
. Default is true
.toolbarInitialExpanded
- true
if the toolbar should be initially expanded, false
if not.public void setRemovePasteText(boolean removePasteText)
removePasteText
- true
to remove the paste text button from the toolbar.public void setRemovePasteFromWord(boolean removePasteFromWord)
removePasteFromWord
- true
to remove the paste from word button from the toolbar.public void setRemoveStyles(boolean removeStyles)
removeStyles
- true
to remove the styles combo box from the toolbar.public void setRemoveFormat(boolean removeFormat)
removeFormat
- true
to remove format combo box from the toolbar.public void addDefaultToolbarButton(java.lang.String... buttonNames)
Note: This works only for buttons that have been removed using
removeDefaultToolbarButton(String[])
buttonNames
- The names of the CKEditor default button to add.public void removeDefaultToolbarButton(java.lang.String... buttonNames)
buttonNames
- The names of the CKEditor default button to remove.protected java.lang.String getCustomButtonConfiguration()
public void addToolbarButton(ToolbarButton button)
BrowserFunction
that executes
ToolbarButton.execute()
via callback on pressing the button.button
- The button to add.public void addToolbarButton(ToolbarButton button, org.eclipse.swt.browser.BrowserFunction function)
BrowserFunction
via callback on pressing the button.button
- The button to add.function
- The BrowserFunction
that should be called on pressing
the button.public void removeToolbarButton(ToolbarButton button)
ToolbarButton
from the local list of custom
toolbar buttons.button
- The ToolbarButton
to remove.public void customizeToolbar()
RichTextEditorConfiguration
.public org.eclipse.swt.browser.Browser getBrowser()
Browser
instance to which this
RichTextEditorConfiguration
is connected to.public void setBrowser(org.eclipse.swt.browser.Browser browser)
browser
- The Browser
instance to which this
RichTextEditorConfiguration
should be connected to.public void dispose()
BrowserFunction
s.