public class RichTextArea extends FocusWidget implements HasHTML, HasInitializeHandlers, HasSafeHtml
getBasicFormatter() and getExtendedFormatter()
. A browser that does not support rich text editing at all will return
null for both of these, while one that supports only the basic
functionality will return null for the latter.
| Modifier and Type | Class and Description |
|---|---|
static interface |
RichTextArea.BasicFormatter
Deprecated.
use
RichTextArea.Formatter instead |
static interface |
RichTextArea.ExtendedFormatter
Deprecated.
use
RichTextArea.Formatter instead |
static 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.
|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledeventsToSinkDEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR| Constructor and Description |
|---|
RichTextArea()
Creates a new, blank
RichTextArea object with no stylesheet. |
| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addInitializeHandler(InitializeHandler handler)
Adds an
InitializeEvent handler. |
RichTextArea.BasicFormatter |
getBasicFormatter()
Deprecated.
use
getFormatter() instead |
RichTextArea.ExtendedFormatter |
getExtendedFormatter()
Deprecated.
use
getFormatter() instead |
RichTextArea.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.
|
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, setTabIndexaddAttachHandler, 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, unsinkEventsaddStyleDependentName, 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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfireEventpublic RichTextArea()
RichTextArea object with no stylesheet.public HandlerRegistration addInitializeHandler(InitializeHandler handler)
HasInitializeHandlersInitializeEvent handler.addInitializeHandler in interface HasInitializeHandlershandler - the handler@Deprecated public RichTextArea.BasicFormatter getBasicFormatter()
getFormatter() insteadRichTextArea is attached, visible on the
page, and has been focused by the user.null if basic formatting is not supported@Deprecated public RichTextArea.ExtendedFormatter getExtendedFormatter()
getFormatter() insteadRichTextArea is attached, visible on the page, and
has been focused by the user.null if full formatting is not supportedpublic RichTextArea.Formatter getFormatter()
RichTextArea is attached, visible on the page, and
has been focused by the user.null if full formatting is not supportedpublic java.lang.String getHTML()
HasHTMLpublic java.lang.String getText()
HasTextpublic boolean isEnabled()
FocusWidgetisEnabled in interface HasEnabledisEnabled in class FocusWidgettrue if the widget is enabledpublic void setEnabled(boolean enabled)
FocusWidgetsetEnabled in interface HasEnabledsetEnabled in class FocusWidgetenabled - true to enable the widget, false
to disable itpublic void setFocus(boolean focused)
FocusableGWTTestCase#delayTestFinish for more information on how to do this.setFocus in interface FocusablesetFocus in class FocusWidgetfocused - whether this widget should take focus or release itpublic void setHTML(java.lang.String html)
HasHTMLHasText.setText(String) whenever possible.public void setHTML(SafeHtml html)
HasSafeHtml
The object will behave exactly the same as when a widget's
HasHTML.setHTML(String) method is
invoked; however the SafeHtml passed to this method observes the
contract that it can be used in an HTML context without causing unsafe
script execution. Thus, unlike
HasHTML.setHTML(String), using this
method cannot result in Cross-Site Scripting security vulnerabilities.
setHTML in interface HasSafeHtmlhtml - the object's new HTML, represented as a SafeHtml objectpublic void setText(java.lang.String text)
HasTextprotected void onAttach()
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 use Widget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler).
It is strongly recommended that you override Widget.onLoad() or
Widget.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.
onAttach in class FocusWidgetWidget.onLoad(),
Widget.doAttachChildren()protected void onDetach()
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 use Widget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler).
It is strongly recommended that you override Widget.onUnload() or
Widget.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.
onDetach in class WidgetWidget.onUnload(),
Widget.doDetachChildren()