-
Notifications
You must be signed in to change notification settings - Fork 104
ListenerManager
Manuel Mauky edited this page Jul 6, 2015
·
3 revisions
de.saxsys.mvvmfx.utils.listener.ListenerManager
This class is used for housekeeping of listeners. If you have an element which registers listeners to a long living property you have to remove the listener by hand when you want to throw the element away.
You can use the Interface ICleanable
to make your element cleanable. You should call the clean function of the element, when you remove it from the scene graph / throw it away.
public class CustomPane extends Pane implements ICleanable{
@Inject
ListenerManager cleaner;
public CustomPane(SomeLongLiving longLiving){
ChangeListener<Double> listener = new ChangeListener()...
cleaner.register(longLiving.fooProperty(),listener);
}
@Override
public void clean(){
//Kills all Listeners
cleaner.clean();
}
}