Hi Dean, I put the following code in my subclass of Layer:
protected WindowListener windowListener;
/** Constructor */
public MyLayer() {
/* Listener that cleans up this layer when its window is closed */
windowListener = new WindowAdapter() {
public void windowClosed ( WindowEvent e )
{
removed(null);
super.windowClosed( e );
}
};
}
/** Look at the object received in a MapHandler status message and
connect to it if necessary. */
public void findAndInit(Object someObj) {
/** register window-closing listener on openmap window */
if (someObj instanceof OpenMapFrame ) {
((OpenMapFrame) someObj).addWindowListener( windowListener );
}
}
/** Look at the object received in a MapHandler status message and
disconnect from it if necessary. */
public void findAndUndo(Object someObj) {
if (someObj instanceof OpenMapFrame ) {
((OpenMapFrame) someObj).removeWindowListener( windowListener
);
}
}
Dean H Mitchell wrote:
> Hi all-
>
> I'm fairly new to OpenMap. I was wondering if there is anyway, as a
> layer, to determine or be notified when the map is shutting down?
> There's some cleanup I need to do. I tried putting a finalize () in
> my layer class but it doesn't seem to ever be called, and I don't see
> any map events that might tell me of this event through a listener.
>
> thanks ,
> Dean.
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Mon Jun 4 10:23:32 2007
This archive was generated by hypermail 2.1.8 : Mon Jun 04 2007 - 10:23:44 EDT