com.jgoodies.validation.util
Class AbstractValidationResultModel

java.lang.Object
  extended by com.jgoodies.common.bean.AbstractBean
      extended by com.jgoodies.validation.util.AbstractValidationResultModel
All Implemented Interfaces:
com.jgoodies.common.bean.ObservableBean, com.jgoodies.common.bean.ObservableBean2, ValidationResultModel, Serializable
Direct Known Subclasses:
DefaultValidationResultModel, DelayedValidationResultModel

public abstract class AbstractValidationResultModel
extends com.jgoodies.common.bean.AbstractBean
implements ValidationResultModel

An abstract class that minimizes the effort required to implement the ValidationResultModel interface. It provides a property change support behavior to add and remove methods to convert boolean, double, float, int, and long to their corresponding Object values.

Subclasses must implement getResult() and setResult(ValidationResult) to get and set the observable validation result. #getResult always returns a non-null result, #setResult accepts only non-null results.

Since:
1.0.1
Version:
$Revision: 1.11 $
Author:
Karsten Lentzsch
See Also:
DefaultValidationResultModel, Serialized Form

Field Summary
 
Fields inherited from class com.jgoodies.common.bean.AbstractBean
changeSupport
 
Fields inherited from interface com.jgoodies.validation.ValidationResultModel
PROPERTY_ERRORS, PROPERTY_MESSAGES, PROPERTY_RESULT, PROPERTY_SEVERITY, PROPERTYNAME_ERRORS, PROPERTYNAME_MESSAGES, PROPERTYNAME_RESULT, PROPERTYNAME_SEVERITY
 
Constructor Summary
AbstractValidationResultModel()
           
 
Method Summary
protected  void firePropertyChanges(ValidationResult oldResult, ValidationResult newResult)
          Notifies all registered listeners about changes of the result itself and the properties for severity, errors and messages.
 Severity getSeverity()
          Looks up and returns the severity of the validation result, one of error, warning, or null.
 boolean hasErrors()
          Checks and answers whether the validation result has errors.
 boolean hasMessages()
          Checks and answers whether the validation result has messages.
 
Methods inherited from class com.jgoodies.common.bean.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPropertyChangeSupport, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jgoodies.validation.ValidationResultModel
getResult, setResult
 
Methods inherited from interface com.jgoodies.common.bean.ObservableBean2
addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
 
Methods inherited from interface com.jgoodies.common.bean.ObservableBean
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

AbstractValidationResultModel

public AbstractValidationResultModel()
Method Detail

getSeverity

public final Severity getSeverity()
Looks up and returns the severity of the validation result, one of error, warning, or null.

Specified by:
getSeverity in interface ValidationResultModel
Returns:
the severity of the validation result
See Also:
ValidationResultModel.hasErrors(), ValidationResultModel.hasMessages()

hasErrors

public final boolean hasErrors()
Checks and answers whether the validation result has errors.

Specified by:
hasErrors in interface ValidationResultModel
Returns:
true if the validation result has errors, false otherwise
See Also:
ValidationResultModel.getSeverity(), ValidationResultModel.hasMessages()

hasMessages

public final boolean hasMessages()
Checks and answers whether the validation result has messages.

Specified by:
hasMessages in interface ValidationResultModel
Returns:
true if the validation result has messages, false otherwise
See Also:
ValidationResultModel.getSeverity(), ValidationResultModel.hasErrors()

firePropertyChanges

protected final void firePropertyChanges(ValidationResult oldResult,
                                         ValidationResult newResult)
Notifies all registered listeners about changes of the result itself and the properties for severity, errors and messages. Useful to fire all changes in a #setResult implementation.

Parameters:
oldResult - the old validation result
newResult - the new validation result
Throws:
NullPointerException - if the old or new result is null
See Also:
ValidationResultModel.setResult(ValidationResult), ValidationResultModelContainer.setResult(ValidationResult)


Copyright © 2003-2011 JGoodies Karsten Lentzsch. All Rights Reserved.