T
- the field typepublic abstract class ValueBaseField<T> extends Field<T> implements HasKeyPressHandlers, HasKeyDownHandlers, HasChangeHandlers, ParseErrorEvent.HasParseErrorHandlers, HasDirectionEstimator, AutoDirectionHandler.Target, HasText
Field.FieldStyles
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasDirection.Direction
DEBUG_ID_PREFIX
Modifier and Type | Method and Description |
---|---|
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. |
void |
clear()
Clears the value from the field.
|
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 |
isClearValueOnParseError()
Returns
true if the current value is cleared on a parse error. |
boolean |
isCurrentValid()
Returns the valid state of the current value.
|
boolean |
isCurrentValid(boolean preventMark)
Returns the valid state of the current value.
|
boolean |
isReadOnly()
Returns the read only state.
|
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 |
setClearValueOnParseError(boolean clearValueOnParseError)
Clears the current value when a parse error occurs (defaults 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)
Automatically select any existing field text when the field receives input focus (defaults to
false ). |
void |
setTabIndex(int tabIndex)
Sets the component's tab index.
|
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) |
addInvalidHandler, addValidator, addValidHandler, addValueChangeHandler, clearInvalid, finishEditing, flush, forceInvalid, getErrors, getErrorSupport, getName, getOriginalValue, getValidateOnBlur, getValidationDelay, getValidators, isAutoValidate, isEditing, isValid, isValid, markInvalid, onBrowserEvent, onPropertyChange, removeValidator, reset, setAutoValidate, setDelegate, setErrorSupport, setName, setOriginalValue, setValidateOnBlur, setValidationDelay, setValue, showErrors, validate, validate
getElement, getKeyProvider, getValue, redraw, setValue
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, getShadowPosition, getStateId, getTabIndex, 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, setShadowPosition, setSize, setStateful, setStateId, setToolTip, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
getValue
addBlurHandler
public HandlerRegistration addChangeHandler(ChangeHandler handler)
addChangeHandler
in interface HasChangeHandlers
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
addKeyDownHandler
in interface HasKeyDownHandlers
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
addKeyPressHandler
in interface HasKeyPressHandlers
public void clear()
IsField
clear
in interface IsField<T>
clear
in class Field<T>
to remove validation messages
,
to restore to original value and remove validation messages
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler)
addKeyUpHandler
in interface HasKeyUpHandlers
public HandlerRegistration addParseErrorHandler(ParseErrorEvent.ParseErrorHandler handler)
ParseErrorEvent.HasParseErrorHandlers
ParseErrorEvent.ParseErrorHandler
handler for ParseErrorEvent
events.addParseErrorHandler
in interface ParseErrorEvent.HasParseErrorHandlers
handler
- the handlerpublic ValueBaseInputCell<T> getCell()
CellComponent
Cell
wrapped by this widget.public T getCurrentValue()
public int getCursorPos()
public HasDirection.Direction getDirection()
getDirection
in interface HasDirection
public DirectionEstimator getDirectionEstimator()
getDirectionEstimator
in interface HasDirectionEstimator
public String getEmptyText()
public PropertyEditor<T> getPropertyEditor()
public String getSelectedText()
public int getSelectionLength()
public String getText()
public T getValueOrThrow() throws ParseException
ParseException
- if the value cannot be parsedpublic boolean isAllowBlank()
true
if blank values are allowedpublic boolean isClearValueOnParseError()
true
if the current value is cleared on a parse error.true
if clearing on parse errorpublic boolean isCurrentValid()
public boolean isCurrentValid(boolean preventMark)
preventMark
- true
to not mark the field invalidpublic boolean isSelectOnFocus()
true
if select on focus is enabledpublic void select(int start, int length)
start
- the index where the selection should start.length
- the number of characters to be selectedpublic void selectAll()
public void setAllowBlank(boolean allowBlank)
true
).allowBlank
- true
to allow blanks, false
otherwisepublic void setClearValueOnParseError(boolean clearValueOnParseError)
true
).clearValueOnParseError
- true
to clean the value on parse errorpublic void setCursorPos(int pos)
pos
- the new cursor positionpublic void setDirection(HasDirection.Direction direction)
setDirection
in interface HasDirection
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 setpublic void setDirectionEstimator(boolean enabled)
setDirectionEstimator
in interface HasDirectionEstimator
enabled
- Whether to enable direction estimation. If true
, sets the DirectionEstimator object to a
default DirectionEstimator.public void setDirectionEstimator(DirectionEstimator directionEstimator)
setDirectionEstimator
in interface HasDirectionEstimator
directionEstimator
- The {code DirectionEstimator} to be set. null means turning off direction estimation.public void setEmptyText(String emptyText)
emptyText
- the empty textpublic void setId(String id)
Component
public void setPropertyEditor(PropertyEditor<T> propertyEditor)
propertyEditor
- the property editorpublic void setReadOnly(boolean readOnly)
setReadOnly
in class Field<T>
readOnly
- the read only statepublic boolean isReadOnly()
true
if read only, otherwise false
public void setSelectionRange(int pos, int length)
pos
- the position of the first character to be selectedlength
- the number of characters to be selectedpublic void setSelectOnFocus(boolean selectOnFocus)
false
).selectOnFocus
- true
to focuspublic void setTabIndex(int tabIndex)
Component
setTabIndex
in class Component
tabIndex
- the tab indexpublic void setText(String text)
setValue(T)
.public void setValue(T value)
setValue
in interface ValueAwareEditor<T>
setValue
in interface TakesValue<T>
setValue
in interface HasValue<T>
setValue
in class CellComponent<T>
value
- the parsed valuepublic boolean validateCurrent(boolean preventMark)
Copyright © 2015. All rights reserved.