Top Description Fields Constructors Methods
com.sun.javafx.beans.event

public abstract Class AbstractNotifyListener

extends Object
implements InvalidationListener
Class Inheritance
All Implemented Interfaces
javafx.beans.InvalidationListener
Known Direct Subclasses
javafx.scene.effect.EffectChangeListener
Imports
javafx.beans.InvalidationListener, .WeakInvalidationListener

A helper base class for notify listeners. It holds reference to its WeakListener wrapper.

Without this class, an observer which uses weak listeners would need to hold two references. The first to the original ChangeListener to prevent it from being garbage collected. The second to the WeakListener wrapper so it can unregister once registered listener. The second reference is eliminated by using this class.

Example:

public class Observer {
    private AbstractNotifyListener listener = new AbstractNotifyListener() {
        public void handle(Bean bean, PropertyReference property) {
            // do something
        }
    };

    public void start() {
        subject.addChangeListener(property, listener.getWeakListener());
    }

    public void stop() {
        subject.removeChangeListener(property, listener.getWeakListener());
    }
}

Field Summary

Modifier and TypeField and Description
private final WeakInvalidationListener

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public InvalidationListener
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

weakListenerback to summary
private final WeakInvalidationListener weakListener

Constructor Detail

AbstractNotifyListenerback to summary
public AbstractNotifyListener()

Method Detail

getWeakListenerback to summary
public InvalidationListener getWeakListener()