com.extjs.gxt.ui.client.widget.form
Class HtmlEditor

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.BoxComponent
                  extended by com.extjs.gxt.ui.client.widget.form.Field<java.lang.String>
                      extended by com.extjs.gxt.ui.client.widget.form.HtmlEditor
All Implemented Interfaces:
Observable, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget

public class HtmlEditor
extends Field<java.lang.String>

Provides a lightweight HTML Editor component.

Note: The focus/blur and validation marking functionality inherited from Field is NOT supported by this editor.

An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within any element that has display set to 'none' can cause problems in Safari and Firefox due to their default iframe reloading bugs.

Events:
BeforeSync : HtmlEditorEvent(htmlEditor, change)
Fires before the iframe editor is updated with content from the textarea.
Sync : HtmlEditorEvent(htmlEditor, change)
Fires when the iframe editor is updated with content from the textarea.
EditModeChange : HtmlEditorEvent(htmlEditor, change)
Fires when the editor switches edit modes.


Nested Class Summary
protected  class HtmlEditor.EventHandler
           
 class HtmlEditor.HtmlEditorImages
           
 class HtmlEditor.HtmlEditorMessages
           
protected  class HtmlEditor.rte
           
 
Nested classes/interfaces inherited from class com.extjs.gxt.ui.client.widget.form.Field
Field.FieldImages, Field.FieldMessages
 
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
protected  com.google.gwt.user.client.ui.RichTextArea.FontSize activeFontSize
           
protected  Button backcolor
           
protected  ToggleButton bold
           
protected  SelectionListener<ButtonEvent> btnListener
           
protected  Button decreasefontsize
           
protected  java.util.List<com.google.gwt.user.client.ui.RichTextArea.FontSize> fontSizesConstants
           
protected  Button forecolor
           
protected  HtmlEditor.EventHandler handler
           
protected  com.google.gwt.user.client.ui.impl.RichTextAreaImpl impl
           
protected  Button increasefontsize
           
protected  ToggleButton italic
           
protected  Button justifyCenter
           
protected  Button justifyLeft
           
protected  Button justifyRight
           
protected  Button link
           
protected  Button ol
           
protected  HtmlEditor.rte rte
           
protected  ToggleButton sourceEdit
           
protected  ToolBar tb
           
protected  El textarea
           
protected  Button ul
           
protected  ToggleButton underline
           
 
Fields inherited from class com.extjs.gxt.ui.client.widget.form.Field
autoValidate, emptyText, errorIcon, fieldStyle, focusStyle, focusValue, forceInvalidText, hasFocus, images, invalidStyle, messages, name, originalValue, preventMark, propertyEditor, readOnly, readOnlyFieldStyle, validationDelay, validationTask, value
 
Fields inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
adjustSize, cacheSizes, ensureVisibilityOnSizing, height, lastSize, layer, shim, width
 
Fields inherited from class com.extjs.gxt.ui.client.widget.Component
afterRender, attachables, baseStyle, disabled, disabledStyle, disableTextSelection, dummy, focusable, hidden, mask, maskMessage, maskMessageStyleName, monitorWindowResize, rendered, resizeHandler, setElementRender, stateId, swallowEvents, toolTip, windowResizeDelay, windowResizeTask
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
HtmlEditor()
           
 
Method Summary
protected  void afterRender()
          Called after the component has been rendered and is attached for the first time.
protected  Button createButton(com.google.gwt.user.client.ui.AbstractImagePrototype icon, java.lang.String tt, java.lang.String toolTipTitle)
           
protected  Button createColorButton(com.google.gwt.user.client.ui.AbstractImagePrototype icon, java.lang.String toolTip, java.lang.String toolTipTitle, Listener<ComponentEvent> listener)
           
protected  ToggleButton createToggleButton(com.google.gwt.user.client.ui.AbstractImagePrototype icon, java.lang.String tt, java.lang.String toolTipTitle)
           
protected  void doAttachChildren()
           
protected  void doDetachChildren()
           
 com.google.gwt.user.client.ui.RichTextArea.BasicFormatter getBasicFormatter()
          Gets the basic rich text formatting interface.
 com.google.gwt.user.client.ui.RichTextArea.ExtendedFormatter getExtendedFormatter()
          Gets the full rich text formatting interface.
 HtmlEditor.HtmlEditorImages getImages()
           
protected  El getInputEl()
          Provides support for wrapping the actual input element.
 HtmlEditor.HtmlEditorMessages getMessages()
          Returns the field's messages.
 java.lang.String getRawValue()
          Returns the raw data value which may or may not be a valid, defined value.
 boolean isEnableAlignments()
           
 boolean isEnableColors()
           
 boolean isEnableFont()
           
 boolean isEnableFontSize()
           
 boolean isEnableFormat()
           
 boolean isEnableLinks()
           
 boolean isEnableLists()
           
 boolean isShowToolbar()
           
 boolean isSourceEditMode()
           
protected  void onAttach()
           
protected  void onBlur(ComponentEvent ce)
           
protected  void onDisable()
           
protected  void onEditorKeyDown(com.google.gwt.event.dom.client.KeyDownEvent e)
           
protected  void onEnable()
           
protected  void onFocus(ComponentEvent ce)
           
protected  void onRender(com.google.gwt.user.client.Element target, int index)
          Subclasses must override and ensure setElement is called for lazy rendered components.
protected  void onResize(int width, int height)
          Called after the component is resized, this method is empty by default but can be implemented by any subclass that needs to perform custom logic after a resize occurs.
 void pushValue()
           
 void setEnableAlignments(boolean enableAlignments)
           
 void setEnableColors(boolean enableColors)
           
 void setEnableFont(boolean enableFont)
           
 void setEnableFontSize(boolean enableFontSize)
           
 void setEnableFormat(boolean enableFormat)
           
 void setEnableLinks(boolean enableLinks)
           
 void setEnableLists(boolean enableLists)
           
protected  void setHighContrastImage(Button btn, java.lang.String image)
           
 void setRawValue(java.lang.String value)
          Sets the underlying DOM field's value directly, bypassing validation.
 void setShowToolbar(boolean showToolbar)
           
 void setSourceEditMode(boolean mode)
           
protected  void setupToolbar()
           
 void setValue(java.lang.String value)
          Sets a data value into the field and validates it.
 void syncValue()
           
protected  void toggleSourceEditMode()
           
protected  void updateStatus()
           
 boolean validate(boolean silent)
          Validates the field value.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.form.Field
addInputStyleName, addKeyListener, alignErrorIcon, clear, clearInvalid, createComponentEvent, findLabelElement, fireChangeEvent, fireKey, focus, forceInvalid, getAutoValidate, getEmptyText, getErrorMessage, getFieldLabel, getLabelSeparator, getLabelStyle, getMessageTarget, getName, getOriginalValue, getPropertyEditor, getStyleEl, getValidateOnBlur, getValidationDelay, getValue, initValue, isDirty, isFireChangeEventOnSetValue, isHideLabel, isInEditor, isReadOnly, isValid, isValid, markInvalid, onClick, onComponentEvent, onDetach, onHide, onKeyDown, onKeyPress, onKeyUp, onShow, removeInputStyleName, removeKeyListener, reset, setAutoValidate, setEmptyText, setFieldLabel, setFireChangeEventOnSetValue, setHideLabel, setImages, setInEditor, setInputStyleAttribute, setLabelSeparator, setLabelStyle, setMessages, setMessageTarget, setName, setOriginalValue, setPropertyEditor, setReadOnly, setTabIndex, setValidateOnBlur, setValidationDelay, updateOriginalValue, validate, validateValue
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
adjustPosition, adjustSize, getBounds, getHeight, getHeight, getPosition, getPositionEl, getResizeEl, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, hideShadow, hideShim, hideUnders, isAutoHeight, isAutoWidth, isDeferHeight, isShim, onPosition, onUnload, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShadowOffset, setShadowPosition, setShim, setSize, setSize, setWidth, setWidth, sync, syncSize
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Component
addAttachable, addListener, addPlugin, addStyleName, addStyleOnOver, addWidgetListener, applyState, assertAfterRender, assertPreRender, beforeRender, blur, clearState, createObservable, createStyles, disable, disableContextMenu, disableEvents, disableTextSelection, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, frame, getAriaSupport, getBaseStyle, getBorders, getContextMenu, getData, getElement, getFocusEl, getFocusSupport, getHideMode, getId, getItemId, getListeners, getModel, getObservable, getPlugins, getState, getStateId, getTabIndex, getTitle, getToolTip, getWindowResizeDelay, hasListeners, hasListeners, hide, hideToolTip, initState, isDisabledEvents, isDisableTextSelection, isEnabled, isMasked, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, mask, notifyHide, notifyShow, onBrowserEvent, onDetachHelper, onEnsureDebugId, onHideContextMenu, onLoad, onRightClick, onShowContextMenu, onWindowResize, previewEvent, recalculate, removeAllListeners, removeAttachagle, removeFromParent, removeListener, removeStyleName, removeStyleOnOver, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setAriaRole, setAriaState, setAriaSupport, setBorders, setContextMenu, setData, setEl, setElement, setElement, setEnabled, setFiresEvents, setHideMode, setId, setIntStyleAttribute, setItemId, setModel, setMonitorWindowResize, setParent, setStateful, setStateId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, setWindowResizeDelay, setZIndex, show, sinkEvents, swallowEvent, swallowEvent, toString, unframe, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, setLayoutData
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, removeStyleDependentName, setElement, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

activeFontSize

protected com.google.gwt.user.client.ui.RichTextArea.FontSize activeFontSize

backcolor

protected Button backcolor

bold

protected ToggleButton bold

btnListener

protected SelectionListener<ButtonEvent> btnListener

decreasefontsize

protected Button decreasefontsize

fontSizesConstants

protected java.util.List<com.google.gwt.user.client.ui.RichTextArea.FontSize> fontSizesConstants

forecolor

protected Button forecolor

handler

protected HtmlEditor.EventHandler handler

impl

protected com.google.gwt.user.client.ui.impl.RichTextAreaImpl impl

increasefontsize

protected Button increasefontsize

italic

protected ToggleButton italic

justifyCenter

protected Button justifyCenter

justifyLeft

protected Button justifyLeft

justifyRight

protected Button justifyRight

link

protected Button link

ol

protected Button ol

rte

protected HtmlEditor.rte rte

sourceEdit

protected ToggleButton sourceEdit

tb

protected ToolBar tb

textarea

protected El textarea

ul

protected Button ul

underline

protected ToggleButton underline
Constructor Detail

HtmlEditor

public HtmlEditor()
Method Detail

getBasicFormatter

public com.google.gwt.user.client.ui.RichTextArea.BasicFormatter getBasicFormatter()
Gets the basic rich text formatting interface.

Returns:
null if basic formatting is not supported

getExtendedFormatter

public com.google.gwt.user.client.ui.RichTextArea.ExtendedFormatter getExtendedFormatter()
Gets the full rich text formatting interface.

Returns:
null if full formatting is not supported

getImages

public HtmlEditor.HtmlEditorImages getImages()
Overrides:
getImages in class Field<java.lang.String>

getMessages

public HtmlEditor.HtmlEditorMessages getMessages()
Description copied from class: Field
Returns the field's messages.

Overrides:
getMessages in class Field<java.lang.String>
Returns:
the messages

getRawValue

public java.lang.String getRawValue()
Description copied from class: Field
Returns the raw data value which may or may not be a valid, defined value. To return a normalized value see Field.getValue().

Overrides:
getRawValue in class Field<java.lang.String>
Returns:
the raw value

isEnableAlignments

public boolean isEnableAlignments()

isEnableColors

public boolean isEnableColors()

isEnableFont

public boolean isEnableFont()

isEnableFontSize

public boolean isEnableFontSize()

isEnableFormat

public boolean isEnableFormat()

isEnableLinks

public boolean isEnableLinks()

isEnableLists

public boolean isEnableLists()

isShowToolbar

public boolean isShowToolbar()

isSourceEditMode

public boolean isSourceEditMode()

pushValue

public void pushValue()

setEnableAlignments

public void setEnableAlignments(boolean enableAlignments)

setEnableColors

public void setEnableColors(boolean enableColors)

setEnableFont

public void setEnableFont(boolean enableFont)

setEnableFontSize

public void setEnableFontSize(boolean enableFontSize)

setEnableFormat

public void setEnableFormat(boolean enableFormat)

setEnableLinks

public void setEnableLinks(boolean enableLinks)

setEnableLists

public void setEnableLists(boolean enableLists)

setRawValue

public void setRawValue(java.lang.String value)
Description copied from class: Field
Sets the underlying DOM field's value directly, bypassing validation. To set the value with validation see Field.setValue(D).

Overrides:
setRawValue in class Field<java.lang.String>
Parameters:
value - the raw value

setShowToolbar

public void setShowToolbar(boolean showToolbar)

setSourceEditMode

public void setSourceEditMode(boolean mode)

setValue

public void setValue(java.lang.String value)
Description copied from class: Field
Sets a data value into the field and validates it. If the field is rendered, To set the value directly without validation see Field.setRawValue(java.lang.String).

Overrides:
setValue in class Field<java.lang.String>
Parameters:
value - the value to set

syncValue

public void syncValue()

validate

public boolean validate(boolean silent)
Description copied from class: Field
Validates the field value.

Overrides:
validate in class Field<java.lang.String>
Parameters:
silent - true to not mark the field valid and fire invalid event when invalid
Returns:
true if valid, otherwise false

afterRender

protected void afterRender()
Description copied from class: Component
Called after the component has been rendered and is attached for the first time. At this time, the component will be part of the DOM which is required when retrieving location and offsets.

Overrides:
afterRender in class Field<java.lang.String>

createButton

protected Button createButton(com.google.gwt.user.client.ui.AbstractImagePrototype icon,
                              java.lang.String tt,
                              java.lang.String toolTipTitle)

createColorButton

protected Button createColorButton(com.google.gwt.user.client.ui.AbstractImagePrototype icon,
                                   java.lang.String toolTip,
                                   java.lang.String toolTipTitle,
                                   Listener<ComponentEvent> listener)

createToggleButton

protected ToggleButton createToggleButton(com.google.gwt.user.client.ui.AbstractImagePrototype icon,
                                          java.lang.String tt,
                                          java.lang.String toolTipTitle)

doAttachChildren

protected void doAttachChildren()
Overrides:
doAttachChildren in class Component

doDetachChildren

protected void doDetachChildren()
Overrides:
doDetachChildren in class Field<java.lang.String>

getInputEl

protected El getInputEl()
Description copied from class: Field
Provides support for wrapping the actual input element.

Overrides:
getInputEl in class Field<java.lang.String>
Returns:
the input element

onAttach

protected void onAttach()
Overrides:
onAttach in class Component

onBlur

protected void onBlur(ComponentEvent ce)
Overrides:
onBlur in class Field<java.lang.String>

onDisable

protected void onDisable()
Overrides:
onDisable in class Field<java.lang.String>

onEditorKeyDown

protected void onEditorKeyDown(com.google.gwt.event.dom.client.KeyDownEvent e)

onEnable

protected void onEnable()
Overrides:
onEnable in class Field<java.lang.String>

onFocus

protected void onFocus(ComponentEvent ce)
Overrides:
onFocus in class Field<java.lang.String>

onRender

protected void onRender(com.google.gwt.user.client.Element target,
                        int index)
Description copied from class: Component
Subclasses must override and ensure setElement is called for lazy rendered components.

Overrides:
onRender in class Field<java.lang.String>
Parameters:
target - the target element
index - the insert location

onResize

protected void onResize(int width,
                        int height)
Description copied from class: BoxComponent
Called after the component is resized, this method is empty by default but can be implemented by any subclass that needs to perform custom logic after a resize occurs.

Overrides:
onResize in class Field<java.lang.String>
Parameters:
width - the width
height - the height

setHighContrastImage

protected void setHighContrastImage(Button btn,
                                    java.lang.String image)

setupToolbar

protected void setupToolbar()

toggleSourceEditMode

protected void toggleSourceEditMode()

updateStatus

protected void updateStatus()