Java Code Examples for javafx.beans.Observable#addListener()
The following examples show how to use
javafx.beans.Observable#addListener() .
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: MultisetBinding.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * Start observing the given dependencies for changes. If the value of one * of the dependencies changes, the binding is marked as invalid. * * @param dependencies * The dependencies to observe. */ protected void bind(Observable... dependencies) { if ((dependencies != null) && (dependencies.length > 0)) { if (this.dependencies == null) { this.dependencies = FXCollections.observableArrayList(); } for (final Observable d : dependencies) { if (d != null) { this.dependencies.add(d); d.addListener(invalidatingDependenciesObserver); } } } }
Example 2
Source File: SetMultimapBinding.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * Start observing the given dependencies for changes. If the value of one * of the dependencies changes, the binding is marked as invalid. * * @param dependencies * The dependencies to observe. */ protected void bind(Observable... dependencies) { if ((dependencies != null) && (dependencies.length > 0)) { if (this.dependencies == null) { this.dependencies = FXCollections.observableArrayList(); } for (final Observable d : dependencies) { if (d != null) { this.dependencies.add(d); d.addListener(invalidatingDependenciesObserver); } } } }
Example 3
Source File: FX.java From FxDock with Apache License 2.0 | 5 votes |
/** adds an invalidation listener to an observable */ public static void onInvalidation(Runnable handler, boolean fireImmediately, Observable prop) { prop.addListener((src) -> handler.run()); if(fireImmediately) { handler.run(); } }
Example 4
Source File: FX.java From FxDock with Apache License 2.0 | 5 votes |
/** adds an invalidation listener to multiple observables */ public static void onInvalidation(Runnable handler, Observable ... props) { for(Observable prop: props) { prop.addListener((src) -> handler.run()); } }
Example 5
Source File: FX.java From FxDock with Apache License 2.0 | 5 votes |
/** adds an invalidation listener to multiple observables */ public static void onInvalidation(Runnable handler, boolean fireImmediately, Observable ... props) { for(Observable prop: props) { prop.addListener((src) -> handler.run()); } if(fireImmediately) { handler.run(); } }
Example 6
Source File: EventStreams.java From ReactFX with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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); } }; }
Example 7
Source File: FX.java From FxDock with Apache License 2.0 | 4 votes |
/** adds an invalidation listener to an observable */ public static void onInvalidation(Runnable handler, Observable prop) { prop.addListener((src) -> handler.run()); }