public abstract class Field<H extends HTMLElement<H>,W extends Field<H,W,V>,V> extends FocusableWidget<H,W> implements IsFocusable<H,W>, HasFieldChangeHandlers<W,V>
Modifier and Type | Field and Description |
---|---|
protected boolean |
readOnly |
protected boolean |
valid |
protected V |
value |
contextMenu, contextMenuHandlerRegistration, currentHeight, currentWidth, enabled, NATIVE_CONTEXT_MENU_HANDLER
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addFieldChangeHandler(FieldChangeHandler<W,V> fieldChangeHandler) |
W |
addValidator(Validator<V> validator)
Add a new validator.
|
protected void |
fireFieldChangeEvent(V previousValue)
Fire the field change event.
|
List<Validator<V>> |
getValidators()
Returns an unmodifiable list of the field's validators.
|
V |
getValue() |
boolean |
isReadOnly()
Returns the read only status of this field
|
boolean |
isValid()
Returns whether the field is currently marked as valid or not.
|
W |
removeValidator(Validator<V> validator)
Remove a validator.
|
abstract W |
reset() |
abstract W |
setReadOnly(boolean readOnly)
Sets the read only status, should be overridden by a child classes to set
the readonly flag on input fields as needed
|
abstract W |
setValue(V value) |
protected W |
setValue(V value,
boolean validate,
boolean fireEvents) |
boolean |
validate() |
boolean |
validate(boolean silently)
Validate the field value.
|
focusNext, focusPrevious
add, addActionHandler, addClassName, addDoubleActionHandler, addDoubleTapHandler, addDropTarget, addEventHandler, addEventHandler, addResizeHandler, addStyleName, addTapHandler, addTouchHoldHandler, canDropTargetAccept, cast, clear, clearBackgroundColor, clearDropTargets, clearTextColor, ensureHandlers, fireEvent, fireEvent, fireResizeEvent, getAbsoluteLeft, getAbsoluteTop, getAncestor, getChildren, getChildrenCount, getComputedStyle, getContextMenu, getContextMenuHandler, getDeepestWidget, getDragSource, getDropTargetList, getElement, getFirstChild, getId, getLastChild, getNextSibling, getNextSibling, getOffsetHeight, getOffsetWidth, getParent, getScrollLeft, getScrollTop, getStyle, hasClassName, hasFocus, insert, isAttached, isDropTarget, isEnabled, isInEventThread, onAttach, onDetach, remove, removeClassName, removeDropTarget, removeStyleName, setBackgroundColor, setClassName, setContextMenu, setDragSource, setDropTarget, setEnabled, setHeight, setHeight, setHeight, setId, setLeft, setLeftAndTop, setMaxHeight, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setMinWidth, setParent, setPixelSize, setScrollLeft, setScrollTop, setSize, setTextAlign, setTextColor, setTop, setWidth, setWidth, setWidth
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
blur, click, focus, getElement
addBlurHandler, addBlurHandler
addFocusHandler, addFocusHandler
addEventHandler, addEventHandler
cancelMeasure, cancelMutation, measureAsSoonAsPossible, mutateAsSoonAsPossible, mutateAsSoonAsPossible, scheduleMeasure, scheduleMutation
addAttachHandler
addDetachHandler
addTransitionEndHandler, addTransitionEndHandler
addMouseDownHandler, addMouseDownHandler
addMouseMoveHandler, addMouseMoveHandler
addMouseOutHandler, addMouseOutHandler
addMouseOverHandler, addMouseOverHandler
addMouseUpHandler, addMouseUpHandler
addWheelHandler, addWheelHandler
addClickHandler, addClickHandler
addDoubleClickHandler, addDoubleClickHandler
addContextMenuHandler, addContextMenuHandler
addTouchStartHandler, addTouchStartHandler
addTouchMoveHandler, addTouchMoveHandler
addTouchForceChangeHandler, addTouchForceChangeHandler
addTouchEndHandler, addTouchEndHandler
addTouchCancelHandler, addTouchCancelHandler
addTouchHoldHandler
addTapHandler
addDoubleTapHandler
addKeyDownHandler, addKeyDownHandler
addKeyUpHandler, addKeyUpHandler
addKeyPressHandler, addKeyPressHandler
addScrollHandler, addScrollHandler
addAnimationStartHandler, addAnimationStartHandler
addAnimationIterationHandler, addAnimationIterationHandler
addAnimationEndHandler, addAnimationEndHandler
addActionHandler
addDoubleActionHandler
protected V value
protected boolean valid
protected boolean readOnly
public Field(H element)
element
- the html element representing this fieldpublic W addValidator(Validator<V> validator)
validator
- public W removeValidator(Validator<V> validator)
validator
- public List<Validator<V>> getValidators()
public V getValue()
protected W setValue(V value, boolean validate, boolean fireEvents)
value
- public boolean validate()
public boolean validate(boolean silently)
silently
- if true, it will not mark the field as valid or invalid, and it
will not fire any invalid eventpublic boolean isValid()
validate
.public HandlerRegistration addFieldChangeHandler(FieldChangeHandler<W,V> fieldChangeHandler)
addFieldChangeHandler
in interface HasFieldChangeHandlers<W extends Field<H,W,V>,V>
HasFieldChangeHandlers.addFieldChangeHandler(com.xalys.xgl.events.forms.FieldChangeHandler)
public abstract W reset()
protected void fireFieldChangeEvent(V previousValue)
previousValue
- the previous valuepublic boolean isReadOnly()
public abstract W setReadOnly(boolean readOnly)
readOnly
- the read only status to setCopyright © 2018 Xalys. All rights reserved.