Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.binding.beans
Class Model

    java.lang.Object
      com.jgoodies.binding.beans.Model

All Implemented Interfaces:
  Observable, Serializable

Direct Known Subclasses:
  AbstractValueModel, BeanAdapter, ChangeTracker, ListHolder, ListModelHolder, PresentationModel

    public abstract class Model

extends Object
implements Observable, Serializable

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.4 $
Author:
  Karsten Lentzsch
See Also:
  `Observable`, `PropertyChangeEvent`, `PropertyChangeListener`, `PropertyChangeSupport`, `ExtendedPropertyChangeSupport`, `VetoableChangeListener`, `VetoableChangeSupport`, Serialized Form

Constructor Summary
`Model()`

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.
`void` | `addVetoableChangeListener(String propertyName, VetoableChangeListener listener)` Adds a VetoableChangeListener to the listener list for a specific property.
`void` | `addVetoableChangeListener(VetoableChangeListener listener)` Adds a VetoableChangeListener to the listener list.
`protected boolean` | `equals(Object o1, Object o2)` Checks and answers if the two objects are both `null` or equal.
`protected void` | `fireMulticastPropertyChange()` Deprecated. Replaced by `fireMultiplePropertiesChanged()`.
`protected void` | `fireMultiplePropertiesChanged()` Indicates that an arbitrary set of bound properties have changed.
`protected void` | `firePropertyChange(String propertyName, boolean oldValue, boolean newValue)` Support for reporting bound property changes for boolean properties.
`protected void` | `firePropertyChange(String propertyName, double oldValue, double newValue)` Support for reporting bound property changes for integer properties.
`protected void` | `firePropertyChange(String propertyName, float oldValue, float newValue)` Support for reporting bound property changes for integer properties.
`protected void` | `firePropertyChange(String propertyName, int oldValue, int newValue)` Support for reporting bound property changes for integer properties.
`protected void` | `firePropertyChange(String propertyName, long oldValue, long newValue)` Support for reporting bound property changes for integer properties.
`protected void` | `firePropertyChange(String propertyName, Object oldValue, Object newValue)` Support for reporting bound property changes for Object properties.
`protected void` | `firePropertyChange(String propertyName, Object oldValue, Object newValue, boolean checkIdentity)` Support for reporting bound property changes for Object properties.
`protected void` | `fireVetoableChange(String propertyName, boolean oldValue, boolean newValue)` Support for reporting changes for constrained boolean properties.
`protected void` | `fireVetoableChange(String propertyName, double oldValue, double newValue)` Support for reporting changes for constrained integer properties.
`protected void` | `fireVetoableChange(String propertyName, float oldValue, float newValue)` Support for reporting changes for constrained integer properties.
`protected void` | `fireVetoableChange(String propertyName, int oldValue, int newValue)` Support for reporting changes for constrained integer properties.
`protected void` | `fireVetoableChange(String propertyName, long oldValue, long newValue)` Support for reporting changes for constrained integer properties.
`protected void` | `fireVetoableChange(String propertyName, Object oldValue, Object newValue)` Support for reporting changes for constrained Object properties.
`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.
`VetoableChangeListener[]` | `getVetoableChangeListeners()` Returns an array of all the property change listeners registered on this component.
`VetoableChangeListener[]` | `getVetoableChangeListeners(String propertyName)` Returns an array of all the listeners which have been associated with the named property.
`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.
`void` | `removeVetoableChangeListener(String propertyName, VetoableChangeListener listener)` Removes a VetoableChangeListener from the listener list for a specific property.
`void` | `removeVetoableChangeListener(VetoableChangeListener listener)` Removes a VetoableChangeListener from the listener list.

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

### addPropertyChangeListener

    public final void addPropertyChangeListener(PropertyChangeListener listener)

  Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties of this class.

  If listener is `null`, no exception is thrown and no action is performed.

  Specified by:
    `addPropertyChangeListener` in interface `Observable`
  Parameters:
    `listener` - the PropertyChangeListener to be added
  See Also:
    `removePropertyChangeListener(PropertyChangeListener)`, `removePropertyChangeListener(String, PropertyChangeListener)`, `addPropertyChangeListener(String, PropertyChangeListener)`, `getPropertyChangeListeners()`

### removePropertyChangeListener

    public final void removePropertyChangeListener(PropertyChangeListener listener)

  Removes a PropertyChangeListener from the listener list. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class.

  If listener is `null`, no exception is thrown and no action is performed.

  Specified by:
    `removePropertyChangeListener` in interface `Observable`
  Parameters:
    `listener` - the PropertyChangeListener to be removed
  See Also:
    `addPropertyChangeListener(PropertyChangeListener)`, `addPropertyChangeListener(String, PropertyChangeListener)`, `removePropertyChangeListener(String, PropertyChangeListener)`, `getPropertyChangeListeners()`

### addPropertyChangeListener

    public final void addPropertyChangeListener(String propertyName,
                                                PropertyChangeListener listener)

  Adds a PropertyChangeListener to the listener list for a specific property. The specified property may be user-defined.

  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.

  Parameters:
    `propertyName` - one of the property names listed above
    `listener` - the PropertyChangeListener to be added
  See Also:
    `removePropertyChangeListener(String, PropertyChangeListener)`, `addPropertyChangeListener(String, PropertyChangeListener)`, `getPropertyChangeListeners(String)`

### removePropertyChangeListener

    public final void removePropertyChangeListener(String propertyName,
                                                   PropertyChangeListener listener)

  Removes a PropertyChangeListener from the listener list for a specific property. This method should be used to remove PropertyChangeListeners that were registered for a specific bound property.

  If listener is `null`, no exception is thrown and no action is performed.

  Parameters:
    `propertyName` - a valid property name
    `listener` - the PropertyChangeListener to be removed
  See Also:
    `addPropertyChangeListener(String, PropertyChangeListener)`, `removePropertyChangeListener(PropertyChangeListener)`, `getPropertyChangeListeners(String)`

### addVetoableChangeListener

    public final void addVetoableChangeListener(VetoableChangeListener listener)

  Adds a VetoableChangeListener to the listener list. The listener is registered for all bound properties of this class.

  If listener is `null`, no exception is thrown and no action is performed.

  Parameters:
    `listener` - the VetoableChangeListener to be added
  See Also:
    `removeVetoableChangeListener(String, VetoableChangeListener)`, `addVetoableChangeListener(String, VetoableChangeListener)`, `getVetoableChangeListeners()`

### removeVetoableChangeListener

    public final void removeVetoableChangeListener(VetoableChangeListener listener)

  Removes a VetoableChangeListener from the listener list. This method should be used to remove VetoableChangeListeners that were registered for all bound properties of this class.

  If listener is `null`, no exception is thrown and no action is performed.

  Parameters:
    `listener` - the VetoableChangeListener to be removed
  See Also:
    `addVetoableChangeListener(String, VetoableChangeListener)`, `removeVetoableChangeListener(String, VetoableChangeListener)`, `getVetoableChangeListeners()`

### addVetoableChangeListener

    public final void addVetoableChangeListener(String propertyName,
                                                VetoableChangeListener listener)

  Adds a VetoableChangeListener to the listener list for a specific property. The specified property may be user-defined.

  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.

  Parameters:
    `propertyName` - one of the property names listed above
    `listener` - the VetoableChangeListener to be added
  See Also:
    `removeVetoableChangeListener(String, VetoableChangeListener)`, `addVetoableChangeListener(String, VetoableChangeListener)`, `getVetoableChangeListeners(String)`

### removeVetoableChangeListener

    public final void removeVetoableChangeListener(String propertyName,
                                                   VetoableChangeListener listener)

  Removes a VetoableChangeListener from the listener list for a specific property. This method should be used to remove VetoableChangeListeners that were registered for a specific bound property.

  If listener is `null`, no exception is thrown and no action is performed.

  Parameters:
    `propertyName` - a valid property name
    `listener` - the VetoableChangeListener to be removed
  See Also:
    `addVetoableChangeListener(String, VetoableChangeListener)`, `removeVetoableChangeListener(VetoableChangeListener)`, `getVetoableChangeListeners(String)`

### getPropertyChangeListeners

    public final PropertyChangeListener[] getPropertyChangeListeners()

  Returns an array of all the property change listeners registered on this component.

  Returns:
    all of this component's `PropertyChangeListener`s or an empty array if no property change listeners are currently registered
  See Also:
    `addPropertyChangeListener(PropertyChangeListener)`, `removePropertyChangeListener(PropertyChangeListener)`, `getPropertyChangeListeners(String)`, `PropertyChangeSupport.getPropertyChangeListeners()`

### getPropertyChangeListeners

    public final PropertyChangeListener[] getPropertyChangeListeners(String propertyName)

  Returns an array of all the listeners which have been associated with the named property.

  Parameters:
    `propertyName` - the name of the property to lookup listeners
  Returns:
    all of the `PropertyChangeListeners` associated with the named property or an empty array if no listeners have been added
  See Also:
    `addPropertyChangeListener(String, PropertyChangeListener)`, `removePropertyChangeListener(String, PropertyChangeListener)`, `getPropertyChangeListeners()`

### getVetoableChangeListeners

    public final VetoableChangeListener[] getVetoableChangeListeners()

  Returns an array of all the property change listeners registered on this component.

  Returns:
    all of this component's `VetoableChangeListener`s or an empty array if no property change listeners are currently registered
  See Also:
    `addVetoableChangeListener(VetoableChangeListener)`, `removeVetoableChangeListener(VetoableChangeListener)`, `getVetoableChangeListeners(String)`, `VetoableChangeSupport.getVetoableChangeListeners()`

### getVetoableChangeListeners

    public final VetoableChangeListener[] getVetoableChangeListeners(String propertyName)

  Returns an array of all the listeners which have been associated with the named property.

  Parameters:
    `propertyName` - the name of the property to lookup listeners
  Returns:
    all of the `VetoableChangeListeners` associated with the named property or an empty array if no listeners have been added
  See Also:
    `addVetoableChangeListener(String, VetoableChangeListener)`, `removeVetoableChangeListener(String, VetoableChangeListener)`, `getVetoableChangeListeners()`

### firePropertyChange

    protected final void firePropertyChange(String propertyName,
                                            Object oldValue,
                                            Object newValue)

  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.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value

### 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 differences between the old and new value are tested using `==` 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`.

### firePropertyChange

    protected final void firePropertyChange(String propertyName,
                                            boolean oldValue,
                                            boolean newValue)

  Support for reporting bound property changes for boolean properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value

### firePropertyChange

    protected final void firePropertyChange(String propertyName,
                                            double oldValue,
                                            double newValue)

  Support for reporting bound property changes for integer properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value

### firePropertyChange

    protected final void firePropertyChange(String propertyName,
                                            float oldValue,
                                            float newValue)

  Support for reporting bound property changes for integer properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value

### firePropertyChange

    protected final void firePropertyChange(String propertyName,
                                            int oldValue,
                                            int newValue)

  Support for reporting bound property changes for integer properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value

### firePropertyChange

    protected final void firePropertyChange(String propertyName,
                                            long oldValue,
                                            long newValue)

  Support for reporting bound property changes for integer properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value

### fireMulticastPropertyChange

    protected final void fireMulticastPropertyChange()

  Deprecated. Replaced by `fireMultiplePropertiesChanged()`.

  Indicates that an arbitrary set of bound properties have changed. Sends a PropertyChangeEvent with property name, old and new value set `null` to any registered PropertyChangeListeners.

  Note: This method will be removed from the Binding version 1.2.

  See Also:
    `PropertyChangeEvent`

### fireMultiplePropertiesChanged

    protected final void fireMultiplePropertiesChanged()

  Indicates that an arbitrary set of bound properties have changed. Sends a PropertyChangeEvent with property name, old and new value set `null` to any registered PropertyChangeListeners.

  Since:
    1.0.3
  See Also:
    `PropertyChangeEvent`

### fireVetoableChange

    protected final void fireVetoableChange(String propertyName,
                                            Object oldValue,
                                            Object newValue)
                                     throws PropertyVetoException

  Support for reporting changes for constrained Object properties. This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value
  Throws:
    `PropertyVetoException` - if a constrained property change is rejected

### fireVetoableChange

    protected final void fireVetoableChange(String propertyName,
                                            boolean oldValue,
                                            boolean newValue)
                                     throws PropertyVetoException

  Support for reporting changes for constrained boolean properties. This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value
  Throws:
    `PropertyVetoException` - if a constrained property change is rejected

### fireVetoableChange

    protected final void fireVetoableChange(String propertyName,
                                            double oldValue,
                                            double newValue)
                                     throws PropertyVetoException

  Support for reporting changes for constrained integer properties. This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value
  Throws:
    `PropertyVetoException` - if a constrained property change is rejected

### fireVetoableChange

    protected final void fireVetoableChange(String propertyName,
                                            int oldValue,
                                            int newValue)
                                     throws PropertyVetoException

  Support for reporting changes for constrained integer properties. This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value
  Throws:
    `PropertyVetoException` - if a constrained property change is rejected

### fireVetoableChange

    protected final void fireVetoableChange(String propertyName,
                                            float oldValue,
                                            float newValue)
                                     throws PropertyVetoException

  Support for reporting changes for constrained integer properties. This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value
  Throws:
    `PropertyVetoException` - if a constrained property change is rejected

### fireVetoableChange

    protected final void fireVetoableChange(String propertyName,
                                            long oldValue,
                                            long newValue)
                                     throws PropertyVetoException

  Support for reporting changes for constrained integer properties. This method can be called before a constrained property will be changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners.

  Parameters:
    `propertyName` - the property whose value has changed
    `oldValue` - the property's previous value
    `newValue` - the property's new value
  Throws:
    `PropertyVetoException` - if a constrained property change is rejected

### equals

    protected final boolean equals(Object o1,
                                   Object o2)

  Checks and answers if the two objects are both `null` or equal.

  Parameters:
    `o1` - the first object to compare
    `o2` - the second object to compare
  Returns:
    boolean true if and only if both objects are `null` or equal

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2006 JGoodies Karsten Lentzsch. All Rights Reserved.