public abstract class Field<T> extends CellComponent<T> implements IsField<T>, HasValue<T>, HasValueChangeHandlers<T>, HasName, InvalidEvent.HasInvalidHandlers, ValidEvent.HasValidHandlers, LeafValueEditor<T>, HasEditorErrors<T>, HasEditorDelegate<T>
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledEditor.Ignore, Editor.PathDEBUG_ID_PREFIX| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addInvalidHandler(InvalidEvent.InvalidHandler handler)
Adds a
InvalidEvent.InvalidHandler handler for InvalidEvent
events. |
void |
addValidator(Validator<T> validator) |
HandlerRegistration |
addValidHandler(ValidEvent.ValidHandler handler)
Adds a
ValidEvent handler for ValidEvent
events. |
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<T> handler) |
void |
clear()
Clears the value from the field.
|
void |
clearInvalid()
Clear any invalid styles / messages for this field.
|
void |
finishEditing() |
void |
forceInvalid(String msg)
Forces the field to be invalid using the given error message.
|
FieldCell<T> |
getCell()
Get the
Cell wrapped by this widget. |
ErrorHandler |
getErrorSupport()
Returns the field's error support instance.
|
String |
getName()
Gets the widget's name.
|
boolean |
getValidateOnBlur()
Returns true if the value is validate on blur.
|
int |
getValidationDelay()
Returns the field's validation delay in milliseconds.
|
List<Validator<T>> |
getValidators()
Returns the field's validators.
|
boolean |
isAutoValidate()
Returns true if the field value is validated on each key press.
|
boolean |
isEditing() |
boolean |
isReadOnly()
Returns the read only state.
|
boolean |
isValid()
Returns whether or not the field value is currently valid.
|
boolean |
isValid(boolean preventMark)
Returns whether or not the field value is currently valid.
|
void |
markInvalid(String msg)
Marks this field as invalid.
|
void |
onBrowserEvent(Event event) |
void |
redraw()
Redraw the widget.
|
void |
removeValidator(Validator<T> validator) |
void |
reset()
Resets the current field value to the originally loaded value and clears
any validation messages.
|
void |
setAutoValidate(boolean autoValidate)
Sets whether the value is validated on each key press (defaults to false).
|
void |
setDelegate(EditorDelegate<T> delegate) |
void |
setErrorSupport(ErrorHandler error)
Sets the field's error support instance.
|
void |
setName(String name) |
void |
setOriginalValue(T value) |
void |
setReadOnly(boolean readOnly)
Sets the field's read only state.
|
void |
setValidateOnBlur(boolean validateOnBlur)
Sets whether the field should validate when it loses focus (defaults to
true).
|
void |
setValidationDelay(int validationDelay)
Sets length of time in milliseconds after user input begins until
validation is initiated (defaults to 250).
|
void |
setValue(T value,
boolean fireEvents,
boolean redraw)
Sets this object's value and optionally redraw the widget.
|
void |
showErrors(List<EditorError> errors) |
boolean |
validate()
Validates the field value.
|
boolean |
validate(boolean preventMark)
Validates the field value.
|
getKeyProvider, getValue, setValue, setValueaddBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disable, disableEvents, enable, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeHandler, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmaskaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEventsequals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetValue, setValuegetValue, setValue, setValuefireEventpublic HandlerRegistration addInvalidHandler(InvalidEvent.InvalidHandler handler)
InvalidEvent.HasInvalidHandlersInvalidEvent.InvalidHandler handler for InvalidEvent
events.addInvalidHandler in interface InvalidEvent.HasInvalidHandlershandler - the handlerpublic HandlerRegistration addValidHandler(ValidEvent.ValidHandler handler)
ValidEvent.HasValidHandlersValidEvent handler for ValidEvent
events.addValidHandler in interface ValidEvent.HasValidHandlershandler - the handlerpublic HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
addValueChangeHandler in interface HasValueChangeHandlers<T>addValueChangeHandler in class CellComponent<T>public void clear()
public void clearInvalid()
clearInvalid in interface IsField<T>public void forceInvalid(String msg)
clearInvalid() must be called to clear the error.
Also, no other validation logic will execute.msg - the error textpublic FieldCell<T> getCell()
CellComponentCell wrapped by this widget.getCell in class CellComponent<T>Cell being wrappedpublic ErrorHandler getErrorSupport()
public String getName()
public boolean getValidateOnBlur()
public int getValidationDelay()
public List<Validator<T>> getValidators()
public boolean isAutoValidate()
public boolean isReadOnly()
true if read only, otherwise falsepublic boolean isEditing()
public void finishEditing()
public boolean isValid()
public boolean isValid(boolean preventMark)
IsFieldpublic void markInvalid(String msg)
forceInvalid(String)
Calling this will also register an error in the editor, if any.msg - the validation messagepublic void onBrowserEvent(Event event)
onBrowserEvent in interface EventListeneronBrowserEvent in class CellComponent<T>public void redraw()
CellComponentredraw in class CellComponent<T>public void reset()
IsFieldpublic void setAutoValidate(boolean autoValidate)
autoValidate - true to validate on each key presspublic void setDelegate(EditorDelegate<T> delegate)
setDelegate in interface HasEditorDelegate<T>public void setErrorSupport(ErrorHandler error)
error - the error supportpublic void setOriginalValue(T value)
public void setReadOnly(boolean readOnly)
readOnly - the read only statepublic void setValidateOnBlur(boolean validateOnBlur)
validateOnBlur - true to validate on blur, otherwise falsepublic void setValidationDelay(int validationDelay)
validationDelay - the delay in millisecondspublic void setValue(T value, boolean fireEvents, boolean redraw)
CellComponentValueChangeEvent when
fireEvents is true and the new value does not equal the existing value.
Redraws the widget when redraw is true and the new value does not equal the
existing value.setValue in class CellComponent<T>value - the object's new valuefireEvents - fire events if true and value is newredraw - redraw the widget if true and value is newpublic void showErrors(List<EditorError> errors)
showErrors in interface HasEditorErrors<T>public boolean validate()
true if valid, otherwise falseCopyright © 2012. All Rights Reserved.