T- The type of the short-lived object
public abstract class ALcdWeakSelectionListener<T> extends java.lang.Object implements ILcdSelectionListener
ILcdSelectionListener implementation which only keeps a
WeakReference to the object it
wants to update when selection changes are received. This avoids memory leaks, even without removing the
The class javadoc of
ALcdWeakModelListener contains an example of a weak listener,
and some rules on the usage of weak listeners.
This particular listener has two extra rules compared to the general rules of weak listeners:
|Modifier||Constructor and Description|
Creates a new
|Modifier and Type||Method and Description|
This method will be called by an
protected ALcdWeakSelectionListener(T aObjectToModify)
Creates a new
ALcdWeakSelectionListener instance which can update
when it receives events.
aObjectToModify- The object you want to modify when a
TLcdSelectionChangedEventis received. This is a short-lived object, while the listener will be attached to a long-living
public final void selectionChanged(TLcdSelectionChangedEvent aSelectionEvent)
ILcdSelectionListenerhas been registered to it, and when the selection state of some
Objecthas changed in the
This method will check whether the short-living object is still available.
If it is, this method will pass the short-living object and the event to the
If the short-living object is already garbage collected, this method will de-register the listener from the source.
aSelectionEvent- a TLcdSelectionChangedEvent detailing the changes in the selection.