public class HtmlEditor extends AdapterField<String>
Provides an HTML-based rich text editor with a tool bar for selecting formatting options, including fonts, text justification, lists, hyperlinks and text color. Enables switching between formatted and HTML editing modes. Supports copy and paste from Web pages as well as text editing features provided by the browser (e.g. spell checking, text search).
By default, all formatting options are enabled and available via the tool bar. To disable one or more options, use the appropriate setter before adding the HTML editor to its container.
Modifier and Type | Class and Description |
---|---|
static interface |
HtmlEditor.HtmlEditorAppearance
The appearance of this class.
|
protected class |
HtmlEditor.HtmlEditorDefaultMessages |
static interface |
HtmlEditor.HtmlEditorMessages
The locale-sensitive messages used by this class.
|
Modifier and Type | Field and Description |
---|---|
protected FontSize |
activeFontSize |
protected HtmlEditor.HtmlEditorAppearance |
appearance |
protected com.sencha.gxt.widget.core.client.form.HtmlEditor.HtmlEditorContainer |
container |
protected BoxLayoutContainer.BoxLayoutData |
flex |
protected List<FontSize> |
fontSizesConstants |
protected HtmlEditor.HtmlEditorMessages |
messages |
protected TextArea |
sourceTextArea |
protected RichTextArea |
textArea |
protected ToolBar |
toolBar |
forceInvalidText, preventMark
resize, widget
forceLayoutCommand, forceLayoutOnResize, hadLayoutRunning, layoutCommand, layoutRequiredThisEventLoop, layoutRunning
adjustSize, allowTextSelection, cacheSizes, disableContextMenu, disabled, disabledStyle, ensureVisibilityOnSizing, height, hidden, lastSize, layer, left, mask, maskMessage, monitorWindowResize, pageX, pageY, resizeHandler, shim, tabIndex, toolTip, toolTipConfig, top, width, windowResizeDelay, windowResizeTask
Constructor and Description |
---|
HtmlEditor()
Creates an HTML-based rich text editor with support for fonts, text justification, lists, hyperlinks and text
color.
|
HtmlEditor(HtmlEditor.HtmlEditorAppearance appearance)
Creates an HTML-based rich text editor with support for fonts, text justification, lists, hyperlinks and text
color.
|
Modifier and Type | Method and Description |
---|---|
HtmlEditor.HtmlEditorAppearance |
getAppearance() |
HtmlEditor.HtmlEditorMessages |
getMessages()
Returns the locale-sensitive messages used by this class.
|
RichTextArea |
getTextArea()
Returns the
RichTextArea . |
String |
getValue() |
protected void |
initToolBar() |
boolean |
isEnableAlignments()
Returns
true if text justification is enabled. |
boolean |
isEnableColors()
Returns
true if setting text foreground and background colors is enabled. |
boolean |
isEnableFont()
Returns
true if setting font family name is enabled. |
boolean |
isEnableFontSize()
Returns
true if setting font size is enabled. |
boolean |
isEnableFormat()
Returns
true if setting font style is enabled. |
boolean |
isEnableLinks()
Returns
true if creating a hyperlink from selected text is enabled. |
boolean |
isEnableLists()
Returns
true if creating lists is enabled. |
boolean |
isEnableSourceEditMode()
Returns
true if the ability to switch to HTML source mode is enabled. |
boolean |
isShowToolBar()
Returns
true if the toolbar is displayed. |
boolean |
isSourceEditMode()
Returns
true if the editor is in source edit mode. |
protected void |
onAfterFirstAttach()
Called immediately after the first time the widget becomes attached to the browser's document only the first time.
|
protected void |
onDisable() |
protected void |
onEnable() |
void |
pushValue()
Copies the value of the HTML source editor to the rich text editor.
|
void |
setEnableAlignments(boolean enableAlignments)
Sets whether text justification is enabled (defaults to
true , pre-render). |
void |
setEnableColors(boolean enableColors)
Sets whether setting text foreground and background colors is enabled (defaults to
true , pre-render). |
void |
setEnableFont(boolean enableFont)
Sets whether setting font family name is enabled (defaults to
true , pre-render). |
void |
setEnableFontSize(boolean enableFontSize)
Sets whether setting font size is enabled (defaults to
true , pre-render). |
void |
setEnableFormat(boolean enableFormat)
Sets whether setting font style is enabled (defaults to
true , pre-render). |
void |
setEnableLinks(boolean enableLinks)
Sets whether creating a hyperlink from selected text is enable (defaults to
true , pre-render). |
void |
setEnableLists(boolean enableLists)
Sets whether creating lists is enabled (defaults to
true , pre-render). |
void |
setEnableSourceEditMode(boolean enable)
Sets whether the source edit mode is enabled (defaults to
true , pre-render). |
void |
setMessages(HtmlEditor.HtmlEditorMessages messages)
Sets the local-sensitive messages used by this class.
|
void |
setShowToolBar(boolean showToolBar)
Sets whether the toolbar should be shown.
|
void |
setSourceEditMode(boolean sourceEditMode)
Specifies if the editor should be in source edit mode.
|
void |
setValue(String value) |
void |
syncValue()
Copies the value of the rich text editor to the HTML source editor.
|
protected void |
toggleSourceEditMode() |
addInvalidHandler, addValidator, addValidHandler, addValueChangeHandler, clear, clearInvalid, disable, enable, finishEditing, flush, forceInvalid, getErrors, getErrorSupport, getValidators, isValid, isValid, markInvalid, markInvalid, onFocus, onPropertyChange, removeValidator, reset, setDelegate, setErrorSupport, showErrors, validate, validate, validateValue
add, add, doLayout, getWidget, isResize, onRemove, setElement, setResize, setWidget, setWidget
applyLayout, applyLayout, forceLayout, forceLayoutOnChildren, forceLayoutOnChildren, getLeftRightMargins, getParentLayoutWidget, getSideMargins, getTopBottomMargins, isLayoutRunning, isOrWasLayoutRunning, isWidgetVisible, onBeforeDoLayout, onLoad, onResize, onResize
addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, adjustIndex, adopt, checkIndexBoundsForInsertion, doAttachChildren, doDetachChildren, doPhysicalAttach, doPhysicalDetach, ensureGroupingHandlerRegistration, findWidget, getChildren, getContainerTarget, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, iterator, onInsert, onWidgetHide, onWidgetShow, orphan, remove, remove, remove
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addGestureRecognizer, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleDependentName, addStyleOnOver, adjustPosition, adjustSize, applyState, assertAfterRender, assertPreRender, blur, clearSizeCache, disableContextMenu, disableEvents, enableEvents, fireCancellableEvent, fireEvent, focus, getData, getElement, getFocusEl, getFocusSupport, getGestureRecognizer, getGestureRecognizerCount, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getPositionEl, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hide, hideShadow, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, notifyHide, notifyShow, onAttach, onBlur, onBrowserEvent, onDetach, onHide, onHideContextMenu, onPosition, onRightClick, onShow, onShowContextMenu, onTouch, onUnload, onWindowResize, removeStyleDependentName, removeStyleOnOver, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setMonitorWindowResize, setPagePosition, setPixelSize, setPosition, setShadow, setShadowPosition, setSize, setStateful, setStateId, setStyleDependentName, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBlurHandler
protected HtmlEditor.HtmlEditorAppearance appearance
protected com.sencha.gxt.widget.core.client.form.HtmlEditor.HtmlEditorContainer container
protected BoxLayoutContainer.BoxLayoutData flex
protected ToolBar toolBar
protected HtmlEditor.HtmlEditorMessages messages
protected RichTextArea textArea
protected TextArea sourceTextArea
protected List<FontSize> fontSizesConstants
protected FontSize activeFontSize
public HtmlEditor()
public HtmlEditor(HtmlEditor.HtmlEditorAppearance appearance)
appearance
- the appearance to be usedpublic HtmlEditor.HtmlEditorAppearance getAppearance()
public HtmlEditor.HtmlEditorMessages getMessages()
public String getValue()
public RichTextArea getTextArea()
RichTextArea
.public boolean isEnableAlignments()
true
if text justification is enabled.true
if text justification is enabledpublic boolean isEnableColors()
true
if setting text foreground and background colors is enabled.true
if setting text foreground and background colors is enabledpublic boolean isEnableFont()
true
if setting font family name is enabled.true
if setting font family name is enabledpublic boolean isEnableFontSize()
true
if setting font size is enabled.true
if setting font size is enabledpublic boolean isEnableFormat()
true
if setting font style is enabled.true
if setting font style is enabledpublic boolean isEnableLinks()
true
if creating a hyperlink from selected text is enabled.true
if creating a hyperlink from selected text is enabledpublic boolean isEnableLists()
true
if creating lists is enabled.true
if creating lists is enabledpublic boolean isEnableSourceEditMode()
true
if the ability to switch to HTML source mode is enabled.true
if the ability to switch to HTML source mode is enabledpublic boolean isShowToolBar()
true
if the toolbar is displayed.true
if the toolbar is displayedpublic boolean isSourceEditMode()
true
if the editor is in source edit mode.true
if editor is in source edit modepublic void pushValue()
public void setEnableAlignments(boolean enableAlignments)
true
, pre-render).enableAlignments
- true
to enable text justificationpublic void setEnableColors(boolean enableColors)
true
, pre-render).enableColors
- true
to enable setting text foreground and background colors.public void setEnableFont(boolean enableFont)
true
, pre-render).enableFont
- true
to enable setting font family namepublic void setEnableFontSize(boolean enableFontSize)
true
, pre-render).enableFontSize
- true
to enable setting font sizepublic void setEnableFormat(boolean enableFormat)
true
, pre-render).enableFormat
- true
to enable setting font stylepublic void setEnableLinks(boolean enableLinks)
true
, pre-render).enableLinks
- true
to enable creating a hyperlink from selected textpublic void setEnableLists(boolean enableLists)
true
, pre-render).enableLists
- true
to enable creating listspublic void setEnableSourceEditMode(boolean enable)
true
, pre-render).enable
- true
if source edit mode is enabledpublic void setMessages(HtmlEditor.HtmlEditorMessages messages)
messages
- the locale sensitive messages used by this class.public void setShowToolBar(boolean showToolBar)
showToolBar
- true
to show the toolbar, false
otherwise.public void setSourceEditMode(boolean sourceEditMode)
setEnableSourceEditMode(boolean)
is set to true
.sourceEditMode
- true
to put editor in source edit modepublic void setValue(String value)
public void syncValue()
protected void initToolBar()
protected void onAfterFirstAttach()
Component
onAfterFirstAttach
in class Component
protected void toggleSourceEditMode()
Copyright © 2018. All rights reserved.