com.jgoodies.binding.beans
Class Model

java.lang.Object
  extended by com.jgoodies.common.bean.Bean
      extended by com.jgoodies.binding.beans.Model
All Implemented Interfaces:
com.jgoodies.common.bean.ObservableBean, com.jgoodies.common.bean.ObservableBean2, Serializable
Direct Known Subclasses:
AbstractValueModel, BeanAdapter, ChangeTracker, IndirectListModel, PresentationModel

public abstract class Model
extends com.jgoodies.common.bean.Bean

An abstract superclass that minimizes the effort required to provide change support for bound and constrained Bean properties. This class follows the conventions and recommendations as described in the Java Bean Specification.

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.

Version:
$Revision: 1.22 $
Author:
Karsten Lentzsch
See Also:
Model, PropertyChangeEvent, PropertyChangeListener, PropertyChangeSupport, ExtendedPropertyChangeSupport, VetoableChangeListener, VetoableChangeSupport, Serialized Form

Field Summary
 
Fields inherited from class com.jgoodies.common.bean.Bean
changeSupport
 
Constructor Summary
Model()
           
 
Method Summary
protected  PropertyChangeSupport createPropertyChangeSupport(Object bean)
          Creates and returns a PropertyChangeSupport for the given bean.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue, boolean checkIdentity)
          Support for reporting bound property changes for Object properties.
 
Methods inherited from class com.jgoodies.common.bean.Bean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, 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
 

Constructor Detail

Model

public Model()
Method Detail

createPropertyChangeSupport

protected PropertyChangeSupport createPropertyChangeSupport(Object bean)
Creates and returns a PropertyChangeSupport for the given bean. Invoked by the first call to Bean.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.

Overrides:
createPropertyChangeSupport in class com.jgoodies.common.bean.Bean
Parameters:
bean - the bean to create a change support for
Returns:
the new change support

firePropertyChange

protected final void firePropertyChange(String propertyName,
                                        Object oldValue,
                                        Object newValue,
                                        boolean checkIdentity)
Support for reporting bound property changes for Object properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

The boolean parameter specifies whether the old and new value are compared with == or equals.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value
checkIdentity - true to check differences using == false to use equals.


Copyright © 2002-2013 JGoodies Software GmbH. All Rights Reserved.