com.jgoodies.binding.beans
public abstract class Model extends AbstractBean implements Observable
Uses class ExtendedPropertyChangeSupport
,
to enable the ==
or #equals
test when
changing values.
TODO: Consider adding a method #fireChange
that invokes
#firePropertyChange
if and only if
new value != old value
. The background is, that
#firePropertyChange
must fire an event
if new value==null==old value
.
TODO: Consider renaming this class to AbstractBean. That better describes what this class is about.
Observable
,
PropertyChangeEvent
,
PropertyChangeListener
,
PropertyChangeSupport
,
ExtendedPropertyChangeSupport
,
VetoableChangeListener
,
VetoableChangeSupport
Constructor and Description |
---|
Model() |
Modifier and Type | Method and Description |
---|---|
protected java.beans.PropertyChangeSupport |
createPropertyChangeSupport(java.lang.Object bean)
Creates and returns a PropertyChangeSupport for the given bean.
|
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue,
boolean checkIdentity)
Support for reporting bound property changes for Object properties.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, removePropertyChangeListener
protected java.beans.PropertyChangeSupport createPropertyChangeSupport(java.lang.Object bean)
Observable.addPropertyChangeListener(java.beans.PropertyChangeListener)
when lazily creating the sole change support instance used throughout
this bean.
This implementation creates an extended change support that allows
to configure whether the old and new value are compared with
==
or equals
.
bean
- the bean to create a change support forprotected final void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue, boolean checkIdentity)
The boolean parameter specifies whether the old and new value are
compared with ==
or equals
.
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valuecheckIdentity
- true to check differences using ==
false to use equals
.Copyright © 2002-2010 JGoodies Karsten Lentzsch. All Rights Reserved.