WindowManager listener

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

WindowManager listener

Patrick Pirrotte
Dear list,

I'm currently writing a little plugin which should update its GUI depending
on the context i.e. on the selected image. I thought of getting the list of
open windows through WindowManager.getIDList() and attach a Listener to each
ImageWindow separately. This works fine until a new ImageWindow is created,
for which of course there is no listener attached. Basically, what I would
need is for a way to register a listener to WindowManager which would fire
an event as soon as the list of ImageWindow changes and tell me to update my
list of Listeners on the individual ImageWindows. But maybe there's another
solution? Does somebody have a clue on how to solve this problem (besides
modifying the WindowManager itself)?

By the way, this could be very useful if ImageJ is to support contextual
menus.

Many thanks,

Patrick Pirrotte
Reply | Threaded
Open this post in threaded view
|

Re: WindowManager listener

Gabriel Landini
On Thursday 13 July 2006 15:29, Patrick Pirrotte wrote:
> Basically, what
> I would need is for a way to register a listener to WindowManager which
> would fire an event as soon as the list of ImageWindow changes and tell me
> to update my list of Listeners on the individual ImageWindows. But maybe
> there's another solution? Does somebody have a clue on how to solve this
> problem (besides modifying the WindowManager itself)?

Hi Patrick,
Have you looked into the image listener?

http://rsb.info.nih.gov/ij/plugins/image-listener.html

Cheers,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: WindowManager listener

Patrick Pirrotte
Hi Gabriel,

Thanks for the tip. I was browsing through an old source tree w/o
ImageListener and I was finding it strange that ImageJ had not implemented
anything of the type. But luckily I was wrong: It works like a charm now.

Thank you,

Patrick

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Gabriel Landini
Sent: 13 July 2006 16:38
To: [hidden email]
Subject: Re: WindowManager listener


On Thursday 13 July 2006 15:29, Patrick Pirrotte wrote:
> Basically, what
> I would need is for a way to register a listener to WindowManager
> which would fire an event as soon as the list of ImageWindow changes
> and tell me to update my list of Listeners on the individual
> ImageWindows. But maybe there's another solution? Does somebody have a
> clue on how to solve this problem (besides modifying the WindowManager
> itself)?

Hi Patrick,
Have you looked into the image listener?

http://rsb.info.nih.gov/ij/plugins/image-listener.html

Cheers,

Gabriel