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

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<D>
                      extended by com.extjs.gxt.ui.client.widget.form.TextField<java.lang.Number>
                          extended by com.extjs.gxt.ui.client.widget.form.NumberField
All Implemented Interfaces:
Observable, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener

public class NumberField
extends TextField<java.lang.Number>

Numeric text field that provides automatic keystroke filtering and numeric validation.

When the field wraps any thing other than Double, either setPropertyEditorType(Class) or Field.setPropertyEditor(PropertyEditor) should be called with the appropriate number type.

 NumberField<Integer> field = new NumberField<Integer>;
 field.setPropertyEdtiorType(Integer.class);
 
Inherited Events:
Field Focus
Field Blur
Field Change
Field Invalid
Field Valid
Field KeyPress
Field SpecialKey


Nested Class Summary
 class NumberField.NumberFieldMessages
          NumberField messages.
 
Nested classes/interfaces inherited from class com.extjs.gxt.ui.client.widget.form.TextField
TextField.TextFieldMessages
 
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
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
NumberField()
          Creates a new number field.
 
Method Summary
 boolean getAllowDecimals()
          Returns true of decimal values are allowed.
 boolean getAllowNegative()
          Returns true if negative values are allowed.
 java.lang.String getBaseChars()
          Returns the base characters.
 com.google.gwt.i18n.client.NumberFormat getFormat()
          Returns the field's number format.
 java.lang.Number getMaxValue()
          Returns the fields max value.
 NumberField.NumberFieldMessages getMessages()
          Returns the field's messages.
 java.lang.Number getMinValue()
          Returns the field's minimum value.
 NumberPropertyEditor getPropertyEditor()
          Returns the field's property editor.
 java.lang.Class<?> getPropertyEditorType()
          Returns the number property editor number type.
 void setAllowDecimals(boolean allowDecimals)
          Sets whether decimal value are allowed (defaults to true).
 void setAllowNegative(boolean allowNegative)
          Sets whether negative value are allowed.
 void setBaseChars(java.lang.String baseChars)
          Sets the base set of characters to evaluate as valid numbers (defaults to '0123456789').
 void setFormat(com.google.gwt.i18n.client.NumberFormat format)
          Sets the cell's number formatter.
 void setMaxValue(java.lang.Number maxValue)
          Sets the field's max allowable value.
 void setMinValue(java.lang.Number minValue)
          Sets the field's minimum allowed value.
 void setPropertyEditorType(java.lang.Class<?> type)
          Specifies the number type used when converting a String to a Number instance (defaults to Double).
 
Methods inherited from class com.extjs.gxt.ui.client.widget.form.TextField
getAllowBlank, getCursorPos, getMaxLength, getMinLength, getRegex, getSelectedText, getSelectionLength, getSelectOnFocus, getValidator, isPassword, select, selectAll, setAllowBlank, setCursorPos, setEmptyText, setMaxLength, setMinLength, setPassword, setRegex, setSelectionRange, setSelectOnFocus, setValidator, setValue
 
Methods inherited from class com.extjs.gxt.ui.client.widget.form.Field
addInputStyleName, addKeyListener, clearInvalid, focus, forceInvalid, getAutoValidate, getEmptyText, getErrorMessage, getFieldLabel, getImages, getLabelSeparator, getLabelStyle, getMessageTarget, getName, getOriginalValue, getRawValue, getValidateOnBlur, getValidationDelay, getValue, isDirty, isFireChangeEventOnSetValue, isHideLabel, isInEditor, isReadOnly, isValid, isValid, markInvalid, onComponentEvent, removeInputStyleName, removeKeyListener, reset, setAutoValidate, setFieldLabel, setFireChangeEventOnSetValue, setHideLabel, setImages, setInEditor, setLabelSeparator, setLabelStyle, setMessages, setMessageTarget, setName, setOriginalValue, setPropertyEditor, setRawValue, setReadOnly, setTabIndex, setValidateOnBlur, setValidationDelay, updateOriginalValue, validate, validate
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
getBounds, getHeight, getHeight, getPosition, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, 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
addListener, addPlugin, addStyleName, addWidgetListener, clearState, disable, disableEvents, disableTextSelection, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, getBaseStyle, getBorders, getContextMenu, getData, getElement, getHideMode, getId, getItemId, getListeners, getModel, getState, getStateId, getToolTip, hasListeners, hasListeners, hide, hideToolTip, isDisabledEvents, isEnabled, isRendered, isStateful, isVisible, mask, mask, mask, onBrowserEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setBorders, setContextMenu, setData, setElement, setEnabled, setHideMode, setId, setIntStyleAttribute, setItemId, setStateful, setStateId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, setZIndex, show, sinkEvents, swallowEvent, swallowEvent, toString, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
fireEvent, getParent, isAttached
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumberField

public NumberField()
Creates a new number field.

Method Detail

getAllowDecimals

public boolean getAllowDecimals()
Returns true of decimal values are allowed.

Returns:
the allow decimal state

getAllowNegative

public boolean getAllowNegative()
Returns true if negative values are allowed.

Returns:
the allow negative value state

getBaseChars

public java.lang.String getBaseChars()
Returns the base characters.

Returns:
the base characters

getFormat

public com.google.gwt.i18n.client.NumberFormat getFormat()
Returns the field's number format.

Returns:
the number format

getMaxValue

public java.lang.Number getMaxValue()
Returns the fields max value.

Returns:
the max value

getMessages

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

Overrides:
getMessages in class TextField<java.lang.Number>
Returns:
the messages

getMinValue

public java.lang.Number getMinValue()
Returns the field's minimum value.

Returns:
the min value

getPropertyEditor

public NumberPropertyEditor getPropertyEditor()
Description copied from class: Field
Returns the field's property editor.

Overrides:
getPropertyEditor in class Field<java.lang.Number>
Returns:
the property editor

getPropertyEditorType

public java.lang.Class<?> getPropertyEditorType()
Returns the number property editor number type.

Returns:
the number type
See Also:
NumberPropertyEditor.setType(Class)

setAllowDecimals

public void setAllowDecimals(boolean allowDecimals)
Sets whether decimal value are allowed (defaults to true).

Parameters:
allowDecimals - true to allow negative values

setAllowNegative

public void setAllowNegative(boolean allowNegative)
Sets whether negative value are allowed.

Parameters:
allowNegative - true to allow negative values

setBaseChars

public void setBaseChars(java.lang.String baseChars)
Sets the base set of characters to evaluate as valid numbers (defaults to '0123456789').

Parameters:
baseChars - the base character

setFormat

public void setFormat(com.google.gwt.i18n.client.NumberFormat format)
Sets the cell's number formatter.

Parameters:
format - the format

setMaxValue

public void setMaxValue(java.lang.Number maxValue)
Sets the field's max allowable value.

Parameters:
maxValue - the max value

setMinValue

public void setMinValue(java.lang.Number minValue)
Sets the field's minimum allowed value.

Parameters:
minValue - the min value

setPropertyEditorType

public void setPropertyEditorType(java.lang.Class<?> type)
Specifies the number type used when converting a String to a Number instance (defaults to Double).

Parameters:
type - the number type (Short, Integer, Long, Float, Double).