HierarchyEvent.java revision 0
2362N/A * Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2362N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * An event which indicates a change to the <code>Component</code> 0N/A * hierarchy to which a <code>Component</code> belongs. 0N/A * <li>Hierarchy Change Events (HierarchyListener) 0N/A * <li> addition of an ancestor 0N/A * <li> removal of an ancestor 0N/A * <li> hierarchy made displayable 0N/A * <li> hierarchy made undisplayable 0N/A * <li> hierarchy shown on the screen (both visible and displayable) 0N/A * <li> hierarchy hidden on the screen (either invisible or undisplayable) 0N/A * <li>Ancestor Reshape Events (HierarchyBoundsListener) 0N/A * <li> an ancestor was resized 0N/A * <li> an ancestor was moved 0N/A * Hierarchy events are provided for notification purposes ONLY. 0N/A * The AWT will automatically handle changes to the hierarchy internally so 0N/A * that GUI layout and displayability works properly regardless of whether a 0N/A * program is receiving these events or not. 0N/A * This event is generated by a Container object (such as a Panel) when the 0N/A * Container is added, removed, moved, or resized, and passed down the 0N/A * hierarchy. It is also generated by a Component object when that object's 0N/A * <code>addNotify</code>, <code>removeNotify</code>, <code>show</code>, or 0N/A * <code>hide</code> method is called. ANCESTOR_MOVED and ANCESTOR_RESIZED 0N/A * events are dispatched to every <code>HierarchyBoundsListener</code> or 0N/A * <code>HierarchyBoundsAdapter</code> object which registered to receive 0N/A * such events using the Component's <code>addHierarchyBoundsListener</code> 0N/A * method. (<code>HierarchyBoundsAdapter</code> objects implement the <code> 0N/A * HierarchyBoundsListener</code> interface.) HIERARCHY_CHANGED events are 0N/A * dispatched to every <code>HierarchyListener</code> object which registered 0N/A * to receive such events using the Component's <code>addHierarchyListener 0N/A * </code> method. Each such listener object gets this <code>HierarchyEvent 0N/A * </code> when the event occurs. 0N/A * @author David Mendenhall 0N/A * @see HierarchyListener 0N/A * @see HierarchyBoundsAdapter 0N/A * @see HierarchyBoundsListener 0N/A * Marks the first integer id for the range of hierarchy event ids. 0N/A public static final int HIERARCHY_FIRST =
1400;
// 1300 used by sun.awt.windows.ModalityEvent 0N/A * The event id indicating that modification was made to the 0N/A * entire hierarchy tree. 0N/A * The event id indicating an ancestor-Container was moved. 0N/A * The event id indicating an ancestor-Container was resized. 0N/A * Marks the last integer id for the range of ancestor event ids. 0N/A * Indicates that the <code>HIERARCHY_CHANGED</code> event 0N/A * was generated by a reparenting operation. 0N/A * Indicates that the <code>HIERARCHY_CHANGED</code> event 0N/A * was generated due to a change in the displayability 0N/A * of the hierarchy. To discern the 0N/A * current displayability of the hierarchy, call 0N/A * <code>Component.isDisplayable</code>. Displayability changes occur 0N/A * in response to explicit or implicit calls to 0N/A * <code>Component.addNotify</code> and 0N/A * <code>Component.removeNotify</code>. 0N/A * @see java.awt.Component#isDisplayable() 0N/A * @see java.awt.Component#addNotify() 0N/A * @see java.awt.Component#removeNotify() 0N/A * Indicates that the <code>HIERARCHY_CHANGED</code> event 0N/A * was generated due to a change in the showing state 0N/A * of the hierarchy. To discern the 0N/A * current showing state of the hierarchy, call 0N/A * <code>Component.isShowing</code>. Showing state changes occur 0N/A * when either the displayability or visibility of the 0N/A * hierarchy occurs. Visibility changes occur in response to explicit 0N/A * or implicit calls to <code>Component.show</code> and 0N/A * <code>Component.hide</code>. 0N/A * @see java.awt.Component#isShowing() 0N/A * @see java.awt.Component#addNotify() 0N/A * @see java.awt.Component#removeNotify() 0N/A * @see java.awt.Component#show() 0N/A * @see java.awt.Component#hide() 0N/A * Constructs an <code>HierarchyEvent</code> object to identify a 0N/A * change in the <code>Component</code> hierarchy. 0N/A * <p>Note that passing in an invalid <code>id</code> results in 0N/A * unspecified behavior. This method throws an 0N/A * <code>IllegalArgumentException</code> if <code>source</code> 0N/A * is <code>null</code>. 0N/A * @param source the <code>Component</code> object that 0N/A * originated the event 0N/A * @param id an integer indicating the type of event 0N/A * @param changed the <code>Component</code> at the top of 0N/A * the hierarchy which was changed 0N/A * @param changedParent the parent of <code>changed</code>; this 0N/A * may be the parent before or after the 0N/A * change, depending on the type of change 0N/A * @throws IllegalArgumentException if <code>source</code> is null 0N/A * Constructs an <code>HierarchyEvent</code> object to identify 0N/A * a change in the <code>Component</code> hierarchy. 0N/A * <p>Note that passing in an invalid <code>id</code> results in 0N/A * unspecified behavior. This method throws an 0N/A * <code>IllegalArgumentException</code> if <code>source</code> 0N/A * is <code>null</code>. 0N/A * @param source the <code>Component</code> object that 0N/A * originated the event 0N/A * @param id an integer indicating the type of event 0N/A * @param changed the <code>Component</code> at the top 0N/A * of the hierarchy which was changed 0N/A * @param changedParent the parent of <code>changed</code>; this 0N/A * may be the parent before or after the 0N/A * change, depending on the type of change 0N/A * @param changeFlags a bitmask which indicates the type(s) of 0N/A * <code>HIERARCHY_CHANGED</code> events 0N/A * represented in this event object 0N/A * @throws IllegalArgumentException if <code>source</code> is null * Returns the originator of the event. * @return the <code>Component</code> object that originated * the event, or <code>null</code> if the object is not a * <code>Component</code>. * Returns the Component at the top of the hierarchy which was * @return the changed Component * Returns the parent of the Component returned by <code> * getChanged()</code>. For a HIERARCHY_CHANGED event where the * change was of type PARENT_CHANGED via a call to <code> * Container.add</code>, the parent returned is the parent * after the add operation. For a HIERARCHY_CHANGED event where * the change was of type PARENT_CHANGED via a call to <code> * Container.remove</code>, the parent returned is the parent * before the remove operation. For all other events and types, * the parent returned is the parent during the operation. * @return the parent of the changed Component * Returns a bitmask which indicates the type(s) of * HIERARCHY_CHANGED events represented in this event object. * The bits have been bitwise-ored together. * @return the bitmask, or 0 if this is not an HIERARCHY_CHANGED * Returns a parameter string identifying this event. * This method is useful for event-logging and for debugging. * @return a string identifying the event and its attributes typeStr +=
"DISPLAYABILITY_CHANGED";