Package muntjac :: Package data :: Module validatable :: Class IValidatable
[hide private]
[frames] | no frames]

Class IValidatable

source code

object --+
         |
        IValidatable

Interface for validatable objects. Defines methods to verify if the object's value is valid or not, and to add, remove and list registered validators of the object.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

See Also: IValidator

Instance Methods [hide private]
 
addValidator(self, validator)
Adds a new validator for this object.
source code
 
removeValidator(self, validator)
Removes a previously registered validator from the object.
source code
 
getValidators(self)
Lists all validators currently registered for the object.
source code
 
isValid(self)
Tests the current value of the object against all registered validators.
source code
 
validate(self)
Checks the validity of the validatable.
source code
 
isInvalidAllowed(self)
Checks the validabtable object accept invalid values.The default value is True.
source code
 
setInvalidAllowed(self, invalidValueAllowed)
Should the validabtable object accept invalid values.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

addValidator(self, validator)

source code 

Adds a new validator for this object. The validator's Validator.validate method is activated every time the object's value needs to be verified, that is, when the isValid method is called. This usually happens when the object's value changes.

Parameters:
  • validator - the new validator

removeValidator(self, validator)

source code 

Removes a previously registered validator from the object. The specified validator is removed from the object and its validate method is no longer called in isValid.

Parameters:
  • validator - the validator to remove

getValidators(self)

source code 

Lists all validators currently registered for the object. If no validators are registered, returns None.

Returns:
collection of validators or None

isValid(self)

source code 

Tests the current value of the object against all registered validators. The registered validators are iterated and for each the Validator.validate method is called. If any validator throws the InvalidValueException this method returns False.

Returns:
True if the registered validators concur that the value is valid, False otherwise

validate(self)

source code 

Checks the validity of the validatable. If the validatable is valid this method should do nothing, and if it's not valid, it should throw InvalidValueException

Raises:

setInvalidAllowed(self, invalidValueAllowed)

source code 

Should the validabtable object accept invalid values. Supporting this configuration possibility is optional. By default invalid values are allowed.

Raises:
  • NotImplementedError - if the setInvalidAllowed is not supported.