Class RichTextArea
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.FocusWidget
-
- com.google.gwt.user.client.ui.RichTextArea
-
- All Implemented Interfaces:
HasAllDragAndDropHandlers
,HasAllFocusHandlers
,HasAllGestureHandlers
,HasAllKeyHandlers
,HasAllMouseHandlers
,HasAllTouchHandlers
,HasBlurHandlers
,HasClickHandlers
,HasDoubleClickHandlers
,HasDragEndHandlers
,HasDragEnterHandlers
,HasDragHandlers
,HasDragLeaveHandlers
,HasDragOverHandlers
,HasDragStartHandlers
,HasDropHandlers
,HasFocusHandlers
,HasGestureChangeHandlers
,HasGestureEndHandlers
,HasGestureStartHandlers
,HasKeyDownHandlers
,HasKeyPressHandlers
,HasKeyUpHandlers
,HasMouseDownHandlers
,HasMouseMoveHandlers
,HasMouseOutHandlers
,HasMouseOverHandlers
,HasMouseUpHandlers
,HasMouseWheelHandlers
,HasTouchCancelHandlers
,HasTouchEndHandlers
,HasTouchMoveHandlers
,HasTouchStartHandlers
,HasAttachHandlers
,HasInitializeHandlers
,HasHandlers
,HasSafeHtml
,EventListener
,Focusable
,HasEnabled
,HasFocus
,HasHTML
,HasText
,HasVisibility
,IsWidget
,SourcesClickEvents
,SourcesFocusEvents
,SourcesKeyboardEvents
,SourcesMouseEvents
public class RichTextArea extends FocusWidget implements HasHTML, HasInitializeHandlers, HasSafeHtml
A rich text editor that allows complex styling and formatting. Because some browsers do not support rich text editing, and others support only a limited subset of functionality, there are two formatter interfaces, accessed viagetBasicFormatter()
andgetExtendedFormatter()
. A browser that does not support rich text editing at all will returnnull
for both of these, while one that supports only the basic functionality will returnnull
for the latter.CSS Style Rules
- .gwt-RichTextArea
- Applied to the rich text element.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RichTextArea.BasicFormatter
Deprecated.useRichTextArea.Formatter
insteadstatic interface
RichTextArea.ExtendedFormatter
Deprecated.useRichTextArea.Formatter
insteadstatic class
RichTextArea.FontSize
Font size enumeration.static interface
RichTextArea.Formatter
This interface is used to access full formatting options, when available.static class
RichTextArea.Justification
Justification enumeration.-
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
-
-
Field Summary
-
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSink
-
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
-
Constructor Summary
Constructors Constructor Description RichTextArea()
Creates a new, blankRichTextArea
object with no stylesheet.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description HandlerRegistration
addInitializeHandler(InitializeHandler handler)
Adds anInitializeEvent
handler.RichTextArea.BasicFormatter
getBasicFormatter()
Deprecated.usegetFormatter()
insteadRichTextArea.ExtendedFormatter
getExtendedFormatter()
Deprecated.usegetFormatter()
insteadRichTextArea.Formatter
getFormatter()
Gets the rich text formatting interface.java.lang.String
getHTML()
Gets this object's contents as HTML.java.lang.String
getText()
Gets this object's text.boolean
isEnabled()
Gets whether this widget is enabled.protected void
onAttach()
This method is called when a widget is attached to the browser's document.protected void
onDetach()
This method is called when a widget is detached from the browser's document.void
setEnabled(boolean enabled)
Sets whether this widget is enabled.void
setFocus(boolean focused)
Explicitly focus/unfocus this widget.void
setHTML(SafeHtml html)
Sets this object's contents via known-safe HTML.void
setHTML(java.lang.String html)
Sets this object's contents via HTML.void
setText(java.lang.String text)
Sets this object's text.-
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, 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, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, 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
-
-
-
-
Constructor Detail
-
RichTextArea
public RichTextArea()
Creates a new, blankRichTextArea
object with no stylesheet.
-
-
Method Detail
-
addInitializeHandler
public HandlerRegistration addInitializeHandler(InitializeHandler handler)
Description copied from interface:HasInitializeHandlers
Adds anInitializeEvent
handler.- Specified by:
addInitializeHandler
in interfaceHasInitializeHandlers
- Parameters:
handler
- the handler- Returns:
- the registration for the event
-
getBasicFormatter
@Deprecated public RichTextArea.BasicFormatter getBasicFormatter()
Deprecated.usegetFormatter()
insteadGets the basic rich text formatting interface. Note that formatting can only be done when theRichTextArea
is attached, visible on the page, and has been focused by the user.- Returns:
null
if basic formatting is not supported
-
getExtendedFormatter
@Deprecated public RichTextArea.ExtendedFormatter getExtendedFormatter()
Deprecated.usegetFormatter()
insteadGets the full rich text formatting interface. Note that formatting can only be done when theRichTextArea
is attached, visible on the page, and has been focused by the user.- Returns:
null
if full formatting is not supported
-
getFormatter
public RichTextArea.Formatter getFormatter()
Gets the rich text formatting interface. Note that formatting can only be done when theRichTextArea
is attached, visible on the page, and has been focused by the user.- Returns:
null
if full formatting is not supported
-
getHTML
public java.lang.String getHTML()
Description copied from interface:HasHTML
Gets this object's contents as HTML.
-
getText
public java.lang.String getText()
Description copied from interface:HasText
Gets this object's text.
-
isEnabled
public boolean isEnabled()
Description copied from class:FocusWidget
Gets whether this widget is enabled.- Specified by:
isEnabled
in interfaceHasEnabled
- Overrides:
isEnabled
in classFocusWidget
- Returns:
true
if the widget is enabled
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from class:FocusWidget
Sets whether this widget is enabled.- Specified by:
setEnabled
in interfaceHasEnabled
- Overrides:
setEnabled
in classFocusWidget
- Parameters:
enabled
-true
to enable the widget,false
to disable it
-
setFocus
public void setFocus(boolean focused)
Description copied from interface:Focusable
Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events. NOTE: Most browsers fire FocusEvents asynchronously. Especially within GWT tests, you'll need to make your test asynchronous to properly do verifications. SeeGWTTestCase#delayTestFinish
for more information on how to do this.- Specified by:
setFocus
in interfaceFocusable
- Overrides:
setFocus
in classFocusWidget
- Parameters:
focused
- whether this widget should take focus or release it
-
setHTML
public void setHTML(java.lang.String html)
Description copied from interface:HasHTML
Sets this object's contents via HTML. Use care when setting an object's HTML; it is an easy way to expose script-based security problems. Consider usingHasText.setText(String)
whenever possible.
-
setHTML
public void setHTML(SafeHtml html)
Description copied from interface:HasSafeHtml
Sets this object's contents via known-safe HTML.The object will behave exactly the same as when a widget's
HasHTML.setHTML(String)
method is invoked; however theSafeHtml
passed to this method observes the contract that it can be used in an HTML context without causing unsafe script execution. Thus, unlikeHasHTML.setHTML(String)
, using this method cannot result in Cross-Site Scripting security vulnerabilities.- Specified by:
setHTML
in interfaceHasSafeHtml
- Parameters:
html
- the object's new HTML, represented as aSafeHtml
object
-
setText
public void setText(java.lang.String text)
Description copied from interface:HasText
Sets this object's text.
-
onAttach
protected void onAttach()
Description copied from class:Widget
This method is called when a widget is attached to the browser's document. To receive notification after a Widget has been added to the document, override the
Widget.onLoad()
method or useWidget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler)
.It is strongly recommended that you override
Widget.onLoad()
orWidget.doAttachChildren()
instead of this method to avoid inconsistencies between logical and physical attachment states.Subclasses that override this method must call
super.onAttach()
to ensure that the Widget has been attached to its underlying Element.- Overrides:
onAttach
in classFocusWidget
- See Also:
Widget.onLoad()
,Widget.doAttachChildren()
-
onDetach
protected void onDetach()
Description copied from class:Widget
This method is called when a widget is detached from the browser's document. To receive notification before a Widget is removed from the document, override the
Widget.onUnload()
method or useWidget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler)
.It is strongly recommended that you override
Widget.onUnload()
orWidget.doDetachChildren()
instead of this method to avoid inconsistencies between logical and physical attachment states.Subclasses that override this method must call
super.onDetach()
to ensure that the Widget has been detached from the underlying Element. Failure to do so will result in application memory leaks due to circular references between DOM Elements and JavaScript objects.- Overrides:
onDetach
in classWidget
- See Also:
Widget.onUnload()
,Widget.doDetachChildren()
-
-