Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.gwtext.client.widgets.form
Class TextField

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.gwtext.client.widgets.Component
                  com.gwtext.client.widgets.BoxComponent
                      com.gwtext.client.widgets.form.Field
                          com.gwtext.client.widgets.form.TextField

All Implemented Interfaces:
  com.google.gwt.user.client.EventListener, Observable

Direct Known Subclasses:
  ComboBox, DateField, NumberField, TextArea, TriggerField

    public class TextField

extends Field

Basic text field.

Nested Class Summary

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

Fields inherited from class com.gwtext.client.widgets.Component
`config, id`

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`TextField()` Create a new TextField.
`TextField(com.google.gwt.core.client.JavaScriptObject jsObj)`
`TextField(java.lang.String fieldLabel)` Create a new TextField.
`TextField(java.lang.String fieldLabel, java.lang.String name)` Create a new TextField.
`TextField(java.lang.String fieldLabel, java.lang.String name, int width)` Create a new TextField.
`TextField(java.lang.String fieldLabel, java.lang.String name, int width, java.lang.String value)` Create a new TextField.

Method Summary
`void` | `addKeyListener(int[] keyCodes, KeyListener listener)` Add a key listener.
`void` | `addKeyListener(int keyCode, KeyListener listener)` Add a key listener.
`void` | `addKeyListener(java.lang.String keys, KeyListener listener)` Add a key listener.
`void` | `addKeyPressListener(EventCallback listener)` Add a key press listener
`void` | `addKeyPressListener(EventCallback listener, ListenerConfig listenerConfig)` Add a key press listener
`void` | `addListener(TextFieldListener listener)` Add a TextField listener.
`void` | `autoSize()` Automatically grows the field to accomodate the width of the text up to the maximum field width allowed.
`protected com.google.gwt.core.client.JavaScriptObject` | `create(com.google.gwt.core.client.JavaScriptObject jsObj)`
`protected com.google.gwt.core.client.JavaScriptObject` | `getConfigPrototype()`
`java.lang.String` | `getText()` Returns the value of the text field.
`java.lang.String` | `getXType()` Gets the xtype for this component as registered with ComponentMgr.
`void` | `selectText()` Selects text in this field.
`void` | `selectText(int start, int end)` Selects text in this field.
`void` | `setAllowBlank(boolean allowBlank)` False to validate that the value length > 0 (defaults to true).
`void` | `setBlankText(java.lang.String blankText)` Error text to display if the allow blank validation fails (defaults to "This field is required").
`void` | `setDisableKeyFilter(boolean disableKeyFilter)` True to disable input keystroke filtering (defaults to false).
`void` | `setEmptyClass(java.lang.String emptyClass)` The CSS class to apply to an empty field to style the emptyText (defaults to 'x-form-empty-field').
`void` | `setEmptyText(java.lang.String emptyText)` The default text to display in an empty field (defaults to null).
`void` | `setGrow(boolean grow)` True if this field should automatically grow and shrink to its content.
`void` | `setGrowMax(int growMax)` The maximum width to allow when grow = true (defaults to 800).
`void` | `setGrowMin(int growMin)` The minimum width to allow when grow = true (defaults to 30).
`void` | `setMaskRe(java.lang.String maskRe)` An input mask regular expression that will be used to filter keystrokes that don't match (defaults to null).
`void` | `setMaxLength(int maxLength)`
`void` | `setMaxLengthText(java.lang.String maxLengthText)` Error text to display if the maximum length validation fails.
`void` | `setMinLength(int minLength)` Minimum input field length required (defaults to 0).
`void` | `setMinLengthText(java.lang.String minLengthText)` Error text to display if the minimum length validation fails.
`void` | `setPassword(boolean password)` Set true if field is a password field.
`void` | `setRegex(java.lang.String regex)` A Regular Expressionto be tested against the field value during validation (defaults to null).
`void` | `setRegexText(java.lang.String regexText)` The error text to display if regex is used and the test fails during validation (defaults to "").
`void` | `setSelectOnFocus(boolean selectOnFocus)` True to automatically select any existing field text when the field receives input focus (defaults to false).
`void` | `setValidator(Validator validator)` Set a custom Validator for the Field.
`void` | `setVtype(VType vtype)` A validation type name as defined in `VType` (defaults to null).
`void` | `setVtypeText(java.lang.String vtypeText)` The validation type text if the validation specified by `setVtype(VType)` fails.
`boolean` | `validateValue(java.lang.String value)` Validates a value according to the field's validation rules and marks the field as invalid if the validation fails.

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, 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
`ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, setElement, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TextField

    public TextField()

  Create a new TextField.

### TextField

    public TextField(java.lang.String fieldLabel)

  Create a new TextField.

  Parameters:
    `fieldLabel` - the field label

### TextField

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

  Create a new TextField.

  Parameters:
    `fieldLabel` - the field label
    `name` - the field name

### TextField

    public TextField(java.lang.String fieldLabel,
                     java.lang.String name,
                     int width)

  Create a new TextField.

  Parameters:
    `fieldLabel` - the field label
    `name` - the field name
    `width` - the field width

### TextField

    public TextField(java.lang.String fieldLabel,
                     java.lang.String name,
                     int width,
                     java.lang.String value)

  Create a new TextField.

  Parameters:
    `fieldLabel` - the field label
    `name` - the field name
    `width` - the field width
    `value` - the field value

### TextField

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

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`

### addKeyListener

    public void addKeyListener(int keyCode,
                               KeyListener listener)

  Add a key listener.

  Parameters:
    `keyCode` - the numeric key code
    `listener` - the key listener

### addKeyListener

    public void addKeyListener(int[] keyCodes,
                               KeyListener listener)

  Add a key listener.

  Parameters:
    `keyCodes` - array of key codes
    `listener` - the key listener

### addKeyListener

    public void addKeyListener(java.lang.String keys,
                               KeyListener listener)

  Add a key listener.

  Parameters:
    `keys` - a string with the keys to listen for
    `listener` - the key listener

### addKeyPressListener

    public void addKeyPressListener(EventCallback listener)

  Add a key press listener

  Parameters:
    `listener` - the key press listener

### addKeyPressListener

    public void addKeyPressListener(EventCallback listener,
                                    ListenerConfig listenerConfig)

  Add a key press listener

  Parameters:
    `listener` - the key press listener
    `listenerConfig` - the listener config

### addListener

    public void addListener(TextFieldListener listener)

  Add a TextField listener.

  Parameters:
    `listener` - the listener

### autoSize

    public void autoSize()

  Automatically grows the field to accomodate the width of the text up to the maximum field width allowed. This only takes effect if grow = true, and fires the autosize event.

### selectText

    public void selectText()

  Selects text in this field.

### selectText

    public void selectText(int start,
                           int end)

  Selects text in this field.

  Parameters:
    `start` - the index where the selection should start
    `end` - the index where the selection should end

### validateValue

    public boolean validateValue(java.lang.String value)

  Validates a value according to the field's validation rules and marks the field as invalid if the validation fails.

  Parameters:
    `value` - the value to valdiate
  Returns:
    true if valid

### getText

    public java.lang.String getText()

  Returns the value of the text field.

  Returns:
    the text field value

### setAllowBlank

    public void setAllowBlank(boolean allowBlank)

  False to validate that the value length > 0 (defaults to true).

  Parameters:
    `allowBlank` - false to disallow blank

### setBlankText

    public void setBlankText(java.lang.String blankText)

  Error text to display if the allow blank validation fails (defaults to "This field is required").

  Parameters:
    `blankText` - error message for blank field

### setDisableKeyFilter

    public void setDisableKeyFilter(boolean disableKeyFilter)
                             throws java.lang.IllegalStateException

  True to disable input keystroke filtering (defaults to false).

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

### setEmptyClass

    public void setEmptyClass(java.lang.String emptyClass)
                       throws java.lang.IllegalStateException

  The CSS class to apply to an empty field to style the emptyText (defaults to 'x-form-empty-field'). This class is automatically added and removed as needed depending on the current field value.

  Parameters:
    `emptyClass` - the empty field CSS class
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setEmptyText

    public void setEmptyText(java.lang.String emptyText)

  The default text to display in an empty field (defaults to null).

  Parameters:
    `emptyText` - the empty field text

### setGrow

    public void setGrow(boolean grow)
                 throws java.lang.IllegalStateException

  True if this field should automatically grow and shrink to its content.

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

### setGrowMax

    public void setGrowMax(int growMax)
                    throws java.lang.IllegalStateException

  The maximum width to allow when grow = true (defaults to 800).

  Parameters:
    `growMax` - the max width
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setGrowMin

    public void setGrowMin(int growMin)
                    throws java.lang.IllegalStateException

  The minimum width to allow when grow = true (defaults to 30).

  Parameters:
    `growMin` - the minimum width
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setMaskRe

    public void setMaskRe(java.lang.String maskRe)

  An input mask regular expression that will be used to filter keystrokes that don't match (defaults to null).
  Note: This property cannot be changed after the Component has been rendered.

  Parameters:
    `maskRe` - the mask regular expression

### setMaxLength

    public void setMaxLength(int maxLength)

### setMaxLengthText

    public void setMaxLengthText(java.lang.String maxLengthText)

  Error text to display if the maximum length validation fails. (defaults to "The maximum length for this field is {maxLength}")

  Parameters:
    `maxLengthText` - the max lenght error text

### setMinLength

    public void setMinLength(int minLength)

  Minimum input field length required (defaults to 0).

  Parameters:
    `minLength` - the min length

### setMinLengthText

    public void setMinLengthText(java.lang.String minLengthText)

  Error text to display if the minimum length validation fails. (defaults to "The minimum length for this field is {minLength}")

  Parameters:
    `minLengthText` - the min length error text

### setPassword

    public void setPassword(boolean password)
                     throws java.lang.IllegalStateException

  Set true if field is a password field.

  Parameters:
    `password` - true if passowrd field
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setRegex

    public void setRegex(java.lang.String regex)

  A Regular Expressionto be tested against the field value during validation (defaults to null). If available, this regex will be evaluated only after the basic validators all return true, and will be passed the current field value. If the test fails, the field will be marked invalid using regexText.

  Parameters:
    `regex` - the regular expression

### setRegexText

    public void setRegexText(java.lang.String regexText)

  The error text to display if regex is used and the test fails during validation (defaults to "").
  Note: This property cannot be changed after the Component has been rendered.

  Parameters:
    `regexText` - the regexp text

### setSelectOnFocus

    public void setSelectOnFocus(boolean selectOnFocus)
                          throws java.lang.IllegalStateException

  True to automatically select any existing field text when the field receives input focus (defaults to false).

  Parameters:
    `selectOnFocus` - true to select text on focus
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setValidator

    public void setValidator(Validator validator)

  Set a custom Validator for the Field.

  Parameters:
    `validator` - the field validator

### setVtype

    public void setVtype(VType vtype)

  A validation type name as defined in `VType` (defaults to null).

  Parameters:
    `vtype` - the validation type

### setVtypeText

    public void setVtypeText(java.lang.String vtypeText)

  The validation type text if the validation specified by `setVtype(VType)` fails.

  Parameters:
    `vtypeText` - the vtype

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD