Java Code Examples for javafx.beans.Observable#removeListener()

The following examples show how to use javafx.beans.Observable#removeListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultisetPropertyBase.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void invalidated(Observable observable) {
	MultisetPropertyBase<E> multisetProperty = multisetPropertyRef
			.get();
	if (multisetProperty == null) {
		observable.removeListener(this);
	} else {
		multisetProperty.markInvalid(multisetProperty.value);
	}
}
 
Example 2
Source File: SetMultimapPropertyBase.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void invalidated(Observable observable) {
	SetMultimapPropertyBase<K, V> setMultimapProperty = setMultimapPropertyRef
			.get();
	if (setMultimapProperty == null) {
		observable.removeListener(this);
	} else {
		setMultimapProperty.markInvalid(setMultimapProperty.value);
	}
}
 
Example 3
Source File: MultisetBinding.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Stops observing the dependencies for changes. The binding will no longer
 * be marked as invalid if one of the dependencies changes.
 *
 * @param dependencies
 *            The dependencies to stop observing.
 */
protected void unbind(Observable... dependencies) {
	if (this.dependencies != null) {
		for (final Observable d : dependencies) {
			if (d != null) {
				this.dependencies.remove(d);
				d.removeListener(invalidatingDependenciesObserver);
			}
		}
		if (this.dependencies.size() == 0) {
			this.dependencies = null;
		}
	}
}
 
Example 4
Source File: SetMultimapBinding.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Stops observing the dependencies for changes. The binding will no longer
 * be marked as invalid if one of the dependencies changes.
 *
 * @param dependencies
 *            The dependencies to stop observing.
 */
protected void unbind(Observable... dependencies) {
	if (this.dependencies != null) {
		for (final Observable d : dependencies) {
			if (d != null) {
				this.dependencies.remove(d);
				d.removeListener(invalidatingDependenciesObserver);
			}
		}
		if (this.dependencies.size() == 0) {
			this.dependencies = null;
		}
	}
}
 
Example 5
Source File: EventStreams.java    From ReactFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Creates an event stream that emits an impulse on every invalidation
 * of the given observable.
 */
public static EventStream<Void> invalidationsOf(Observable observable) {
    return new EventStreamBase<Void>() {
        @Override
        protected Subscription observeInputs() {
            InvalidationListener listener = obs -> emit(null);
            observable.addListener(listener);
            return () -> observable.removeListener(listener);
        }
    };
}