org.xwiki.gwt.user.client.ui.rta
Class RichTextArea

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.FocusWidget
              extended by com.google.gwt.user.client.ui.RichTextArea
                  extended by org.xwiki.gwt.user.client.ui.rta.RichTextArea
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.HasLoadHandlers, 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.dom.client.LoadHandler, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasInitializeHandlers, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.safehtml.client.HasSafeHtml, com.google.gwt.user.client.EventListener, 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.HasHTML, com.google.gwt.user.client.ui.HasText, 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, com.google.gwt.user.client.Window.ClosingHandler, HasPasteHandlers, HasActionHandlers

public class RichTextArea
extends com.google.gwt.user.client.ui.RichTextArea
implements com.google.gwt.event.dom.client.HasDoubleClickHandlers, com.google.gwt.event.dom.client.HasLoadHandlers, com.google.gwt.event.dom.client.LoadHandler, HasPasteHandlers, HasActionHandlers, com.google.gwt.user.client.Window.ClosingHandler

Extends the rich text area provided by GWT to add support for advanced editing.

Version:
$Id: e173630bee520d694f3b7c8e106e926425aacf03 $

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.RichTextArea
com.google.gwt.user.client.ui.RichTextArea.BasicFormatter, com.google.gwt.user.client.ui.RichTextArea.ExtendedFormatter, com.google.gwt.user.client.ui.RichTextArea.FontSize, com.google.gwt.user.client.ui.RichTextArea.Formatter, com.google.gwt.user.client.ui.RichTextArea.Justification
 
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
 
Field Summary
static String DIRTY
           
static String INITIALIZING
          Flag indicating that the load event is currently being handled.
static String LOADED
          Flag indicating that the load event was fired.
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
RichTextArea()
          Creates a new rich text area.
RichTextArea(CommandManager cm)
          Custom constructor allowing us to inject a mock command manager.
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addActionHandler(String actionName, ActionHandler handler)
          Registers the given handler for the specified action.
 com.google.gwt.event.shared.HandlerRegistration addDoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler handler)
           
 com.google.gwt.event.shared.HandlerRegistration addLoadHandler(com.google.gwt.event.dom.client.LoadHandler handler)
           
 com.google.gwt.event.shared.HandlerRegistration addPasteHandler(PasteHandler handler)
           
 CommandManager getCommandManager()
           
 Document getDocument()
          NOTE: If the current browser doesn't support rich text editing this method returns null.
protected  com.google.gwt.user.client.ui.impl.RichTextAreaImpl getImpl()
          NOTE: We need this method because RichTextArea.impl is private.
 void onBrowserEvent(com.google.gwt.user.client.Event event)
           
protected  void onDetach()
           
 void onLoad(com.google.gwt.event.dom.client.LoadEvent event)
           
 void onWindowClosing(com.google.gwt.user.client.Window.ClosingEvent event)
           
 void setHTML(String html)
          
 void sinkEvents(int eventBitsToAdd)
           
 
Methods inherited from class com.google.gwt.user.client.ui.RichTextArea
addInitializeHandler, getBasicFormatter, getExtendedFormatter, getFormatter, getHTML, getText, isEnabled, onAttach, setEnabled, setFocus, setHTML, setText
 
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
addBlurHandler, addClickHandler, addClickListener, 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, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, 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, onLoad, onUnload, removeFromParent, setLayoutData
 
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, unsinkEvents
 
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
 

Field Detail

DIRTY

public static final String DIRTY
See Also:
setHTML(String), Constant Field Values

LOADED

public static final String LOADED
Flag indicating that the load event was fired. Ensures the rich text area is initialized only once.

See Also:
onLoad(LoadEvent), Constant Field Values

INITIALIZING

public static final String INITIALIZING
Flag indicating that the load event is currently being handled. Ensures the rich text area is initialized only when the load event is fired.

See Also:
onLoad(LoadEvent), Constant Field Values
Constructor Detail

RichTextArea

public RichTextArea()
Creates a new rich text area.


RichTextArea

public RichTextArea(CommandManager cm)
Custom constructor allowing us to inject a mock command manager. It was mainly added to be used in unit tests.

Parameters:
cm - custom command manager
Method Detail

getDocument

public Document getDocument()
NOTE: If the current browser doesn't support rich text editing this method returns null. You should test the returned value and fail save to an appropriate behavior!
The appropriate test would be:
 if (rta.isAttached() && rta.getDocument() == null) {
   // The current browser doesn't support rich text editing.
 }
 

Returns:
The DOM document being edited with this rich text area.

getCommandManager

public CommandManager getCommandManager()
Returns:
the CommandManager associated with this instance.

setHTML

public void setHTML(String html)

Specified by:
setHTML in interface com.google.gwt.user.client.ui.HasHTML
Overrides:
setHTML in class com.google.gwt.user.client.ui.RichTextArea
See Also:
RichTextArea.setHTML(String), http://code.google.com/p/google-web-toolkit/issues/detail?id=3147, http://code.google.com/p/google-web-toolkit/issues/detail?id=3156

onBrowserEvent

public void onBrowserEvent(com.google.gwt.user.client.Event event)
Specified by:
onBrowserEvent in interface com.google.gwt.user.client.EventListener
Overrides:
onBrowserEvent in class com.google.gwt.user.client.ui.Widget

addDoubleClickHandler

public com.google.gwt.event.shared.HandlerRegistration addDoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler handler)
Specified by:
addDoubleClickHandler in interface com.google.gwt.event.dom.client.HasDoubleClickHandlers
Overrides:
addDoubleClickHandler in class com.google.gwt.user.client.ui.FocusWidget

addPasteHandler

public com.google.gwt.event.shared.HandlerRegistration addPasteHandler(PasteHandler handler)
Specified by:
addPasteHandler in interface HasPasteHandlers

addLoadHandler

public com.google.gwt.event.shared.HandlerRegistration addLoadHandler(com.google.gwt.event.dom.client.LoadHandler handler)
Specified by:
addLoadHandler in interface com.google.gwt.event.dom.client.HasLoadHandlers

onLoad

public void onLoad(com.google.gwt.event.dom.client.LoadEvent event)
Specified by:
onLoad in interface com.google.gwt.event.dom.client.LoadHandler

getImpl

protected com.google.gwt.user.client.ui.impl.RichTextAreaImpl getImpl()
NOTE: We need this method because RichTextArea.impl is private.

Returns:
the underlying rich text area browser-specific implementation

addActionHandler

public com.google.gwt.event.shared.HandlerRegistration addActionHandler(String actionName,
                                                                        ActionHandler handler)
Description copied from interface: HasActionHandlers
Registers the given handler for the specified action.

Specified by:
addActionHandler in interface HasActionHandlers
Parameters:
actionName - the name of the action to listen to
handler - the object to be notified when the specified action occurs
Returns:
the registration for the event, to be used for removing the handler

sinkEvents

public void sinkEvents(int eventBitsToAdd)
Overrides:
sinkEvents in class com.google.gwt.user.client.ui.Widget

onDetach

protected void onDetach()
Overrides:
onDetach in class com.google.gwt.user.client.ui.RichTextArea

onWindowClosing

public void onWindowClosing(com.google.gwt.user.client.Window.ClosingEvent event)
Specified by:
onWindowClosing in interface com.google.gwt.user.client.Window.ClosingHandler


Copyright © 2004-2013 XWiki. All Rights Reserved.