T
- the field typepublic abstract class ValueBaseField<T> extends Field<T> implements ParseErrorEvent.HasParseErrorHandlers
Field.FieldStyles
Modifier and Type | Field and Description |
---|---|
protected static TextBoxImpl |
impl |
forceInvalidText, hasFocus, name, originalValue, parseError, preventMark, validationTask
valueUpdater
adjustSize, allowTextSelection, cacheSizes, disableContextMenu, disabled, disabledStyle, ensureVisibilityOnSizing, height, hidden, lastSize, layer, left, mask, maskMessage, monitorWindowResize, pageX, pageY, resizeHandler, shim, tabIndex, toolTip, toolTipConfig, top, width, windowResizeDelay, windowResizeTask
Modifier | Constructor and Description |
---|---|
protected |
ValueBaseField(ValueBaseInputCell<T> cell) |
protected |
ValueBaseField(ValueBaseInputCell<T> cell,
PropertyEditor<T> propertyEditor) |
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.
|
protected void |
doAutoValidate() |
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).
|
Direction |
getDirection() |
DirectionEstimator |
getDirectionEstimator() |
String |
getEmptyText()
Returns the field's empty text.
|
protected XElement |
getFocusEl() |
protected TextBoxImpl |
getImpl() |
protected XElement |
getInputEl()
Provides the actual input element used by this field.
|
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.
|
protected void |
onCellParseError(ParseErrorEvent event) |
protected void |
onRedraw() |
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(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, markInvalid, onBlur, onBrowserEvent, onDetach, onDisable, onEnable, onFocus, onKeyDown, onKeyPress, onKeyUp, onLogicalBlur, onLogicalFocus, onNavigationKey, onPropertyChange, removeValidator, reset, setAutoValidate, setDelegate, setErrors, setErrorSupport, setName, setOriginalValue, setValidateOnBlur, setValidationDelay, setValue, showErrors, validate, validate, validateValue
createContext, getElement, getKey, getKeyProvider, getValue, onResize, redraw, redraw, setKeyProvider, setValue
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addGestureRecognizer, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleDependentName, addStyleOnOver, adjustPosition, adjustSize, applyState, assertAfterRender, assertPreRender, blur, clearSizeCache, disable, disableContextMenu, disableEvents, enable, enableEvents, fireCancellableEvent, fireEvent, focus, getData, getFocusSupport, getGestureRecognizer, getGestureRecognizerCount, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getPositionEl, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hide, hideShadow, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, notifyHide, notifyShow, onAfterFirstAttach, onAttach, onHide, onHideContextMenu, onLoad, onPosition, onRightClick, onShow, onShowContextMenu, onTouch, onUnload, onWindowResize, removeStyleDependentName, removeStyleOnOver, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setItemId, setMonitorWindowResize, setPagePosition, setPixelSize, setPosition, setShadow, setShadowPosition, setSize, setStateful, setStateId, setStyleDependentName, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBlurHandler
protected ValueBaseField(ValueBaseInputCell<T> cell)
protected ValueBaseField(ValueBaseInputCell<T> cell, PropertyEditor<T> propertyEditor)
public HandlerRegistration addChangeHandler(ChangeHandler handler)
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
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)
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 Direction getDirection()
public DirectionEstimator getDirectionEstimator()
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(Direction direction)
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)
enabled
- Whether to enable direction estimation. If true
, sets the DirectionEstimator object to a
default DirectionEstimator.public void setDirectionEstimator(DirectionEstimator directionEstimator)
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)
.text
- the textpublic void setValue(T value)
setValue
in class CellComponent<T>
value
- the parsed valuepublic boolean validateCurrent(boolean preventMark)
protected void doAutoValidate()
doAutoValidate
in class Field<T>
protected XElement getFocusEl()
getFocusEl
in class CellComponent<T>
protected TextBoxImpl getImpl()
protected XElement getInputEl()
protected void onCellParseError(ParseErrorEvent event)
Copyright © 2018. All rights reserved.