edu.iastate.metnet.metaomgraph
Class SimpleModalMaker

java.lang.Object
  extended by java.awt.event.WindowAdapter
      extended by edu.iastate.metnet.metaomgraph.SimpleModalMaker
All Implemented Interfaces:
java.awt.event.WindowFocusListener, java.awt.event.WindowListener, java.awt.event.WindowStateListener, java.util.EventListener

public class SimpleModalMaker
extends java.awt.event.WindowAdapter

If you make a Dialog or JDialog modal, it will block ALL frames running in the current application context. In MetaOmGraph, we want modal dialogs to block ONLY the main window. Other frames (such as the Help frame) should remain normal. This class provides a workaround for this problem. By attaching an instance of this class as a WindowListener to a Dialog/JDialog, the desired modal functionality should be achieved. Some notes: 1) If multiple dialogs each use the same instance of this class, the main window won't be re-enabled until all of the dialogs are closed. If multiple dialogs each use their own instance of this class, the main window will be re-enabled when any of the dialogs are closed. Therefore, it's best to use just one instance.

Author:
Nick Ransom

Constructor Summary
SimpleModalMaker()
           
 
Method Summary
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.awt.event.WindowAdapter
windowActivated, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowStateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleModalMaker

public SimpleModalMaker()
Method Detail

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener
Overrides:
windowOpened in class java.awt.event.WindowAdapter

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener
Overrides:
windowClosed in class java.awt.event.WindowAdapter

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener
Overrides:
windowClosing in class java.awt.event.WindowAdapter