com.gwtext.client.widgets.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.gwtext.client.widgets.Component
              extended by com.gwtext.client.widgets.BoxComponent
                  extended by com.gwtext.client.widgets.form.Field
                      extended by com.gwtext.client.widgets.form.HtmlEditor
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, Observable

public class HtmlEditor
extends Field

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.

There can only be one HtmlEditor on a page at a time.


Field Summary
 
Fields inherited from class com.gwtext.client.widgets.Component
config, id
 
Constructor Summary
HtmlEditor()
           
HtmlEditor(com.google.gwt.core.client.JavaScriptObject jsObj)
           
HtmlEditor(java.lang.String fieldLabel)
           
HtmlEditor(java.lang.String fieldLabel, java.lang.String name)
           
HtmlEditor(java.lang.String fieldLabel, java.lang.String name, int width)
           
 
Method Summary
 void addListener(HtmlEditorListener listener)
          Adds a HtmlEditor listener.
protected  com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 void execCmd(java.lang.String cmd, java.lang.String value)
          Executes a Midas editor command directly on the editor document.
protected  com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
           
 Toolbar getToolbar()
          Returns the editor's toolbar.
 java.lang.String getXType()
          Gets the xtype for this component as registered with ComponentMgr.
 void insertAtCursor(java.lang.String text)
          Inserts the passed text at the current cursor position.
 void relayCmd(java.lang.String cmd, java.lang.String value)
          Executes a Midas editor command on the editor document and performs necessary focus and toolbar updates.
 void setCreateLinkText(java.lang.String createLinkText)
          The default text for the create link prompt.
 void setDefaultLinkValue(java.lang.String defaultLinkValue)
          The default value for the create link prompt (defaults to http:/ /).
 void setEnableAlignments(boolean enableAlignments)
          Enable the left, center, right alignment buttons (defaults to true).
 void setEnableColors(boolean enableColors)
          Enable the fore/highlight color buttons (defaults to true).
 void setEnableFont(boolean enableFont)
          Enable font selection.
 void setEnableFontSize(boolean enableFontSize)
          Enable the increase/decrease font size buttons (defaults to true).
 void setEnableLinks(boolean enableLinks)
          Enable the create link button.
 void setEnableLists(boolean enableLists)
          Enable the bullet and numbered list buttons.
 void setEnableSourceEdit(boolean enableSourceEdit)
          Enable the switch to source edit button.
 void setFontFamilies(java.lang.String[] fontFamilies)
          An array of available font families.
 void setHeight(int height)
          Set the height of the HtmlEditor.
 void toggleSourceEdit(boolean sourceEdit)
          Toggles the editor between standard and source edit mode.
 
Methods inherited from class com.gwtext.client.widgets.form.Field
addListener, applyTo, applyTo, clearInvalid, getClearCls, getCls, getFieldLabel, getFocusClass, getInputType, getInvalidClass, getInvalidText, getLabelSeparator, getLabelStyle, getName, getRawValue, getTabindex, getValidationDelay, getValueAsString, hide, isAutoCreate, isDirty, isHideLabel, isReadOnly, isValid, isValid, isValidateOnBlur, markInvalid, reset, setAutoCreate, setAutoCreate, setClearCls, setCls, setDisabled, setFieldClass, setFieldLabel, setFieldMsgTarget, setFocusClass, setHideLabel, setInputType, setInvalidClass, setInvalidText, setLabel, setLabelSeparator, setLabelStyle, setMsgFx, setMsgTarget, setName, setRawValue, setReadOnly, setTabIndex, setValidateOnBlur, setValidationDelay, setValidationEvent, setValidationEvent, setValue, show, validate
 
Methods inherited from class com.gwtext.client.widgets.BoxComponent
addListener, doOnRender, doOnRender, getAutoHeight, getAutoWidth, getBox, getBox, getHeight, getPosition, getPosition, getSize, getWidth, setAutoHeight, setAutoWidth, setHeight, setPagePosition, setPosition, setSize, setSize, setWidth, setWidth, syncSize, updateBox
 
Methods inherited from class com.gwtext.client.widgets.Component
addClass, addClassCreated, addEvent, addEvents, addListener, addListener, addListener, addPlugin, addStyleDependentName, addStyleName, afterRender, beforeDestroy, check, checkExtVer, cloneComponent, cloneComponent, cloneConfig, destroy, disable, enable, equals, error, findParentBy, findParentByType, fireEvent, focus, focus, focus, getApplyTo, getAttribute, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAutoShow, getComponentJS, getConfig, getConfigAsString, getCtCls, getDisabledClass, getEl, getElement, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getTitle, getXTypes, hashCode, initComponent, isCreated, isDisabled, isHidden, isRendered, isVisible, isXType, isXType, onDestroy, purgeListeners, removeClass, removeStyleDependentName, removeStyleName, render, render, render, render, render, render, resumeEvents, setApplyTo, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoEl, setAutoEl, setAutoShow, setCtCls, setDisabledClass, setEl, setEl, setElement, setHideMode, setHideParent, setId, setRenderTo, setRenderToID, setStateEvents, setStateId, setStyle, setStyle, setStyleName, setStylePrimaryName, setTitle, setVisible, suspendEvents, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HtmlEditor

public HtmlEditor(com.google.gwt.core.client.JavaScriptObject jsObj)

HtmlEditor

public HtmlEditor()

HtmlEditor

public HtmlEditor(java.lang.String fieldLabel)

HtmlEditor

public HtmlEditor(java.lang.String fieldLabel,
                  java.lang.String name)

HtmlEditor

public HtmlEditor(java.lang.String fieldLabel,
                  java.lang.String name,
                  int width)
Method Detail

getConfigPrototype

protected com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
Overrides:
getConfigPrototype in class BoxComponent

getXType

public java.lang.String getXType()
Description copied from class: Component
Gets the xtype for this component as registered with ComponentMgr. For a list of all available xtypes, see the Component javadocs.

 
 

TextField field = new TextField(); field.getXType() returns "textfield"

Overrides:
getXType in class Field
Returns:
the xtype

create

protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject jsObj)
Specified by:
create in class Field

execCmd

public void execCmd(java.lang.String cmd,
                    java.lang.String value)
Executes a Midas editor command directly on the editor document. For visual commands, you should use relayCmd instead. This should only be called after the editor is initialized.

Parameters:
cmd - the Midas command
value - the value to pass to the command

getToolbar

public Toolbar getToolbar()
Returns the editor's toolbar. This is only available after the editor has been rendered.

Returns:
toolbar

insertAtCursor

public void insertAtCursor(java.lang.String text)
Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated to insert text.

Parameters:
text - the text to insert

relayCmd

public void relayCmd(java.lang.String cmd,
                     java.lang.String value)
Executes a Midas editor command on the editor document and performs necessary focus and toolbar updates. This should only be called after the editor is initialized.

Parameters:
cmd - the Midas command
value - the value to pass to the command

toggleSourceEdit

public void toggleSourceEdit(boolean sourceEdit)
Toggles the editor between standard and source edit mode.

Parameters:
sourceEdit - true for source edit, false for standard

addListener

public void addListener(HtmlEditorListener listener)
Adds a HtmlEditor listener.

Parameters:
listener - the listener

setCreateLinkText

public void setCreateLinkText(java.lang.String createLinkText)
                       throws java.lang.IllegalStateException
The default text for the create link prompt.

Parameters:
createLinkText - link text
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setDefaultLinkValue

public void setDefaultLinkValue(java.lang.String defaultLinkValue)
                         throws java.lang.IllegalStateException
The default value for the create link prompt (defaults to http:/ /).

Parameters:
defaultLinkValue - link value
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setEnableAlignments

public void setEnableAlignments(boolean enableAlignments)
                         throws java.lang.IllegalStateException
Enable the left, center, right alignment buttons (defaults to true).

Parameters:
enableAlignments - true to enable alignments
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setEnableColors

public void setEnableColors(boolean enableColors)
                     throws java.lang.IllegalStateException
Enable the fore/highlight color buttons (defaults to true).

Parameters:
enableColors - true to enable colors
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setEnableFont

public void setEnableFont(boolean enableFont)
                   throws java.lang.IllegalStateException
Enable font selection. Not available in Safari. (defaults to true).

Parameters:
enableFont - true to enable fonr selection
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setEnableFontSize

public void setEnableFontSize(boolean enableFontSize)
                       throws java.lang.IllegalStateException
Enable the increase/decrease font size buttons (defaults to true).

Parameters:
enableFontSize - true to enable font size buttons
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setEnableLinks

public void setEnableLinks(boolean enableLinks)
                    throws java.lang.IllegalStateException
Enable the create link button. Not available in Safari. (defaults to true).

Parameters:
enableLinks - true to enable links
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setEnableLists

public void setEnableLists(boolean enableLists)
                    throws java.lang.IllegalStateException
Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true).

Parameters:
enableLists - true to enable lists
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setEnableSourceEdit

public void setEnableSourceEdit(boolean enableSourceEdit)
                         throws java.lang.IllegalStateException
Enable the switch to source edit button. Not available in Safari. (defaults to true)

Parameters:
enableSourceEdit - true to enable source edit
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setFontFamilies

public void setFontFamilies(java.lang.String[] fontFamilies)
                     throws java.lang.IllegalStateException
An array of available font families.

Parameters:
fontFamilies - the font families
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setHeight

public void setHeight(int height)
               throws java.lang.IllegalStateException
Set the height of the HtmlEditor.

Overrides:
setHeight in class BoxComponent
Parameters:
height - the feild height
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered