What is the difference between SequenceListener and WeakSequenceListener?

Home Forums Development What is the difference between SequenceListener and WeakSequenceListener?

  • Frederic Marion-Poll

    dear all,

    in the Icy documentation, there are 2 types of SequenceListener, one of which is called WeakSequenceListener. Is this class still relevant? I did not find it in use anywhere. The purpose of WeakListener is to be able to do a “getListener”?


    Thank you in advance for your help


    Frederic Marion-Poll

    PS more specifically, I was looking for a way to know when a viewer is displaying a different image from a sequence. I suppose I should not add a listener to the sequence, but rather to its viewer?

    Frederic Marion-Poll

    PPS problem solved by listening to the Viewer. Sorry for the previous PS. But I would still be interested to understand the difference between a plain listener and a weaklistener.

    Stephane Dallongeville

    Hi Frederic,

    Indeed when you want to have change from the viewer (Z / T position change for instance) then you need to listen the Viewer then. About Weak vs no Weak, it’s a java thing 🙂 Using a WeakListener mean that the listener won’t be retained by the object you are listening (it uses a WeakReference to the listener and automatically remove it when the reference become null). It may be useful when you want to add a listener to an object that you won’t be able to remove later (the listener), avoiding retaining your listener (and attached object) in memory.


    – Stephane

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘Development’ is closed to new topics and replies.