|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.binding.value.support.AbstractPropertyChangePublisher
org.springframework.binding.value.support.AbstractValueModel
public abstract class AbstractValueModel
An abstract class that minimizes the effort required to implement
the ValueModel
interface. It provides convenience methods
to convert boolean, double, float, int, and long to their
corresponding Object values.
Subclasses must implement getValue()
and
setValue(Object)
to get and set the observable value.
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
|
Fields inherited from interface org.springframework.binding.value.ValueModel |
---|
VALUE_PROPERTY |
Constructor Summary | |
---|---|
AbstractValueModel()
|
Method Summary | |
---|---|
void |
addValueChangeListener(PropertyChangeListener listener)
Registers the given PropertyChangeListener with this
ValueModel. |
protected void |
fireValueChange(boolean oldValue,
boolean newValue)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireValueChange(double oldValue,
double newValue)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireValueChange(int oldValue,
int newValue)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireValueChange(long oldValue,
long newValue)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireValueChange(Object oldValue,
Object newValue)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireValueChangeEvent(Object oldValue,
Object newValue)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireValueChangeWhenStillEqual()
This method can be called when it in necessary to send a PropertyChangeEvent to any registered PropertyChangeListeners even though the encapsulated value has not changed. |
protected ValueChangeDetector |
getValueChangeDetector()
Get the installed value change detector. |
protected boolean |
hasValueChanged(Object oldValue,
Object newValue)
Delegates to configured ValueChangeDetector . |
void |
removeValueChangeListener(PropertyChangeListener listener)
Deregisters the given PropertyChangeListener from this
ValueModel. |
void |
setValueChangeDetector(ValueChangeDetector valueChangeDetector)
Set the object that will be used to detect changes between two values. |
void |
setValueSilently(Object newValue,
PropertyChangeListener listenerToSkip)
Sets a new value and if the value has changed notifies all registered value change listeners except for the specified listener to skip. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.binding.value.ValueModel |
---|
getValue, setValue |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public AbstractValueModel()
Method Detail |
---|
public final void setValueSilently(Object newValue, PropertyChangeListener listenerToSkip)
ValueModel
setValueSilently
in interface ValueModel
newValue
- the value to be setlistenerToSkip
- the PropertyChangeListener
that should
not be notified of this change (may be null
).public final void addValueChangeListener(PropertyChangeListener listener)
ValueModel
PropertyChangeListener
with this
ValueModel. The listener will be notified if the value has changed.
The PropertyChangeEvents delivered to the listener must have the name
set to "value". The latter ensures that all ValueModel implementers
behave like the AbstractValueModel subclasses.To comply with the above specification implementers can use the PropertyChangeSupport's #addPropertyChangeListener method that accepts a property name, so that listeners will be invoked only if that specific property has changed.
addValueChangeListener
in interface ValueModel
listener
- the listener to be addedaddValueChangeListener(PropertyChangeListener)
public final void removeValueChangeListener(PropertyChangeListener listener)
ValueModel
PropertyChangeListener
from this
ValueModel.
removeValueChangeListener
in interface ValueModel
listener
- the listener to be removedprotected void fireValueChangeWhenStillEqual()
protected final void fireValueChange(boolean oldValue, boolean newValue)
oldValue
- the boolean value before the changenewValue
- the boolean value after the changeprotected final void fireValueChange(int oldValue, int newValue)
oldValue
- the int value before the changenewValue
- the int value after the changeprotected final void fireValueChange(long oldValue, long newValue)
oldValue
- the long value before the changenewValue
- the long value after the changeprotected final void fireValueChange(double oldValue, double newValue)
oldValue
- the double value before the changenewValue
- the double value after the changeprotected void fireValueChange(Object oldValue, Object newValue)
oldValue
- the float value before the changenewValue
- the float value after the changeprotected boolean hasValueChanged(Object oldValue, Object newValue)
ValueChangeDetector
.
protected void fireValueChangeEvent(Object oldValue, Object newValue)
public void setValueChangeDetector(ValueChangeDetector valueChangeDetector)
valueChangeDetector
- to useprotected ValueChangeDetector getValueChangeDetector()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |