# Class RichTextEditorConfiguration

java.lang.Object
org.eclipse.nebula.widgets.richtext.RichTextEditorConfiguration

public class RichTextEditorConfiguration extends Object
Configuration class that is used for general configurations of the CKEditor instance.

Since:
  3.2

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`DEFAULT_LANGUAGE`
Key for the default language configuration.
`static final String`
`LANGUAGE`
Key for the language configuration.
`static final String`
`REMOVE_BUTTONS`
Key for toolbar buttons that should not be rendered.
`static final String`
`TOOLBAR_CAN_COLLAPSE`
Key to configure whether the toolbar can be collapsed by the user.
`static final String`
`TOOLBAR_GROUPS`
Key for toolbar groups configuration.
`static final String`
`TOOLBAR_STARTUP_EXPANDED`
Key to configure whether the toolbar must start expanded when the editor is loaded.

## Constructor Summary

Constructors
Constructor
Description
`RichTextEditorConfiguration()`
Creates a new instance for general configurations that are added to the created CKEditor instance at initialization.

## Method Summary

Modifier and Type
Method
Description
`void`
`addDefaultToolbarButton(String... buttonNames)`
Adds the CKEditor default button for the given name to the toolbar.
`Map<String,Object>`
`getAllOptions()`
`Object`
`getOption(String key)`
Returns a configuration option set in this `RichTextEditorConfiguration`.
`void`
`removeDefaultToolbarButton(String... buttonNames)`
Removes the CKEditor default button for the given name from the toolbar.
`void`
`setDefaultLanguage(String lang)`
`void`
`setDefaultLanguage(Locale locale)`
`void`
`setLanguage(String lang)`
`void`
`setLanguage(Locale locale)`
`void`
`setOption(String key, 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`
`setToolbarCollapsible(boolean toolbarCollapsible)`
Configure if the toolbar should be collapsible.
`void`
`setToolbarInitialExpanded(boolean toolbarInitialExpanded)`
Configure if the toolbar should be initially expanded.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_LANGUAGE

public static final String DEFAULT_LANGUAGE
Key for the default language configuration.

See Also:
  - Constant Field Values

### LANGUAGE

public static final String LANGUAGE
Key for the language configuration.

See Also:
  - Constant Field Values

### TOOLBAR_GROUPS

public static final String TOOLBAR_GROUPS
Key for toolbar groups configuration.

See Also:
  - Constant Field Values

### REMOVE_BUTTONS

public static final String REMOVE_BUTTONS
Key for toolbar buttons that should not be rendered.

See Also:
  - Constant Field Values

### TOOLBAR_CAN_COLLAPSE

public static final String TOOLBAR_CAN_COLLAPSE
Key to configure whether the toolbar can be collapsed by the user.

See Also:
  - Constant Field Values

### TOOLBAR_STARTUP_EXPANDED

public static final String TOOLBAR_STARTUP_EXPANDED
Key to configure whether the toolbar must start expanded when the editor is loaded.

See Also:
  - Constant Field Values

## Constructor Details

### RichTextEditorConfiguration

public RichTextEditorConfiguration()
Creates a new instance for general configurations that are added to the created CKEditor instance at initialization.

## Method Details

### setOption

public void setOption(String key, Object value)
Adds a new option to the configuration.

Parameters:
  `key` - The configuration option key.
  `value` - The configuration option value.
See Also:
  - CKEDITOR.config

### getOption

public Object getOption(String key)
Returns a configuration option set in this `RichTextEditorConfiguration`.

Parameters:
  `key` - The configuration option key for which the value is requested.
Returns:
  The configuration option value for the given key or `null` in case there is nothing configured for that key.

### getAllOptions

public Map<String,Object> getAllOptions()

Returns:
  An unmodifiable map that contains all configuration option values.

### setLanguage

public void setLanguage(String lang)

Parameters:
  `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.

### setLanguage

public void setLanguage(Locale locale)

Parameters:
  `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.

### setDefaultLanguage

public void setDefaultLanguage(String lang)

Parameters:
  `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.

### setDefaultLanguage

public void setDefaultLanguage(Locale locale)

Parameters:
  `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.

### setRemovePasteText

public void setRemovePasteText(boolean removePasteText)

Parameters:
  `removePasteText` - `true` to remove the paste text button from the toolbar.

### setRemovePasteFromWord

public void setRemovePasteFromWord(boolean removePasteFromWord)

Parameters:
  `removePasteFromWord` - `true` to remove the paste from word button from the toolbar.

### setRemoveStyles

public void setRemoveStyles(boolean removeStyles)

Parameters:
  `removeStyles` - `true` to remove the styles combo box from the toolbar.

### setRemoveFormat

public void setRemoveFormat(boolean removeFormat)

Parameters:
  `removeFormat` - `true` to remove format combo box from the toolbar.

### addDefaultToolbarButton

public void addDefaultToolbarButton(String... buttonNames)
Adds the CKEditor default button for the given name to the toolbar.

Note: This works only for buttons that have been removed using `removeDefaultToolbarButton(String[])`

Parameters:
  `buttonNames` - The names of the CKEditor default button to add.

### removeDefaultToolbarButton

public void removeDefaultToolbarButton(String... buttonNames)
Removes the CKEditor default button for the given name from the toolbar.

Parameters:
  `buttonNames` - The names of the CKEditor default button to remove.

### setToolbarCollapsible

public void setToolbarCollapsible(boolean toolbarCollapsible)
Configure if the toolbar should be collapsible. Default is `false`.

Parameters:
  `toolbarCollapsible` - `true` if the toolbar should be collapsible, `false` if not.

### setToolbarInitialExpanded

public void setToolbarInitialExpanded(boolean toolbarInitialExpanded)
Configure if the toolbar should be initially expanded. Default is `true`.

Parameters:
  `toolbarInitialExpanded` - `true` if the toolbar should be initially expanded, `false` if not.