public class ListenerManager extends Object implements ICleanable
ListenerManager is used to be able to clean up listeners when they are not used anymore. A typical use
case is a component that registers some listeners to its properties. When the component isn't used anymore the
listeners needs to be removed from the properties. Otherwise it could lead to memory leaks as the garbage collector
can't delete the objects as there are still references available.
With the ListenerManager you can reduce the possibility to forget a listener because all listeners can be
removed with one single method clean().| Constructor and Description |
|---|
ListenerManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
clean()
Clean logic for a component.
|
void |
register(javafx.beans.Observable observable,
javafx.beans.InvalidationListener listener)
Register the given
InvalidationListener to the Observable . |
<T> void |
register(javafx.collections.ObservableList<T> observable,
javafx.collections.ListChangeListener<? super T> listener)
Register the given
ListChangeListener to the ObservableList. |
<T> void |
register(javafx.beans.value.ObservableValue<T> observable,
javafx.beans.value.ChangeListener<? super T> listener)
Register the given
ChangeListener to the ObservableValue. |
public <T> void register(javafx.beans.value.ObservableValue<T> observable,
javafx.beans.value.ChangeListener<? super T> listener)
ChangeListener to the ObservableValue. The listener is added to the observable
and will be added for management so it can be cleaned up with the clean() method.T - the generic type of the observable value.observable - the observable that the listener is added to.listener - the listener that is registered.public <T> void register(javafx.collections.ObservableList<T> observable,
javafx.collections.ListChangeListener<? super T> listener)
ListChangeListener to the ObservableList. The listener is added to the
observable and will be added for management so it can be cleaned up with the clean() method.T - the generic type of the observable list.observable - the observable list that the listener is added to.listener - the listener that is registered.public void register(javafx.beans.Observable observable,
javafx.beans.InvalidationListener listener)
InvalidationListener to the Observable . The listener is added to the
observable and will be added for management so it can be cleaned up with the clean() method.observable - the observable that the listener is added to.listener - the listener that is registered.public void clean()
ICleanableclean in interface ICleanableCopyright © 2015 Saxonia Systems AG. All rights reserved.