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.DebugIdImplEnabledNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidgetNested classes/interfaces inherited from interface org.opencms.gwt.client.ui.input.I_CmsFormWidget
I_CmsFormWidget.FieldTypeNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
com.google.gwt.user.client.ui.IndexedPanel.ForIsWidgetNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.InsertPanel
com.google.gwt.user.client.ui.InsertPanel.ForIsWidget -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe current content.protected com.google.gwt.core.client.JavaScriptObjectThe TinyMCE editor instance.protected StringThe DOM ID of the editable element.protected StringThe original HTML content of the editable element.protected intThe maximal width of the widget.static final StringUse as option to disallow any HTML or formatting the content.static final StringThe widget type id.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionCmsTinyMCEWidget(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.HandlerRegistrationaddResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler handler) com.google.gwt.event.shared.HandlerRegistrationaddValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<String> handler) protected voidChecks whether the necessary Javascript libraries are available by accessing them.protected StringensureId(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 voidfireValueChange(boolean force) Fires a change event.Returns the "apparent value", i.e.protected com.google.gwt.dom.client.ElementReturns the editor parent element.protected com.google.gwt.dom.client.ElementgetElementById(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.ElementGets the main editable element.protected com.google.gwt.dom.client.ElementGets the toolbar element.getValue()Gets the value.static voidInitializes this class.booleanReturnstrueif this widget is enabled.protected voidonDetach()protected voidonLoad()protected voidonUnload()protected voidPropagates the a focus event.protected voidpropagateMouseEvent(String eventType, com.google.gwt.dom.client.Element eventSource) Propagates a native mouse event.protected voidSets focus to the editor.protected voidRemoves the editor instance.voidreset()Resets the widget to its default state.protected voidSchedules to reset the focus to the main element.voidsetAutoHideParent(I_CmsAutoHider autoHideParent) Call this when auto hiding parents are shown.voidsetEnabled(boolean enabled) Enables or disables the widget.voidsetErrorMessage(String errorMessage) Sets the error message for this widget.voidsetFormValueAsString(String value) Sets the current value of the widget as a string.protected voidsetMainElementContent(String html) Sets the main content of the element which is inline editable.protected voidsetPreviousValue(String previousValue) Sets the previous value.voidSets the value.Methods inherited from class com.google.gwt.user.client.ui.FlowPanel
add, clear, insert, insertMethods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, removeMethods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, doAttachChildren, doDetachChildren, orphan, removeMethods 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, unsinkEventsMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEventMethods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, removeMethods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndexMethods inherited from interface com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
addMethods 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_CmsFormWidgetReturns the "apparent value", i.e. either the real value if available, or else the ghost value if available, or null otherwise.- Specified by:
getApparentValuein interfaceI_CmsFormWidget- Returns:
- the apparent value
- See Also:
-
getFieldType
Description copied from interface:I_CmsFormWidgetReturns the type of data this widget produces.- Specified by:
getFieldTypein interfaceI_CmsFormWidget- Returns:
- the data type
- See Also:
-
getFormValue
Description copied from interface:I_CmsFormWidgetGets the selected/entered value from the widget.- Specified by:
getFormValuein interfaceI_CmsFormWidget- Returns:
- the value
- See Also:
-
getFormValueAsString
Description copied from interface:I_CmsFormWidgetGets the current value of the widget as a string.- Specified by:
getFormValueAsStringin 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_CmsFormWidgetReturnstrueif this widget is enabled.- Specified by:
isEnabledin interfaceI_CmsFormWidget- Returns:
trueif this widget is enabled- See Also:
-
reset
Description copied from interface:I_CmsFormWidgetResets the widget to its default state.- Specified by:
resetin interfaceI_CmsFormWidget- See Also:
-
setAutoHideParent
Description copied from interface:I_CmsFormWidgetCall this when auto hiding parents are shown.- Specified by:
setAutoHideParentin interfaceI_CmsFormWidget- Parameters:
autoHideParent- the auto hide parent- See Also:
-
setEnabled
Description copied from interface:I_CmsFormWidgetEnables or disables the widget.- Specified by:
setEnabledin interfaceI_CmsFormWidget- Parameters:
enabled- if true, the widget will be enabled, else disabled- See Also:
-
setErrorMessage
Description copied from interface:I_CmsFormWidgetSets the error message for this widget.If the error message is null, no error message will be displayed.
- Specified by:
setErrorMessagein interfaceI_CmsFormWidget- Parameters:
errorMessage- an error message or null- See Also:
-
setFormValueAsString
Description copied from interface:I_CmsFormWidgetSets the current value of the widget as a string.- Specified by:
setFormValueAsStringin 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:
onDetachin classcom.google.gwt.user.client.ui.Widget- See Also:
-
onLoad
- Overrides:
onLoadin classcom.google.gwt.user.client.ui.Widget- See Also:
-
onUnload
- Overrides:
onUnloadin classcom.google.gwt.user.client.ui.Widget- See Also:
-
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
-