001/* An interface for listeners that need to be informed when a window closes.
002
003 Copyright (c) 1998-2005 The Regents of the University of California.
004 All rights reserved.
005 Permission is hereby granted, without written agreement and without
006 license or royalty fees, to use, copy, modify, and distribute this
007 software and its documentation for any purpose, provided that the above
008 copyright notice and the following two paragraphs appear in all copies
009 of this software.
010
011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
015 SUCH DAMAGE.
016
017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
022 ENHANCEMENTS, OR MODIFICATIONS.
023
024 PT_COPYRIGHT_VERSION_2
025 COPYRIGHTENDKEY
026 */
027package ptolemy.gui;
028
029import java.awt.Window;
030
031//////////////////////////////////////////////////////////////////////////
032//// CloseListener
033
034/**
035 This is an interface for listeners that need to be informed when a
036 window closes.  Note that this is a very small subset of what Java's
037 WindowListener interface does.  This class is a workaround for a bug
038 in Java's AWT, where components are not informed in any way when the
039 window that contains them is closed, even though they can have
040 registered listeners.  The listeners are never called, unless the
041 component is a top-level window. A listener that implements this
042 interface, by contrast, is informed regardless of whether it is
043 at the top level. This is used, for example, by the ComponentDialog
044 class.
045 @see ComponentDialog
046
047 @author Edward A. Lee
048 @version $Id$
049 @since Ptolemy II 1.0
050 @Pt.ProposedRating Green (eal)
051 @Pt.AcceptedRating Green (janneck)
052 */
053public interface CloseListener {
054    /** Notify that the specified window has closed.  The second argument,
055     *  if non-null, gives the name of the button that was used to close
056     *  the window.
057     *  @param window The window that closed.
058     *  @param button The name of the button that was used to close the window.
059     */
060    public void windowClosed(Window window, String button);
061}