com.sencha.gxt.widget.core.client.form
Class ValueBaseField<T>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.sencha.gxt.widget.core.client.Component
              extended by com.sencha.gxt.widget.core.client.cell.CellComponent<T>
                  extended by com.sencha.gxt.widget.core.client.form.Field<T>
                      extended by com.sencha.gxt.widget.core.client.form.ValueBaseField<T>
All Implemented Interfaces:
Editor<T>, HasEditorDelegate<T>, HasEditorErrors<T>, LeafValueEditor<T>, ValueAwareEditor<T>, HasChangeHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasAttachHandlers, HasResizeHandlers, HasValueChangeHandlers<T>, HasHandlers, AutoDirectionHandler.Target, HasDirection, HasDirectionEstimator, EventListener, TakesValue<T>, HasName, HasText, HasValue<T>, HasVisibility, IsWidget, HasKeyProvider<T>, BeforeHideEvent.HasBeforeHideHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, InvalidEvent.HasInvalidHandlers, MoveEvent.HasMoveHandlers, ParseErrorEvent.HasParseErrorHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, ValidEvent.HasValidHandlers, IsField<T>, HasFocusSupport, HasItemId
Direct Known Subclasses:
PasswordField, TextArea, TextField, TriggerField

public abstract class ValueBaseField<T>
extends Field<T>
implements HasKeyPressHandlers, HasKeyDownHandlers, HasChangeHandlers, ParseErrorEvent.HasParseErrorHandlers, HasDirectionEstimator, AutoDirectionHandler.Target


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sencha.gxt.widget.core.client.form.Field
Field.FieldStyles
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.i18n.client.HasDirection
HasDirection.Direction
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Method Summary
 HandlerRegistration addChangeHandler(ChangeHandler handler)
           
 HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
           
 HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
           
 HandlerRegistration addKeyUpHandler(KeyUpHandler handler)
           
 HandlerRegistration addParseErrorHandler(ParseErrorEvent.ParseErrorHandler handler)
          Adds a ParseErrorEvent.ParseErrorHandler handler for ParseErrorEvent events.
 ValueBaseInputCell<T> getCell()
          Get the Cell wrapped by this widget.
 T getCurrentValue()
          Returns the field's current value.
 int getCursorPos()
          Gets the current position of the cursor (this also serves as the beginning of the text selection).
 HasDirection.Direction getDirection()
           
 DirectionEstimator getDirectionEstimator()
           
 String getEmptyText()
          Returns the field's empty text.
 PropertyEditor<T> getPropertyEditor()
          Returns the field's property editor.
 String getSelectedText()
          Gets the text currently selected within this text box.
 int getSelectionLength()
          Gets the length of the current text selection.
 String getText()
          Gets this object's text.
 T getValueOrThrow()
          Return the parsed value, or null if the field is empty.
 boolean isAllowBlank()
          Returns the field's allow blank state.
 boolean isCurrentValid()
          Returns the valid state of the current value.
 boolean isCurrentValid(boolean preventMark)
          Returns the valid state of the current value.
 boolean isSelectOnFocus()
          Returns the select of focus state.
 void select(int start, int length)
          Selects text in the field.
 void selectAll()
          Selects all the text.
 void setAllowBlank(boolean allowBlank)
          Sets whether a field is valid when its value length = 0 (default to true).
 void setCursorPos(int pos)
          Sets the cursor position.
 void setDirection(HasDirection.Direction direction)
          Sets the directionality for a widget.
 void setDirectionEstimator(boolean enabled)
          Toggles on / off direction estimation.
 void setDirectionEstimator(DirectionEstimator directionEstimator)
          Sets the {link DirectionEstimator} object.
 void setEmptyText(String emptyText)
          Sets the default text to display in an empty field (defaults to null).
 void setId(String id)
          Sets the component's id.
 void setPropertyEditor(PropertyEditor<T> propertyEditor)
          Sets the field's property editor which is used to translate typed values to string, and string values back to typed values.
 void setReadOnly(boolean readOnly)
          Sets the field's read only state.
 void setSelectionRange(int pos, int length)
          Sets the range of text to be selected.
 void setSelectOnFocus(boolean selectOnFocus)
          True to automatically select any existing field text when the field receives input focus (defaults to false).
 void setText(String text)
          Sets the underlying DOM field's value directly, bypassing validation.
 void setValue(T value)
          Sets this object's value without firing any events.
 boolean validateCurrent(boolean preventMark)
           
 
Methods inherited from class com.sencha.gxt.widget.core.client.form.Field
addInvalidHandler, addValidator, addValidHandler, addValueChangeHandler, clear, clearInvalid, finishEditing, flush, forceInvalid, getErrorSupport, getName, getValidateOnBlur, getValidationDelay, getValidators, isAutoValidate, isEditing, isReadOnly, isValid, isValid, markInvalid, onBrowserEvent, onPropertyChange, removeValidator, reset, setAutoValidate, setDelegate, setErrorSupport, setName, setOriginalValue, setValidateOnBlur, setValidationDelay, setValue, showErrors, validate, validate
 
Methods inherited from class com.sencha.gxt.widget.core.client.cell.CellComponent
getElement, getKeyProvider, getValue, redraw, setValue
 
Methods inherited from class com.sencha.gxt.widget.core.client.Component
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disable, disableEvents, enable, enableEvents, fireEvent, focus, getData, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 
Methods inherited from interface com.google.gwt.user.client.ui.IsWidget
asWidget
 
Methods inherited from interface com.google.gwt.user.client.TakesValue
getValue
 
Methods inherited from interface com.google.gwt.user.client.ui.HasValue
getValue, setValue
 

Method Detail

addChangeHandler

public HandlerRegistration addChangeHandler(ChangeHandler handler)
Specified by:
addChangeHandler in interface HasChangeHandlers

addKeyDownHandler

public HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
Specified by:
addKeyDownHandler in interface HasKeyDownHandlers

addKeyPressHandler

public HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
Specified by:
addKeyPressHandler in interface HasKeyPressHandlers

addKeyUpHandler

public HandlerRegistration addKeyUpHandler(KeyUpHandler handler)
Specified by:
addKeyUpHandler in interface HasKeyUpHandlers

addParseErrorHandler

public HandlerRegistration addParseErrorHandler(ParseErrorEvent.ParseErrorHandler handler)
Description copied from interface: ParseErrorEvent.HasParseErrorHandlers
Adds a ParseErrorEvent.ParseErrorHandler handler for ParseErrorEvent events.

Specified by:
addParseErrorHandler in interface ParseErrorEvent.HasParseErrorHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

getCell

public ValueBaseInputCell<T> getCell()
Description copied from class: CellComponent
Get the Cell wrapped by this widget.

Overrides:
getCell in class Field<T>
Returns:
the Cell being wrapped

getCurrentValue

public T getCurrentValue()
Returns the field's current value. The value of the field is not updated until the field is blurred when editing.

Returns:
the current value

getCursorPos

public int getCursorPos()
Gets the current position of the cursor (this also serves as the beginning of the text selection).

Returns:
the cursor's position

getDirection

public HasDirection.Direction getDirection()
Specified by:
getDirection in interface HasDirection

getDirectionEstimator

public DirectionEstimator getDirectionEstimator()
Specified by:
getDirectionEstimator in interface HasDirectionEstimator

getEmptyText

public String getEmptyText()
Returns the field's empty text.

Returns:
the empty text

getPropertyEditor

public PropertyEditor<T> getPropertyEditor()
Returns the field's property editor.

Returns:
the property editor

getSelectedText

public String getSelectedText()
Gets the text currently selected within this text box.

Returns:
the selected text, or an empty string if none is selected

getSelectionLength

public int getSelectionLength()
Gets the length of the current text selection.

Returns:
the text selection length

getText

public String getText()
Gets this object's text.

Specified by:
getText in interface HasText
Returns:
the object's new text

getValueOrThrow

public T getValueOrThrow()
                  throws ParseException
Return the parsed value, or null if the field is empty.

Returns:
the parsed value
Throws:
ParseException - if the value cannot be parsed

isAllowBlank

public boolean isAllowBlank()
Returns the field's allow blank state.

Returns:
true if blank values are allowed

isCurrentValid

public boolean isCurrentValid()
Returns the valid state of the current value. This method will not mark the field invalid if validation fails.

Returns:
the current valid state

isCurrentValid

public boolean isCurrentValid(boolean preventMark)
Returns the valid state of the current value. This method will not mark the field invalid if validation fails.

Returns:
the current valid state

isSelectOnFocus

public boolean isSelectOnFocus()
Returns the select of focus state.

Returns:
true if select on focus is enabled

select

public void select(int start,
                   int length)
Selects text in the field.

Parameters:
start - the index where the selection should start.
length - the number of characters to be selected

selectAll

public void selectAll()
Selects all the text.


setAllowBlank

public void setAllowBlank(boolean allowBlank)
Sets whether a field is valid when its value length = 0 (default to true).

Parameters:
allowBlank - true to allow blanks, false otherwise

setCursorPos

public void setCursorPos(int pos)
Sets the cursor position. This will only work when the widget is attached to the document and not hidden.

Parameters:
pos - the new cursor position

setDirection

public void setDirection(HasDirection.Direction direction)
Sets the directionality for a widget.

Specified by:
setDirection in interface HasDirection
Parameters:
direction - RTL if the directionality should be set to right-to-left, LTR if the directionality should be set to left-to-right DEFAULT if the directionality should not be explicitly set

setDirectionEstimator

public void setDirectionEstimator(boolean enabled)
Toggles on / off direction estimation.

Specified by:
setDirectionEstimator in interface HasDirectionEstimator
Parameters:
enabled - Whether to enable direction estimation. If true, sets the DirectionEstimator object to a default DirectionEstimator.

setDirectionEstimator

public void setDirectionEstimator(DirectionEstimator directionEstimator)
Sets the {link DirectionEstimator} object.

Specified by:
setDirectionEstimator in interface HasDirectionEstimator
Parameters:
directionEstimator - The {code DirectionEstimator} to be set. null means turning off direction estimation.

setEmptyText

public void setEmptyText(String emptyText)
Sets the default text to display in an empty field (defaults to null).

Parameters:
emptyText - the empty text

setId

public void setId(String id)
Description copied from class: Component
Sets the component's id.

Overrides:
setId in class Component
Parameters:
id - the id

setPropertyEditor

public void setPropertyEditor(PropertyEditor<T> propertyEditor)
Sets the field's property editor which is used to translate typed values to string, and string values back to typed values.

Parameters:
propertyEditor - the property editor

setReadOnly

public void setReadOnly(boolean readOnly)
Description copied from class: Field
Sets the field's read only state.

Overrides:
setReadOnly in class Field<T>
Parameters:
readOnly - the read only state

setSelectionRange

public void setSelectionRange(int pos,
                              int length)
Sets the range of text to be selected. This will only work when the widget is attached to the document and not hidden.

Parameters:
pos - the position of the first character to be selected
length - the number of characters to be selected

setSelectOnFocus

public void setSelectOnFocus(boolean selectOnFocus)
True to automatically select any existing field text when the field receives input focus (defaults to false).

Parameters:
selectOnFocus - true to focus

setText

public void setText(String text)
Sets the underlying DOM field's value directly, bypassing validation. This method does not update the field's value. To set the value with validation see setValue(T).

Specified by:
setText in interface HasText
Parameters:
text - the text

setValue

public void setValue(T value)
Sets this object's value without firing any events. This should be identical to calling setValue(value, false). It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values. Widgets must accept null as a valid value. By convention, setting a widget to null clears value, calling getValue() on a cleared widget returns null. Widgets that can not be cleared (e.g. CheckBox) must find another valid meaning for null input.

Specified by:
setValue in interface ValueAwareEditor<T>
Specified by:
setValue in interface TakesValue<T>
Specified by:
setValue in interface HasValue<T>
Overrides:
setValue in class CellComponent<T>
Parameters:
value - the parsed value

validateCurrent

public boolean validateCurrent(boolean preventMark)


Copyright © 2012. All Rights Reserved.