/*
* Created on Jul 15, 2004
*/
package com.realpersist.gef.model;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
/**
* Provides base class support for model objects to participate in event handling framework
* @author Phil Zoio
*/
public abstract class PropertyAwareObject extends Object implements Serializable
{
public static final String CHILD = "CHILD";
public static final String REORDER = "REORDER";
public static final String BOUNDS = "BOUNDS";
public static final String INPUT = "INPUT";
public static final String OUTPUT = "OUTPUT";
public static final String NAME = "NAME";
public static final String LAYOUT = "LAYOUT";
protected transient PropertyChangeSupport listeners = new PropertyChangeSupport(this);
protected PropertyAwareObject()
{
}
public void addPropertyChangeListener(PropertyChangeListener l)
{
listeners.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l)
{
listeners.removePropertyChangeListener(l);
}
protected void firePropertyChange(String prop, Object old, Object newValue)
{
listeners.firePropertyChange(prop, old, newValue);
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
in.defaultReadObject();
listeners = new PropertyChangeSupport(this);
}
}