java.beans
Class PropertyChangeEvent

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject 
      extended by java.beans.PropertyChangeEvent
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable
Direct Known Subclasses:
IndexedPropertyChangeEvent sample code for java.beans.IndexedPropertyChangeEvent definition code for java.beans.IndexedPropertyChangeEvent

public class PropertyChangeEvent
extends EventObject sample code for java.util.EventObject definition code for java.util.EventObject

A "PropertyChange" event gets delivered whenever a bean changes a "bound" or "constrained" property. A PropertyChangeEvent object is sent as an argument to the PropertyChangeListener and VetoableChangeListener methods.

Normally PropertyChangeEvents are accompanied by the name and the old and new value of the changed property. If the new value is a primitive type (such as int or boolean) it must be wrapped as the corresponding java.lang.* Object type (such as Integer or Boolean).

Null values may be provided for the old and the new values if their true values are not known.

An event source may send a null object as the name to indicate that an arbitrary set of if its properties have changed. In this case the old and new values should also be null.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
source sample code for java.util.EventObject.source definition code for java.util.EventObject.source
 
Constructor Summary
PropertyChangeEvent sample code for java.beans.PropertyChangeEvent.PropertyChangeEvent(java.lang.Object, java.lang.String, java.lang.Object, java.lang.Object) definition code for java.beans.PropertyChangeEvent.PropertyChangeEvent(java.lang.Object, java.lang.String, java.lang.Object, java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  source, String sample code for java.lang.String definition code for java.lang.String  propertyName, Object sample code for java.lang.Object definition code for java.lang.Object  oldValue, Object sample code for java.lang.Object definition code for java.lang.Object  newValue)
          Constructs a new PropertyChangeEvent.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object getNewValue sample code for java.beans.PropertyChangeEvent.getNewValue() definition code for java.beans.PropertyChangeEvent.getNewValue() ()
          Sets the new value for the property, expressed as an Object.
 Object sample code for java.lang.Object definition code for java.lang.Object getOldValue sample code for java.beans.PropertyChangeEvent.getOldValue() definition code for java.beans.PropertyChangeEvent.getOldValue() ()
          Gets the old value for the property, expressed as an Object.
 Object sample code for java.lang.Object definition code for java.lang.Object getPropagationId sample code for java.beans.PropertyChangeEvent.getPropagationId() definition code for java.beans.PropertyChangeEvent.getPropagationId() ()
          The "propagationId" field is reserved for future use.
 String sample code for java.lang.String definition code for java.lang.String getPropertyName sample code for java.beans.PropertyChangeEvent.getPropertyName() definition code for java.beans.PropertyChangeEvent.getPropertyName() ()
          Gets the programmatic name of the property that was changed.
 void setPropagationId sample code for java.beans.PropertyChangeEvent.setPropagationId(java.lang.Object) definition code for java.beans.PropertyChangeEvent.setPropagationId(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  propagationId)
          Sets the propagationId object for the event.
 
Methods inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
getSource sample code for java.util.EventObject.getSource() definition code for java.util.EventObject.getSource() , toString sample code for java.util.EventObject.toString() definition code for java.util.EventObject.toString()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

PropertyChangeEvent sample code for java.beans.PropertyChangeEvent(java.lang.Object, java.lang.String, java.lang.Object, java.lang.Object) definition code for java.beans.PropertyChangeEvent(java.lang.Object, java.lang.String, java.lang.Object, java.lang.Object)

public PropertyChangeEvent(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                           String sample code for java.lang.String definition code for java.lang.String  propertyName,
                           Object sample code for java.lang.Object definition code for java.lang.Object  oldValue,
                           Object sample code for java.lang.Object definition code for java.lang.Object  newValue)
Constructs a new PropertyChangeEvent.

Parameters:
source - The bean that fired the event.
propertyName - The programmatic name of the property that was changed.
oldValue - The old value of the property.
newValue - The new value of the property.
Method Detail

getPropertyName sample code for java.beans.PropertyChangeEvent.getPropertyName() definition code for java.beans.PropertyChangeEvent.getPropertyName()

public String sample code for java.lang.String definition code for java.lang.String  getPropertyName()
Gets the programmatic name of the property that was changed.

Returns:
The programmatic name of the property that was changed. May be null if multiple properties have changed.

getNewValue sample code for java.beans.PropertyChangeEvent.getNewValue() definition code for java.beans.PropertyChangeEvent.getNewValue()

public Object sample code for java.lang.Object definition code for java.lang.Object  getNewValue()
Sets the new value for the property, expressed as an Object.

Returns:
The new value for the property, expressed as an Object. May be null if multiple properties have changed.

getOldValue sample code for java.beans.PropertyChangeEvent.getOldValue() definition code for java.beans.PropertyChangeEvent.getOldValue()

public Object sample code for java.lang.Object definition code for java.lang.Object  getOldValue()
Gets the old value for the property, expressed as an Object.

Returns:
The old value for the property, expressed as an Object. May be null if multiple properties have changed.

setPropagationId sample code for java.beans.PropertyChangeEvent.setPropagationId(java.lang.Object) definition code for java.beans.PropertyChangeEvent.setPropagationId(java.lang.Object)

public void setPropagationId(Object sample code for java.lang.Object definition code for java.lang.Object  propagationId)
Sets the propagationId object for the event.

Parameters:
propagationId - The propagationId object for the event.

getPropagationId sample code for java.beans.PropertyChangeEvent.getPropagationId() definition code for java.beans.PropertyChangeEvent.getPropagationId()

public Object sample code for java.lang.Object definition code for java.lang.Object  getPropagationId()
The "propagationId" field is reserved for future use. In Beans 1.0 the sole requirement is that if a listener catches a PropertyChangeEvent and then fires a PropertyChangeEvent of its own, then it should make sure that it propagates the propagationId field from its incoming event to its outgoing event.

Returns:
the propagationId object associated with a bound/constrained property update.