Class CmsTinyMCEWidget
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.ComplexPanel
com.google.gwt.user.client.ui.FlowPanel
org.opencms.gwt.client.ui.input.tinymce.CmsTinyMCEWidget
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers
,com.google.gwt.event.logical.shared.HasResizeHandlers
,com.google.gwt.event.logical.shared.HasValueChangeHandlers<String>
,com.google.gwt.event.shared.HasHandlers
,com.google.gwt.user.client.EventListener
,com.google.gwt.user.client.ui.HasVisibility
,com.google.gwt.user.client.ui.HasWidgets
,com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
,com.google.gwt.user.client.ui.IndexedPanel
,com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
,com.google.gwt.user.client.ui.InsertPanel
,com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
,com.google.gwt.user.client.ui.IsWidget
,Iterable<com.google.gwt.user.client.ui.Widget>
,I_CmsHasInit
,I_CmsFormWidget
public final class CmsTinyMCEWidget
extends com.google.gwt.user.client.ui.FlowPanel
implements I_CmsFormWidget, com.google.gwt.event.logical.shared.HasResizeHandlers, I_CmsHasInit, com.google.gwt.event.logical.shared.HasValueChangeHandlers<String>
This class is used to start TinyMCE for editing the content of an element.
After constructing the instance, the actual editor is opened using the init() method, and destroyed with the close() method. While the editor is opened, the edited contents can be accessed using the methods of the HasValue interface.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
Nested classes/interfaces inherited from interface org.opencms.gwt.client.ui.input.I_CmsFormWidget
I_CmsFormWidget.FieldType
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.InsertPanel
com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The current content.protected com.google.gwt.core.client.JavaScriptObject
The TinyMCE editor instance.protected String
The DOM ID of the editable element.protected String
The original HTML content of the editable element.protected int
The maximal width of the widget.static final String
Use as option to disallow any HTML or formatting the content.static final String
The widget type id.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
-
Constructor Summary
ConstructorDescriptionCmsTinyMCEWidget
(Object options) Creates a new instance with the given TinyMCE options.CmsTinyMCEWidget
(String config) Creates a new instance based on configuration data from the server. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.gwt.event.shared.HandlerRegistration
addResizeHandler
(com.google.gwt.event.logical.shared.ResizeHandler handler) com.google.gwt.event.shared.HandlerRegistration
addValueChangeHandler
(com.google.gwt.event.logical.shared.ValueChangeHandler<String> handler) protected void
Checks whether the necessary Javascript libraries are available by accessing them.protected String
ensureId
(com.google.gwt.dom.client.Element element) Gives an element an id if it doesn't already have an id, and then returns the element's id.protected void
fireValueChange
(boolean force) Fires a change event.Returns the "apparent value", i.e.protected com.google.gwt.dom.client.Element
Returns the editor parent element.protected com.google.gwt.dom.client.Element
getElementById
(String id) Gets an element by its id.Returns the type of data this widget produces.Gets the selected/entered value from the widget.Gets the current value of the widget as a string.com.google.gwt.dom.client.Element
Gets the main editable element.protected com.google.gwt.dom.client.Element
Gets the toolbar element.getValue()
Gets the value.static void
Initializes this class.boolean
Returnstrue
if this widget is enabled.protected void
onDetach()
protected void
onLoad()
protected void
onUnload()
protected void
Propagates the a focus event.protected void
propagateMouseEvent
(String eventType, com.google.gwt.dom.client.Element eventSource) Propagates a native mouse event.protected void
Sets focus to the editor.protected void
Removes the editor instance.void
reset()
Resets the widget to its default state.protected void
Schedules to reset the focus to the main element.void
setAutoHideParent
(I_CmsAutoHider autoHideParent) Call this when auto hiding parents are shown.void
setEnabled
(boolean enabled) Enables or disables the widget.void
setErrorMessage
(String errorMessage) Sets the error message for this widget.void
setFormValueAsString
(String value) Sets the current value of the widget as a string.protected void
setMainElementContent
(String html) Sets the main content of the element which is inline editable.protected void
setPreviousValue
(String previousValue) Sets the previous value.void
Sets the value.Methods inherited from class com.google.gwt.user.client.ui.FlowPanel
add, clear, insert, insert
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, doAttachChildren, doDetachChildren, orphan, remove
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, remove
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndex
Methods inherited from interface com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
add
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
NO_HTML_EDIT
Use as option to disallow any HTML or formatting the content.- See Also:
-
WIDGET_TYPE
The widget type id.- See Also:
-
m_currentContent
The current content. -
m_editor
The TinyMCE editor instance. -
m_id
The DOM ID of the editable element. -
m_originalContent
The original HTML content of the editable element. -
m_width
The maximal width of the widget.
-
-
Constructor Details
-
CmsTinyMCEWidget
Creates a new instance with the given TinyMCE options. Use this constructor for form based editing.- Parameters:
options
- the tinyMCE editor options to extend the default settings
-
CmsTinyMCEWidget
Creates a new instance based on configuration data from the server.- Parameters:
config
- the configuration data
-
-
Method Details
-
initClass
Initializes this class. -
getApparentValue
Description copied from interface:I_CmsFormWidget
Returns the "apparent value", i.e. either the real value if available, or else the ghost value if available, or null otherwise.- Specified by:
getApparentValue
in interfaceI_CmsFormWidget
- Returns:
- the apparent value
- See Also:
-
getFieldType
Description copied from interface:I_CmsFormWidget
Returns the type of data this widget produces.- Specified by:
getFieldType
in interfaceI_CmsFormWidget
- Returns:
- the data type
- See Also:
-
getFormValue
Description copied from interface:I_CmsFormWidget
Gets the selected/entered value from the widget.- Specified by:
getFormValue
in interfaceI_CmsFormWidget
- Returns:
- the value
- See Also:
-
getFormValueAsString
Description copied from interface:I_CmsFormWidget
Gets the current value of the widget as a string.- Specified by:
getFormValueAsString
in interfaceI_CmsFormWidget
- Returns:
- the current value of the widget
- See Also:
-
getMainElement
Gets the main editable element.- Returns:
- the editable element
-
getValue
Gets the value.- Returns:
- the value
-
isEnabled
Description copied from interface:I_CmsFormWidget
Returnstrue
if this widget is enabled.- Specified by:
isEnabled
in interfaceI_CmsFormWidget
- Returns:
true
if this widget is enabled- See Also:
-
reset
Description copied from interface:I_CmsFormWidget
Resets the widget to its default state.- Specified by:
reset
in interfaceI_CmsFormWidget
- See Also:
-
setAutoHideParent
Description copied from interface:I_CmsFormWidget
Call this when auto hiding parents are shown.- Specified by:
setAutoHideParent
in interfaceI_CmsFormWidget
- Parameters:
autoHideParent
- the auto hide parent- See Also:
-
setEnabled
Description copied from interface:I_CmsFormWidget
Enables or disables the widget.- Specified by:
setEnabled
in interfaceI_CmsFormWidget
- Parameters:
enabled
- if true, the widget will be enabled, else disabled- See Also:
-
setErrorMessage
Description copied from interface:I_CmsFormWidget
Sets the error message for this widget.If the error message is null, no error message will be displayed.
- Specified by:
setErrorMessage
in interfaceI_CmsFormWidget
- Parameters:
errorMessage
- an error message or null- See Also:
-
setFormValueAsString
Description copied from interface:I_CmsFormWidget
Sets the current value of the widget as a string.- Specified by:
setFormValueAsString
in interfaceI_CmsFormWidget
- Parameters:
value
- the new value of the widget- See Also:
-
setValue
Sets the value.- Parameters:
value
- the valuefireEvents
- true if value change event should be fired
-
checkLibraries
Checks whether the necessary Javascript libraries are available by accessing them. -
ensureId
Gives an element an id if it doesn't already have an id, and then returns the element's id.- Parameters:
element
- the element for which we want to add the id- Returns:
- the id
-
fireValueChange
Fires a change event.- Parameters:
force
- true if the event should be fired even if the value does not differ from the previous one
-
getEditorParentElement
Returns the editor parent element.- Returns:
- the editor parent element
-
getElementById
Gets an element by its id.- Parameters:
id
- the id- Returns:
- the element with the given id
-
getToolbarElement
Gets the toolbar element.- Returns:
- the toolbar element
-
onDetach
- Overrides:
onDetach
in classcom.google.gwt.user.client.ui.Widget
- See Also:
-
Widget.onDetach()
-
onLoad
- Overrides:
onLoad
in classcom.google.gwt.user.client.ui.Widget
- See Also:
-
Widget.onLoad()
-
onUnload
- Overrides:
onUnload
in classcom.google.gwt.user.client.ui.Widget
- See Also:
-
Widget.onUnload()
-
propagateFocusEvent
Propagates the a focus event. -
propagateMouseEvent
Propagates a native mouse event.- Parameters:
eventType
- the mouse event typeeventSource
- the event source
-
refocusInlineEditor
Sets focus to the editor. Use only when in line editing. -
removeEditor
Removes the editor instance. -
scheduleRefocus
Schedules to reset the focus to the main element. -
setMainElementContent
Sets the main content of the element which is inline editable.- Parameters:
html
- the new content html
-
setPreviousValue
Sets the previous value.- Parameters:
previousValue
- the previous value to set
-