org.openstreetmap.josm
Class Main.MasterWindowListener
java.lang.Object
java.awt.event.WindowAdapter
org.openstreetmap.josm.Main.MasterWindowListener
- All Implemented Interfaces:
- java.awt.event.WindowFocusListener, java.awt.event.WindowListener, java.awt.event.WindowStateListener, java.util.EventListener
- Enclosing class:
- Main
protected static class Main.MasterWindowListener
- extends java.awt.event.WindowAdapter
WindowListener, that is registered on all Windows of the application.
Its purpose is to notify WindowSwitchListeners, that the user switches to
another application, e.g. a browser, or back to JOSM.
When changing from JOSM to another application and back (e.g. two times
alt+tab), the active Window within JOSM may be different.
Therefore, we need to register listeners to all (visible)
Windows in JOSM, and it does not suffice to monitor the one that was
deactivated last.
This class is only "active" on demand, i.e. when there is at least one
WindowSwitchListener registered.
Methods inherited from class java.awt.event.WindowAdapter |
windowClosed, windowClosing, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
private static Main.MasterWindowListener INSTANCE
Main.MasterWindowListener
protected Main.MasterWindowListener()
getInstance
public static Main.MasterWindowListener getInstance()
setup
public static void setup()
- Register listeners to all non-hidden windows.
Windows that are created later, will be cared for in
windowDeactivated(WindowEvent)
.
teardown
public static void teardown()
- Unregister all listeners.
windowActivated
public void windowActivated(java.awt.event.WindowEvent e)
- Specified by:
windowActivated
in interface java.awt.event.WindowListener
- Overrides:
windowActivated
in class java.awt.event.WindowAdapter
windowDeactivated
public void windowDeactivated(java.awt.event.WindowEvent e)
- Specified by:
windowDeactivated
in interface java.awt.event.WindowListener
- Overrides:
windowDeactivated
in class java.awt.event.WindowAdapter
JOSM