FileDocCategorySizeDatePackage
AbstractActionPropertyChangeListener.javaAPI DocJava SE 5 API2482Fri Aug 26 14:57:52 BST 2005javax.swing

AbstractActionPropertyChangeListener

public abstract class AbstractActionPropertyChangeListener extends Object implements PropertyChangeListener
A package-private PropertyChangeListener which listens for property changes on an Action and updates the properties of an ActionEvent source.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}.

version
1.11 12/19/03
author
Georges Saab
see
AbstractButton

Fields Summary
private static ReferenceQueue
queue
private WeakReference
target
private Action
action
Constructors Summary
AbstractActionPropertyChangeListener(JComponent c, Action a)

	super();
	setTarget(c);
	this.action = a;
    
Methods Summary
public javax.swing.ActiongetAction()

	  return action;
    
public javax.swing.JComponentgetTarget()

        return (JComponent)this.target.get();
    
public voidsetTarget(javax.swing.JComponent c)

        if (queue==null) {
	    queue = new ReferenceQueue();
	}
	// Check to see whether any old buttons have
	// been enqueued for GC.  If so, look up their
	// PCL instance and remove it from its Action.
	OwnedWeakReference r;
	while ( (r = (OwnedWeakReference)queue.poll()) != null) {
	    AbstractActionPropertyChangeListener oldPCL = 
	        (AbstractActionPropertyChangeListener)r.getOwner();
	    Action oldAction = oldPCL.getAction();
	    if (oldAction!=null) {
	        oldAction.removePropertyChangeListener(oldPCL);
	    }
	}
	this.target = new OwnedWeakReference(c, queue, this);