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.HasAllFocusHandlers, com.google.gwt.event.dom.client.HasAllKeyHandlers, com.google.gwt.event.dom.client.HasAllMouseHandlers, 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.HasFocusHandlers, 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.LoadHandler, com.google.gwt.event.logical.shared.HasInitializeHandlers, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.Focusable, 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.SourcesClickEvents, com.google.gwt.user.client.ui.SourcesFocusEvents, com.google.gwt.user.client.ui.SourcesKeyboardEvents, com.google.gwt.user.client.ui.SourcesMouseEvents, 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

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

Version:
$Id: RichTextArea.java 31679 2010-10-08 15:53:52Z mflorea $

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 java.lang.String DIRTY
           
static java.lang.String DISABLED
           
static java.lang.String LOADED
           
 
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(java.lang.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.
 boolean isEnabled()
          
 void onBrowserEvent(com.google.gwt.user.client.Event event)
          
protected  void onLoad()
          
 void onLoad(com.google.gwt.event.dom.client.LoadEvent event)
          
 void setEnabled(boolean enabled)
          
 void setHTML(java.lang.String html)
          
 void sinkEvents(int eventBitsToAdd)
          
 
Methods inherited from class com.google.gwt.user.client.ui.RichTextArea
addInitializeHandler, getBasicFormatter, getExtendedFormatter, getFormatter, getHTML, getText, onAttach, onDetach, setFocus, setText
 
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
addBlurHandler, addClickHandler, addClickListener, addFocusHandler, addFocusListener, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, getFocusImpl, getTabIndex, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setElement, setTabIndex
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, 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, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, 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
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Field Detail

DIRTY

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

LOADED

public static final java.lang.String LOADED
See Also:
onLoad(LoadEvent), Constant Field Values

DISABLED

public static final java.lang.String DISABLED
See Also:
setEnabled(boolean), 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(java.lang.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
See Also:
Widget.onBrowserEvent(com.google.gwt.user.client.Event)

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
See Also:
HasDoubleClickHandlers.addDoubleClickHandler(DoubleClickHandler)

addPasteHandler

public com.google.gwt.event.shared.HandlerRegistration addPasteHandler(PasteHandler handler)

Specified by:
addPasteHandler in interface HasPasteHandlers
See Also:
HasPasteHandlers.addPasteHandler(PasteHandler)

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
See Also:
HasLoadHandlers.addLoadHandler(LoadHandler)

onLoad

protected void onLoad()

Overrides:
onLoad in class com.google.gwt.user.client.ui.Widget
See Also:
Widget.onLoad()

onLoad

public void onLoad(com.google.gwt.event.dom.client.LoadEvent event)

Specified by:
onLoad in interface com.google.gwt.event.dom.client.LoadHandler
See Also:
LoadHandler.onLoad(LoadEvent), RichTextArea.onAttach()

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

isEnabled

public boolean isEnabled()

Overrides:
isEnabled in class com.google.gwt.user.client.ui.FocusWidget
See Also:
FocusWidget.isEnabled(), setEnabled(boolean)

setEnabled

public void setEnabled(boolean enabled)

NOTE: We overwrite this method to prevent the use of the disabled property which blocks rich text area events in Internet Explorer. For instance, the load event is not fired if the disabled property is set to true on the in-line frame element used by the rich text area. In order to be consistent with all the browsers we chose to use a different property to mark the enabled/disabled state. This way we can disable the rich text area while it is loading to prevent its content from being submitted and enable it when the load event fires.

Overrides:
setEnabled in class com.google.gwt.user.client.ui.FocusWidget
See Also:
FocusWidget.setEnabled(boolean), isEnabled()

addActionHandler

public com.google.gwt.event.shared.HandlerRegistration addActionHandler(java.lang.String actionName,
                                                                        ActionHandler handler)
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
See Also:
HasActionHandlers.addActionHandler(String, ActionHandler)

sinkEvents

public void sinkEvents(int eventBitsToAdd)

Overrides:
sinkEvents in class com.google.gwt.user.client.ui.Widget
See Also:
Widget.sinkEvents(int)


Copyright © 2004-2011 XWiki. All Rights Reserved.