001/* A ChangeListener is an interface implemented by objects that are
002 interested in being kept informed about mutations.
003
004 Copyright (c) 1998-2013 The Regents of the University of California.
005 All rights reserved.
006 Permission is hereby granted, without written agreement and without
007 license or royalty fees, to use, copy, modify, and distribute this
008 software and its documentation for any purpose, provided that the above
009 copyright notice and the following two paragraphs appear in all copies
010 of this software.
011
012 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
013 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
014 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
015 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
016 SUCH DAMAGE.
017
018 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
019 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
020 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
021 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
022 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
023 ENHANCEMENTS, OR MODIFICATIONS.
024
025 PT_COPYRIGHT_VERSION_2
026 COPYRIGHTENDKEY
027
028 */
029package ptolemy.kernel.util;
030
031///////////////////////////////////////////////////////////////////
032//// ChangeListener
033
034/**
035 A ChangeListener is an interface implemented by objects that are
036 interested in being kept informed about changes in a model as they
037 are executed. These listeners are informed when each change is successfully
038 executed, or when an attempt to execute it results in an exception.
039
040 @author Edward A. Lee
041 @version $Id$
042 @since Ptolemy II 1.0
043 @Pt.ProposedRating Green (eal)
044 @Pt.AcceptedRating Green (neuendor)
045 @see ChangeRequest
046 */
047public interface ChangeListener {
048    ///////////////////////////////////////////////////////////////////
049    ////                         public methods                    ////
050
051    /** React to a change request has been successfully executed.
052     *  This method is called after a change request
053     *  has been executed successfully.
054     *  @param change The change that has been executed, or null if
055     *   the change was not done via a ChangeRequest.
056     */
057    public void changeExecuted(ChangeRequest change);
058
059    /** React to a change request has resulted in an exception.
060     *  This method is called after a change request was executed,
061     *  but during the execution an exception was thrown.
062     *  @param change The change that was attempted or null if
063     *   the change was not done via a ChangeRequest.
064     *  @param exception The exception that resulted.
065     */
066    public void changeFailed(ChangeRequest change, Exception exception);
067}