org.gwtbootstrap3.client.ui.base.mixin
Class DefaultValidatorMixin<W extends Widget & HasValue<V> & Editor<V>,V>

java.lang.Object
  extended by org.gwtbootstrap3.client.ui.base.mixin.DefaultValidatorMixin<W,V>
Type Parameters:
W - the generic type
V - the value type
All Implemented Interfaces:
HasValidators<V>
Direct Known Subclasses:
BlankValidatorMixin

public class DefaultValidatorMixin<W extends Widget & HasValue<V> & Editor<V>,V>
extends Object
implements HasValidators<V>

Abstract validator mixin. Contains all of the validation logic.


Field Summary
protected  ErrorHandler errorHandler
           
protected  Set<ValidatorWrapper<V>> validators
           
 
Constructor Summary
DefaultValidatorMixin(W inputWidget, ErrorHandler errorHandler)
          Instantiates a new abstract validator mixin.
 
Method Summary
 void addValidator(Validator<V> validator)
          Adds the validator.
 boolean getValidateOnBlur()
          Gets the validate on blur.
 void reset()
          Reset the form element to blank and clear error messages.
 void setErrorHandler(ErrorHandler errorHandler)
          Sets the error handler.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorHandler

protected ErrorHandler errorHandler

validators

protected Set<ValidatorWrapper<V>> validators
Constructor Detail

DefaultValidatorMixin

public DefaultValidatorMixin(W inputWidget,
                             ErrorHandler errorHandler)
Instantiates a new abstract validator mixin.

Parameters:
inputWidget - the input widget
errorHandler - the error handler
Method Detail

addValidator

public void addValidator(Validator<V> validator)
Adds the validator.

Specified by:
addValidator in interface HasValidators<V>
Parameters:
validator - the validator

getValidateOnBlur

public boolean getValidateOnBlur()
Gets the validate on blur.

Specified by:
getValidateOnBlur in interface HasValidators<V>
Returns:
the validate on blur

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Sets the error handler.

Parameters:
errorHandler - the new error handler

setValidateOnBlur

public void setValidateOnBlur(boolean vob)
Sets the validate on blur.

Specified by:
setValidateOnBlur in interface HasValidators<V>
Parameters:
vob - the new validate on blur

setValidators

public void setValidators(Validator<V>... newValidators)
The validators used to validate this object.

Specified by:
setValidators in interface HasValidators<V>
Parameters:
newValidators - the new validators

validate

public boolean validate()
Validate the field's value using the supplied validators.

Specified by:
validate in interface HasValidators<V>
Returns:
true, if valid

validate

public boolean validate(boolean show)
Validate the field's value using the supplied validators.

Specified by:
validate in interface HasValidators<V>
Parameters:
show - the error to the user.
Returns:
true, if valid

reset

public void reset()
Reset the form element to blank and clear error messages.

Specified by:
reset in interface HasValidators<V>


Copyright © 2015. All rights reserved.