|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.globalmentor.beans.BoundPropertyObject
com.guiseframework.model.AbstractModel
com.guiseframework.model.AbstractValueModel<V>
V - The type of value contained in the model.public abstract class AbstractValueModel<V>
An abstract implementation of a model representing a value. A derived class need only implement the value access methods.
| Field Summary |
|---|
| Fields inherited from class com.globalmentor.beans.BoundPropertyObject |
|---|
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS |
| Fields inherited from interface com.guiseframework.model.ValueModel |
|---|
VALIDATOR_PROPERTY, VALUE_PROPERTY |
| Fields inherited from interface com.guiseframework.model.Model |
|---|
PLAIN_TEXT_CONTENT_TYPE, XHTML_CONTENT_TYPE, XHTML_FRAGMENT_CONTENT_TYPE |
| Constructor Summary | |
|---|---|
AbstractValueModel(java.lang.Class<V> valueClass)
Constructs a value model indicating the type of value it can hold. |
|
| Method Summary | ||
|---|---|---|
static
|
createPropertyVetoException(java.lang.Object source,
ValidationException validationException,
java.lang.String propertyName,
VV oldValue,
VV newValue)
Creates a property veto exception that represents a validation exception. |
|
Validator<V> |
getValidator()
|
|
java.lang.Class<V> |
getValueClass()
|
|
boolean |
isValidValue()
Determines whether the value of this model is valid. |
|
void |
setValidator(Validator<V> newValidator)
Sets the validator. |
|
void |
validateValue()
Validates the value of this model, throwing an exception if the model is not valid. |
|
| Methods inherited from class com.guiseframework.model.AbstractModel |
|---|
getEventListenerManager, getPlainText |
| Methods inherited from class com.globalmentor.beans.BoundPropertyObject |
|---|
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, 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.guiseframework.model.ValueModel |
|---|
clearValue, getDefaultValue, getValue, resetValue, setValue |
| Methods inherited from interface com.globalmentor.beans.PropertyBindable |
|---|
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from interface com.globalmentor.beans.PropertyConstrainable |
|---|
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener |
| Constructor Detail |
|---|
public AbstractValueModel(java.lang.Class<V> valueClass)
valueClass - The class indicating the type of value held in the model.
java.lang.NullPointerException - if the given value class is null.| Method Detail |
|---|
public Validator<V> getValidator()
getValidator in interface ValueModel<V>null if no validator is installed.public void setValidator(Validator<V> newValidator)
setValidator in interface ValueModel<V>newValidator - The validator for this model, or null if no validator should be used.ValueModel.VALIDATOR_PROPERTYpublic java.lang.Class<V> getValueClass()
getValueClass in interface ValueModel<V>public boolean isValidValue()
isValidValue in interface ValueModel<V>getValidator(),
ValueModel.getValue()
public void validateValue()
throws ValidationException
validateValue in interface ValueModel<V>ValidationException - if the value of this model is not valid.
public static <VV> java.beans.PropertyVetoException createPropertyVetoException(java.lang.Object source,
ValidationException validationException,
java.lang.String propertyName,
VV oldValue,
VV newValue)
Throwable.getCause().
This is useful for converting a validation exception into a property veto exception in ValueModel.setValue(Object) if an installed validator deems a value invalid.
VV - The type of property the change of which was vetoed because of invalidity.source - The source of the property change event.validationException - The validation exception that is the cause of the property veto.propertyName - The name of the property the change of which was vetoed.oldValue - The old value of the property.newValue - The new value of the property.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||