[OpenMap Users] OverviewMapHandler issue

From: Stéphane Wasserhardt <swasserhardt_at_cls.fr>
Date: Mon, 09 Oct 2006 18:57:43 +0200
Hello list !

I don't know if this happens only with the current CVS version of OpenMap, but the overview map doesn't work anymore.
In fact, it works only the first time it is used. When you close it, it is removed from the mapBean's WindowSupport listeners, and does not work anymore.
I have found the reason, but I don't know how it should be avoided...
So, the reason is the following :
In the OverviewMapHandler class, there are these two methods :

    public void componentShown(ComponentEvent e) {
       
if (sourceMap != null) {
           
sourceMap.addProjectionListener(this);
        }
    }

   
public void componentHidden(ComponentEvent e) {
       
if (sourceMap != null) {
           
sourceMap.removeProjectionListener(this);
        }
    }

So that when the overview is not displayed, it doesn"t recieve any projectionEvents. That's ok.
These methods are called by the overview's WindowSupport (class member).
Here is the code (in WindowSupport) that calls componentHidden (in OverviewMapHandler) :

        public void componentHidden(ComponentEvent e) {
        Iterator it = iterator();
       
while (it.hasNext()) {
            ((ComponentListener) it.next()).componentHidden(e);
        }

       
// We need to do this after componentHidden notifications,
        // otherwise the component never finds out it's been hidden,
        // it gets removed as a ComponentListener at cleanup.
        Component source = (Component) e.getSource();
       
if (display == source) {
            cleanUp();
        }
    }

The overview is a WindowSupport's listener, so the componentHidden call is forwarded to it.
But after the overview map is hidden, you can see that the 'cleanUp' method is also called.
During this cleanUp, the OverviewMapHandler is removed from the WindowSupport's listeners !
That is the issue !
When you open up the overview for the second time, the componentShown call on the WindowSupport is not forwarded to the overview !
So the overview cannot be restored as a projectionListener, and becomes semi-inactive : it sends the projectionChange events to the main application's mapBean, but isn't refreshed when the mapBean's projection changes !

I don't know what is the right way to avoid this behaviour. What is different from previous openMap releases ? (Or maybe this issue has always been here !)
Thanks in advance for your help !

Stephane
-- [To unsubscribe to this list send an email to "majdart_at_bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"] Received on Mon Oct 09 2006 - 13:01:54 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT