001/* Interface for objects that need to be notified of hierarchy changes above them.
002
003 Copyright (c) 1997-2013 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
027 */
028package ptolemy.kernel.util;
029
030///////////////////////////////////////////////////////////////////
031//// HierarchyListener
032
033/**
034 Interface for objects that need to be notified of hierarchy changes above them.
035 Objects that implement this listener register with their container
036 and will be notified when certain significant events above them in the hierarchy
037 occur. In particular:
038 <ul>
039 <li> if the container of any object above changes;
040 <li> if any object changes from an instance to a class or vice versa; or
041 <li> if any object changes from opaque to transparent or vice versa
042      (acquires or loses a Director).
043 </ul>
044 In each case,
045 two methods will be called on the object implementing this interface:
046 first, {@link #hierarchyWillChange} is called, notifying the object that
047 the hierarchy is about to change; then {@link #hierarchyChanged} is called,
048 notifying the object that the hierarchy has changed.
049 The notified object can prevent changes by throwing an exception when
050 the first method is called.
051
052 @author Edward A. Lee
053 @version $Id$
054 @since Ptolemy II 10.0
055 @Pt.ProposedRating Yellow (eal)
056 @Pt.AcceptedRating Red (eal    )
057 */
058public interface HierarchyListener extends Nameable {
059
060    // Note: This extends Nameable to ensure that objects that implement
061    // this interface have a container that is a NamedObj (or have no
062    // container).
063
064    ///////////////////////////////////////////////////////////////////
065    ////                         public methods                    ////
066
067    /** Notify this object that the containment hierarchy above it has
068     *  changed.
069     *  @exception IllegalActionException If the change is not
070     *   acceptable.
071     */
072    public void hierarchyChanged() throws IllegalActionException;
073
074    /** Notify this object that the containment hierarchy above it will be
075     *  changed.
076     *  @exception IllegalActionException If the change is not
077     *   acceptable.
078     */
079    public void hierarchyWillChange() throws IllegalActionException;
080}