W
- the generic typeV
- the value typepublic class ValidatorMixin<W extends com.google.gwt.user.client.ui.Widget & com.google.gwt.user.client.ui.HasValue<V> & com.google.gwt.editor.client.Editor<V>,V> extends Object implements HasValidators<V>
Modifier and Type | Field and Description |
---|---|
protected ErrorHandler |
errorHandler |
protected W |
inputWidget |
protected Set<ValidatorWrapper<V>> |
validators |
Constructor and Description |
---|
ValidatorMixin(W inputWidget,
ErrorHandler errorHandler)
Instantiates a new abstract validator mixin.
|
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addValidationChangedHandler(ValidationChangedEvent.ValidationChangedHandler handler)
Adds a validation changed handler.
|
void |
addValidator(Validator<V> validator)
Adds the validator.
|
void |
fireEvent(com.google.gwt.event.shared.GwtEvent<?> event) |
W |
getInputWidget() |
boolean |
isValidateOnBlur()
Gets the validate on blur.
|
boolean |
removeValidator(Validator<V> validator)
Removes the validator.
|
void |
reset()
Reset the form element to blank and clear error messages.
|
void |
setErrorHandler(ErrorHandler errorHandler)
Sets the error handler.
|
protected com.google.gwt.event.shared.HandlerRegistration |
setupValueChangeValidation() |
void |
setValidateOnBlur(boolean vob)
Sets the validate on blur.
|
void |
setValidators(Validator<V>... newValidators)
The validators used to validate this object.
|
boolean |
validate()
Validate the field's value using the supplied validators.
|
boolean |
validate(boolean show)
Validate the field's value using the supplied validators.
|
protected ErrorHandler errorHandler
protected W extends com.google.gwt.user.client.ui.Widget & com.google.gwt.user.client.ui.HasValue<V> & com.google.gwt.editor.client.Editor<V> inputWidget
protected Set<ValidatorWrapper<V>> validators
public ValidatorMixin(W inputWidget, ErrorHandler errorHandler)
inputWidget
- the input widgeterrorHandler
- the error handlerprotected com.google.gwt.event.shared.HandlerRegistration setupValueChangeValidation()
public com.google.gwt.event.shared.HandlerRegistration addValidationChangedHandler(ValidationChangedEvent.ValidationChangedHandler handler)
ValidationChangedEvent.HasValidationChangedHandlers
addValidationChangedHandler
in interface ValidationChangedEvent.HasValidationChangedHandlers
handler
- the handlerpublic void addValidator(Validator<V> validator)
HasValidators
addValidator
in interface HasValidators<V>
validator
- the validatorpublic void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
fireEvent
in interface com.google.gwt.event.shared.HasHandlers
public W getInputWidget()
public boolean isValidateOnBlur()
HasValidators
isValidateOnBlur
in interface HasValidators<V>
public boolean removeValidator(Validator<V> validator)
HasValidators
removeValidator
in interface HasValidators<V>
validator
- the validatorpublic void reset()
HasValidators
reset
in interface HasValidators<V>
public void setErrorHandler(ErrorHandler errorHandler)
errorHandler
- the new error handlerpublic void setValidateOnBlur(boolean vob)
HasValidators
setValidateOnBlur
in interface HasValidators<V>
vob
- the new validate on blurpublic void setValidators(Validator<V>... newValidators)
HasValidators
setValidators
in interface HasValidators<V>
newValidators
- the new validatorspublic boolean validate()
HasValidators
validate
in interface HasValidators<V>
public boolean validate(boolean show)
validate
in interface HasValidators<V>
show
- the error to the user.Copyright © 2018. All rights reserved.