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.FocusWidget
org.opencms.acacia.client.widgets.A_CmsEditWidget
org.opencms.acacia.client.widgets.CmsTinyMCEWidget
- All Implemented Interfaces:
com.google.gwt.event.dom.client.HasAllDragAndDropHandlers
,com.google.gwt.event.dom.client.HasAllFocusHandlers
,com.google.gwt.event.dom.client.HasAllGestureHandlers
,com.google.gwt.event.dom.client.HasAllKeyHandlers
,com.google.gwt.event.dom.client.HasAllMouseHandlers
,com.google.gwt.event.dom.client.HasAllTouchHandlers
,com.google.gwt.event.dom.client.HasBlurHandlers
,com.google.gwt.event.dom.client.HasClickHandlers
,com.google.gwt.event.dom.client.HasDoubleClickHandlers
,com.google.gwt.event.dom.client.HasDragEndHandlers
,com.google.gwt.event.dom.client.HasDragEnterHandlers
,com.google.gwt.event.dom.client.HasDragHandlers
,com.google.gwt.event.dom.client.HasDragLeaveHandlers
,com.google.gwt.event.dom.client.HasDragOverHandlers
,com.google.gwt.event.dom.client.HasDragStartHandlers
,com.google.gwt.event.dom.client.HasDropHandlers
,com.google.gwt.event.dom.client.HasFocusHandlers
,com.google.gwt.event.dom.client.HasGestureChangeHandlers
,com.google.gwt.event.dom.client.HasGestureEndHandlers
,com.google.gwt.event.dom.client.HasGestureStartHandlers
,com.google.gwt.event.dom.client.HasKeyDownHandlers
,com.google.gwt.event.dom.client.HasKeyPressHandlers
,com.google.gwt.event.dom.client.HasKeyUpHandlers
,com.google.gwt.event.dom.client.HasMouseDownHandlers
,com.google.gwt.event.dom.client.HasMouseMoveHandlers
,com.google.gwt.event.dom.client.HasMouseOutHandlers
,com.google.gwt.event.dom.client.HasMouseOverHandlers
,com.google.gwt.event.dom.client.HasMouseUpHandlers
,com.google.gwt.event.dom.client.HasMouseWheelHandlers
,com.google.gwt.event.dom.client.HasTouchCancelHandlers
,com.google.gwt.event.dom.client.HasTouchEndHandlers
,com.google.gwt.event.dom.client.HasTouchMoveHandlers
,com.google.gwt.event.dom.client.HasTouchStartHandlers
,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.TakesValue<String>
,com.google.gwt.user.client.ui.Focusable
,com.google.gwt.user.client.ui.HasEnabled
,com.google.gwt.user.client.ui.HasFocus
,com.google.gwt.user.client.ui.HasValue<String>
,com.google.gwt.user.client.ui.HasVisibility
,com.google.gwt.user.client.ui.IsWidget
,com.google.gwt.user.client.ui.SourcesClickEvents
,com.google.gwt.user.client.ui.SourcesFocusEvents
,com.google.gwt.user.client.ui.SourcesKeyboardEvents
,com.google.gwt.user.client.ui.SourcesMouseEvents
,I_CmsEditWidget
,I_CmsHasDisplayDirection
public final class CmsTinyMCEWidget
extends A_CmsEditWidget
implements com.google.gwt.event.logical.shared.HasResizeHandlers, I_CmsHasDisplayDirection
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 org.opencms.acacia.client.widgets.I_CmsHasDisplayDirection
I_CmsHasDisplayDirection.Direction
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
A flag which indicates whether the editor is currently active.protected 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.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
-
Constructor Summary
ConstructorDescriptionCmsTinyMCEWidget
(com.google.gwt.dom.client.Element element, Object options) Creates a new instance for the given element.CmsTinyMCEWidget
(Object options) Creates a new instance with the given options. -
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.Returns the display direction.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.com.google.gwt.dom.client.Element
Gets the main editable element.protected com.google.gwt.dom.client.Element
Gets the toolbar element.getValue()
boolean
isActive()
Returns if the widget is active.protected boolean
isInline()
Returns if the widget is used in inline mode.protected void
onAttach()
protected void
onDetach()
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
Removes the editor instance.void
setActive
(boolean active) Sets the widget active/inactive.protected void
setMainElementContent
(String html) Sets the main content of the element which is inline editable.void
Sets the name of input fields.void
setTypografLocale
(String typografLocale) Sets the Typograf locale for inline editing mode.void
void
protected boolean
Checks if the main element contains the current text selection.Methods inherited from class org.opencms.acacia.client.widgets.A_CmsEditWidget
fireValueChange, getPreviousValue, onAttachWidget, owns, setPreviousValue
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
addBlurHandler, addClickHandler, addClickListener, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addFocusHandler, addFocusListener, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, getFocusImpl, getTabIndex, isEnabled, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setEnabled, setFocus, setTabIndex
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onLoad, onUnload, 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.dom.client.HasFocusHandlers
addFocusHandler
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
Methods inherited from interface org.opencms.acacia.client.widgets.I_CmsEditWidget
shouldSetDefaultWhenDisabled
Methods inherited from interface com.google.gwt.user.client.ui.IsWidget
asWidget
-
Field Details
-
NO_HTML_EDIT
Use as option to disallow any HTML or formatting the content.- See Also:
-
m_active
A flag which indicates whether the editor is currently active. -
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 for the given element. Use this constructor for in line editing.- Parameters:
element
- the DOM elementoptions
- the tinyMCE editor options to extend the default settings
-
CmsTinyMCEWidget
Creates a new instance with the given options. Use this constructor for form based editing.- Parameters:
options
- the tinyMCE editor options to extend the default settings
-
-
Method Details
-
getDisplayingDirection
Description copied from interface:I_CmsHasDisplayDirection
Returns the display direction.- Specified by:
getDisplayingDirection
in interfaceI_CmsHasDisplayDirection
- Returns:
- the display direction
- See Also:
-
getMainElement
Gets the main editable element.- Returns:
- the editable element
-
getValue
- Specified by:
getValue
in interfacecom.google.gwt.user.client.ui.HasValue<String>
- Specified by:
getValue
in interfacecom.google.gwt.user.client.TakesValue<String>
- Overrides:
getValue
in classA_CmsEditWidget
- See Also:
-
HasValue.getValue()
-
isActive
Description copied from interface:I_CmsEditWidget
Returns if the widget is active.- Specified by:
isActive
in interfaceI_CmsEditWidget
- Returns:
true
if the widget is active- See Also:
-
setActive
Description copied from interface:I_CmsEditWidget
Sets the widget active/inactive.- Specified by:
setActive
in interfaceI_CmsEditWidget
- Parameters:
active
-true
to activate the widget- See Also:
-
setName
Description copied from interface:I_CmsEditWidget
Sets the name of input fields.- Specified by:
setName
in interfaceI_CmsEditWidget
- Parameters:
name
- of the input field- See Also:
-
setTypografLocale
Sets the Typograf locale for inline editing mode. -
setValue
-
setValue
- Specified by:
setValue
in interfacecom.google.gwt.user.client.ui.HasValue<String>
- Specified by:
setValue
in interfaceI_CmsEditWidget
- See Also:
-
HasValue.setValue(java.lang.Object, boolean)
-
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
-
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
-
isInline
Returns if the widget is used in inline mode.- Returns:
true
if the widget is used in inline mode
-
onAttach
- Overrides:
onAttach
in classcom.google.gwt.user.client.ui.FocusWidget
- See Also:
-
FocusWidget.onAttach()
-
onDetach
- Overrides:
onDetach
in classcom.google.gwt.user.client.ui.Widget
- See Also:
-
Widget.onDetach()
-
propagateFocusEvent
Propagates the a focus event. -
propagateMouseEvent
Propagates a native mouse event.- Parameters:
eventType
- the mouse event typeeventSource
- the event source
-
removeEditor
Removes the editor instance. -
setMainElementContent
Sets the main content of the element which is inline editable.- Parameters:
html
- the new content html
-
shouldReceiveFocus
Checks if the main element contains the current text selection.- Returns:
true
if the main element contains the current text selection