com.gwtext.client.widgets
Class Editor

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.Editor
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, Observable
Direct Known Subclasses:
TreeEditor

public class Editor
extends Component

A base editor field that handles displaying/hiding on demand and has some built-in sizing and event handling logic.


Field Summary
 
Fields inherited from class com.gwtext.client.widgets.Component
config, id
 
Constructor Summary
Editor()
           
Editor(Field field)
          Create a new Editor.
Editor(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 void addListener(EditorListener listener)
          Add an Editor listener.
 void cancelEdit(boolean remainVisible)
          Cancels the editing process and hides the editor without persisting any changes.
 void completeEdit(boolean remainVisible)
          Ends the editing process, persists the changed value to the underlying field, and hides the editor.
protected  com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
           
protected  com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
           
 java.lang.Object getValue()
          Gets the data value of the editor.
 java.lang.String getValueAsString()
          Gets the data value of the editor.
 java.lang.String getXType()
          Gets the xtype for this component as registered with ComponentMgr.
 void realign()
          Realigns the editor to the bound field based on the current alignment config value.
 void setAlignment(java.lang.String anchorPosition)
          The position to align to.
 void setAutosize(boolean autosize)
          True for the editor to automatically adopt the size of the underlying field.
 void setAutosize(java.lang.String autosize)
          Set to "width" to adopt the width only, or "height" to adopt the height only.
 void setCancelOnEsc(boolean cancelOnEsc)
          True to cancel the edit when the escape key is pressed (defaults to false).
 void setCompleteOnEnter(boolean completeOnEnter)
          True to complete the edit when the enter key is pressed (defaults to false).
 void setConstrain(boolean constrain)
          True to constrain the editor to the viewport.
 void setField(Field field)
           
 void setHideEl(boolean hideEl)
          False to keep the bound element visible while the editor is displayed (defaults to true).
 void setIgnoreNoChange(boolean ignoreNoChange)
          True to skip the the edit completion process (no save, no events fired) if the user completes an edit and the value has not changed (defaults to false).
 void setRevertInvalid(boolean revertInvalid)
          True to automatically revert the field value and cancel the edit when the user completes an edit and the field validation fails (defaults to true).
 void setShadow(boolean shadow)
          "sides" for sides/bottom only, "frame" for 4-way shadow, and "drop" for bottom-right shadow (defaults to "frame")
 void setShadow(java.lang.String shadow)
          "sides" for sides/bottom only, "frame" for 4-way shadow, and "drop" for bottom-right shadow (defaults to "frame")
 void setSize(int width, int height)
          Sets the height and width of this editor.
 void setSwallowKeys(boolean swallowKeys)
          Handle the keydown/keypress events so they don't propagate (defaults to true).
 void setUpdateEl(boolean updateEl)
          True to update the innerHTML of the bound element when the update completes (defaults to false).
 void setValue(boolean value)
          The data value of the underlying field (defaults to "").
 void setValue(java.util.Date value)
          The data value of the underlying field (defaults to "").
 void setValue(double value)
          The data value of the underlying field (defaults to "").
 void setValue(long value)
          The data value of the underlying field (defaults to "").
 void setValue(java.lang.String value)
          The data value of the underlying field (defaults to "").
 void setValueRendered(boolean value)
          Sets the data value of the editor.
 void setValueRendered(java.util.Date value)
          Sets the data value of the editor.
 void startEdit(com.google.gwt.user.client.Element el)
          Starts the editing process and shows the editor.
 void startEdit(com.google.gwt.user.client.Element el, java.lang.String value)
          Starts the editing process and shows the editor.
 void startEdit(java.lang.String id)
          Starts the editing process and shows the editor.
 void startEdit(java.lang.String id, java.lang.String value)
          Starts the editing process and shows the editor.
 
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, getCls, getComponentJS, getConfig, getConfigAsString, getCtCls, getDisabledClass, getEl, getElement, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getTitle, getXTypes, hashCode, hide, 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, setCls, setCtCls, setDisabled, setDisabledClass, setEl, setEl, setElement, setHeight, setHideMode, setHideParent, setId, setRenderTo, setRenderToID, setStateEvents, setStateId, setStyle, setStyle, setStyleName, setStylePrimaryName, setTitle, setVisible, setWidth, show, 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, setSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Editor

public Editor()

Editor

public Editor(Field field)
Create a new Editor.

Parameters:
field - the editor field

Editor

public Editor(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

getConfigPrototype

protected com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
Specified by:
getConfigPrototype in class Component

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 Component
Returns:
the xtype

create

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

cancelEdit

public void cancelEdit(boolean remainVisible)
Cancels the editing process and hides the editor without persisting any changes. The field value will be reverted to the original starting value.

Parameters:
remainVisible - override the default behavior and keep the editor visible after cancel (defaults to false)

completeEdit

public void completeEdit(boolean remainVisible)
Ends the editing process, persists the changed value to the underlying field, and hides the editor.

Parameters:
remainVisible - Override the default behavior and keep the editor visible after edit (defaults to false)

getValueAsString

public java.lang.String getValueAsString()
Gets the data value of the editor.

Returns:
the value as String

getValue

public java.lang.Object getValue()
Gets the data value of the editor.

Returns:
the editor value

realign

public void realign()
Realigns the editor to the bound field based on the current alignment config value.


setSize

public void setSize(int width,
                    int height)
Sets the height and width of this editor.

Parameters:
width - the new width
height - the new height

setValueRendered

public void setValueRendered(boolean value)
Sets the data value of the editor.

Parameters:
value - the value

setValueRendered

public void setValueRendered(java.util.Date value)
Sets the data value of the editor.

Parameters:
value - the value

startEdit

public void startEdit(java.lang.String id)
Starts the editing process and shows the editor.

Parameters:
id - the element ID to edit

startEdit

public void startEdit(java.lang.String id,
                      java.lang.String value)
Starts the editing process and shows the editor.

Parameters:
id - the element ID to edit
value - A value to initialize the editor with. If a value is not provided, it defaults to the innerHTML of the element.

startEdit

public void startEdit(com.google.gwt.user.client.Element el)
Starts the editing process and shows the editor.

Parameters:
el - the element to edit

startEdit

public void startEdit(com.google.gwt.user.client.Element el,
                      java.lang.String value)
Starts the editing process and shows the editor.

Parameters:
el - the element to edit
value - A value to initialize the editor with. If a value is not provided, it defaults to the innerHTML of the element.

addListener

public void addListener(EditorListener listener)
Add an Editor listener.

Parameters:
listener - the listener

setAlignment

public void setAlignment(java.lang.String anchorPosition)
The position to align to.

Parameters:
anchorPosition - defaults to "c-c"

setAutosize

public void setAutosize(boolean autosize)
                 throws java.lang.IllegalStateException
True for the editor to automatically adopt the size of the underlying field.

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

setAutosize

public void setAutosize(java.lang.String autosize)
                 throws java.lang.IllegalStateException
Set to "width" to adopt the width only, or "height" to adopt the height only.

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

setCancelOnEsc

public void setCancelOnEsc(boolean cancelOnEsc)
True to cancel the edit when the escape key is pressed (defaults to false).

Parameters:
cancelOnEsc - cancel on escape

setCompleteOnEnter

public void setCompleteOnEnter(boolean completeOnEnter)
True to complete the edit when the enter key is pressed (defaults to false).

Parameters:
completeOnEnter - true to complete on enter

setConstrain

public void setConstrain(boolean constrain)
                  throws java.lang.IllegalStateException
True to constrain the editor to the viewport.

Parameters:
constrain - true to constrain the editor to the viewport
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setField

public void setField(Field field)

setHideEl

public void setHideEl(boolean hideEl)
False to keep the bound element visible while the editor is displayed (defaults to true).

Parameters:
hideEl - true to hide element

setIgnoreNoChange

public void setIgnoreNoChange(boolean ignoreNoChange)
True to skip the the edit completion process (no save, no events fired) if the user completes an edit and the value has not changed (defaults to false). Applies only to string values - edits for other data types will never be ignored.

Parameters:
ignoreNoChange - true to ingnore no change

setRevertInvalid

public void setRevertInvalid(boolean revertInvalid)
True to automatically revert the field value and cancel the edit when the user completes an edit and the field validation fails (defaults to true).

Parameters:
revertInvalid - true to rever invalid field value

setShadow

public void setShadow(boolean shadow)
               throws java.lang.IllegalStateException
"sides" for sides/bottom only, "frame" for 4-way shadow, and "drop" for bottom-right shadow (defaults to "frame")

Parameters:
shadow - the shadow setting
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setShadow

public void setShadow(java.lang.String shadow)
               throws java.lang.IllegalStateException
"sides" for sides/bottom only, "frame" for 4-way shadow, and "drop" for bottom-right shadow (defaults to "frame")

Parameters:
shadow - the shadow setting
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setSwallowKeys

public void setSwallowKeys(boolean swallowKeys)
                    throws java.lang.IllegalStateException
Handle the keydown/keypress events so they don't propagate (defaults to true).

Parameters:
swallowKeys - true to swallow keys
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

setUpdateEl

public void setUpdateEl(boolean updateEl)
True to update the innerHTML of the bound element when the update completes (defaults to false).

Parameters:
updateEl - true to update the element

setValue

public void setValue(java.lang.String value)
The data value of the underlying field (defaults to "").

Parameters:
value - the field value

setValue

public void setValue(java.util.Date value)
The data value of the underlying field (defaults to "").

Parameters:
value - the field value

setValue

public void setValue(long value)
The data value of the underlying field (defaults to "").

Parameters:
value - the field value

setValue

public void setValue(double value)
The data value of the underlying field (defaults to "").

Parameters:
value - the field value

setValue

public void setValue(boolean value)
The data value of the underlying field (defaults to "").

Parameters:
value - the field value