|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgoodies.validation.util.AbstractValidationResultModel
public abstract class AbstractValidationResultModel
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.
DefaultValidationResultModel
Field Summary |
---|
Fields inherited from interface com.jgoodies.validation.ValidationResultModel |
---|
PROPERTYNAME_ERRORS, PROPERTYNAME_MESSAGES, PROPERTYNAME_RESULT, PROPERTYNAME_SEVERITY |
Constructor Summary | |
---|---|
AbstractValidationResultModel()
|
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. |
protected void |
firePropertyChange(String propertyName,
boolean oldValue,
boolean newValue)
Support for reporting bound property changes for boolean properties. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Support for reporting bound property changes for Object properties. |
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. |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this component. |
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated with the named property. |
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. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. |
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 |
Constructor Detail |
---|
public AbstractValidationResultModel()
Method Detail |
---|
public final Severity getSeverity()
null
.
getSeverity
in interface ValidationResultModel
ValidationResultModel.hasErrors()
,
ValidationResultModel.hasMessages()
public final boolean hasErrors()
hasErrors
in interface ValidationResultModel
ValidationResultModel.getSeverity()
,
ValidationResultModel.hasMessages()
public final boolean hasMessages()
hasMessages
in interface ValidationResultModel
ValidationResultModel.getSeverity()
,
ValidationResultModel.hasErrors()
protected final void firePropertyChanges(ValidationResult oldResult, ValidationResult newResult)
oldResult
- the old validation resultnewResult
- the new validation result
NullPointerException
- if the old or new result is null
ValidationResultModel.setResult(ValidationResult)
,
ValidationResultModelContainer.setResult(ValidationResult)
public final void addPropertyChangeListener(PropertyChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
addPropertyChangeListener
in interface ValidationResultModel
listener
- the PropertyChangeListener to be addedremovePropertyChangeListener(PropertyChangeListener)
,
getPropertyChangeListeners()
,
addPropertyChangeListener(String, PropertyChangeListener)
public final void removePropertyChangeListener(PropertyChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
removePropertyChangeListener
in interface ValidationResultModel
listener
- the PropertyChangeListener to be removedaddPropertyChangeListener(PropertyChangeListener)
,
getPropertyChangeListeners()
,
removePropertyChangeListener(String, PropertyChangeListener)
public final void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Note that if this Model is inheriting a bound property, then no event will be fired in response to a change in the inherited property.
If listener is null, no exception is thrown and no action is performed.
addPropertyChangeListener
in interface ValidationResultModel
propertyName
- one of the property names listed abovelistener
- the PropertyChangeListener to be addedremovePropertyChangeListener(String, PropertyChangeListener)
,
getPropertyChangeListeners(String)
,
addPropertyChangeListener(String, PropertyChangeListener)
public final void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
removePropertyChangeListener
in interface ValidationResultModel
propertyName
- a valid property namelistener
- the PropertyChangeListener to be removedaddPropertyChangeListener(String, PropertyChangeListener)
,
getPropertyChangeListeners(String)
,
removePropertyChangeListener(PropertyChangeListener)
public final PropertyChangeListener[] getPropertyChangeListeners()
getPropertyChangeListeners
in interface ValidationResultModel
PropertyChangeListener
s
or an empty array if no property change
listeners are currently registeredaddPropertyChangeListener(PropertyChangeListener)
,
removePropertyChangeListener(PropertyChangeListener)
,
getPropertyChangeListeners(String)
,
PropertyChangeSupport.getPropertyChangeListeners()
public final PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
getPropertyChangeListeners
in interface ValidationResultModel
propertyName
- the name of the property to lookup listeners
PropertyChangeListeners
associated with
the named property or an empty array if no listeners have
been addedaddPropertyChangeListener(String, PropertyChangeListener)
,
removePropertyChangeListener(String, PropertyChangeListener)
,
getPropertyChangeListeners()
protected final void firePropertyChange(String propertyName, Object oldValue, Object newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valueprotected final void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |