edu.neu.ccs.gui
Class ZooContainer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byedu.neu.ccs.gui.DisplayPanel
                      extended byedu.neu.ccs.gui.ZooContainer
All Implemented Interfaces:
Accessible, AlertListener, Displayable, EventListener, ImageObserver, JPTConstants, MalformedDataListener, MenuContainer, Serializable, SwingConstants
Direct Known Subclasses:
Zoo, ZooGroup

public class ZooContainer
extends DisplayPanel

Abstract superclass for containers used in a Zoo.

Top-level components in a zoo container are subject to a z-ordering that affects the display of the components. Z-order is implemented in the same manner as it is for standard Java containers: in a set of n contained components, a z-order position of 0 represents the top component and a z-order position of n - 1 represents the bottom component. The z-order position of a given component is equal to the number of components relatively higher than the given component.

Within a zoo container, the top-level components are considered "child items" of the container. Components which reside in a zoo container at any level of nesting, including the top-level, are considered "items" of the container.

A zoo container has the capability of associating collections of top-level components into groups. A group may contain any number of nested groups. A group at top level has a single z-order position and is represented by a ZooGroup. When a group at top level is disassociated, its grouped components are returned to the top level where they assume the relative z-order of the group, and actual z-order positions defined by their z-order within the disassociated group.

Note that this panel assumes an AbsoluteLayout. Behavior is undefined if this panel is set to have a layout other than an AbsoluteLayout.

Since:
1.1
Version:
2.2
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class edu.neu.ccs.gui.DisplayPanel
background, codec, CODEC
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.neu.ccs.gui.Displayable
DEFAULT_VIEW_STATE, VIEW_STATE
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ZooContainer()
          Constructs a new container.
 
Method Summary
 Component addChildItem(Component c)
          Adds the given component to this container at the highest z-order position.
 Component addChildItem(Component c, int z)
          Adds the given component to this container at the given z-order position.
private  Component addChildItemImpl(Component c, int z)
          Adds the given component at the given z-order.
 int bringToFront(Component c)
          Moves the given component to the highest z-order position in this container.
 Component findChildItemAt(int x, int y)
          Returns the visible top-level component that contains the given position, null if the given position is out of bounds, or this container if there is no top-level component at the given position.
 Component findChildItemAt(Point p)
          Returns the visible top-level component that contains the given point, null if the given point is out of bounds, or this container if there is no top-level component at the given point.
 Component findItemAt(int x, int y)
          Returns the visible item that contains the given position, null if the given position is out of bounds, or this container if there is no item at the given position.
 Component findItemAt(Point p)
          Returns the visible item that contains the given point, null if the given point is out of bounds, or this container if there is no item at the given position.
private  Component findItemImpl(int x, int y, boolean recurse)
          Returns the child component at the given position, the container itself, or null as specified in the contracts for the findItemAt and findChildItemAt methods.
 Zoo getAncestorZoo()
          Returns the Zoo at the next-higher level of the containment hierarchy for this container, or null if there is no zoo at a higher level in the containment hierarchy.
 Component getChildItem(int z)
          Returns the top-level component in this container at the given z-order.
 int getChildItemCount()
          Returns the number of top-level components in this container.
 Component[] getChildItems()
          Returns an array containing all of the top-level components in this container.
 Component getItem(int index)
          Returns the component in this container at the given index in the overall collection of components contained in this container, including components that are nested within groups.
 int getItemCount()
          Returns the number of components in this container, including components that are nested within groups.
 Component[] getItems()
          Returns an array containing all of the components contained in this container, including components that are nested within groups.
 ZooContainer getParentContainer(Component c)
          Returns the parent container for the given component, or null if the given component is not an item in this container.
 Zoo getRootZoo()
          Returns the Zoo at the highest level of the containment hierarchy for this container, or null if the containment hierarchy does not include a root zoo.
 ZooGroup group(Component[] components)
          Groups the given top-level components of this container.
 int inverseGetChildItem(Component c)
          Returns the z-order position in this container of the given component, or -1 if the component is not in this container.
 int inverseGetItem(Component c)
          Returns the index at which the given component is located in the array returned by the getItems method, or -1 if the given component is not in this container.
 boolean isFocusTraversable()
          Returns whether or not the keyboard focus can traverse over the components in this container.
 boolean isManagingFocus()
          Returns whether or not this container is managing the focus for its child components.
 int moveDown(Component c)
          Moves the given component to the next deeper relative z-order position in this container.
 int moveToZOrder(Component c, int newZ)
          Moves the given component to the given z-order position in this container.
 int moveUp(Component c)
          Moves the given component to the next higher relative z-order position in this container.
 int nextDeeperInZOrder(int z)
          Returns the z-order position of the component whose bounding box is overlapped by the bounding box of the component at the given z-order position.
 int nextHigherInZOrder(int z)
          Returns the z-order position of the component whose bounding box overlaps the bounding box of the component at the given z-order position.
 void removeAllItems()
          Removes all of the components from this container.
 Component removeChildItem(Component c)
          Removes the given top-level component from this container.
 Component removeChildItem(int z)
          Removes the top-level component at the given z-order position from this container.
private  Component removeChildItemImpl(Component c)
          Removes the given component from this zoo.
 int sendToBack(Component c)
          Moves the given component to the deepest z-order position in this container.
 Component[] ungroup(ZooGroup group)
          Disassociates the components in the given group.
 
Methods inherited from class edu.neu.ccs.gui.DisplayPanel
add, add, add, add, add, addBorder, addObject, addObject, addObject, addObject, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, compoundBorder, compoundBorder, dataMalformed, emptyBorder, emptyBorder, emptyBorder, endAlert, etchBorderLowered, etchBorderLowered, etchBorderLowered, etchBorderRaised, etchBorderRaised, etchBorderRaised, frame, frame, frame, frame, frame, frame, generalDialog, generalDialog, generalDialog, generalDialog, getCodec, getDefaultViewState, getDefaultViewStates, getDisplayables, getViewState, getViewStates, lineBorder, lineBorder, lineBorder, lineBorder, makeComponent, matteBorder, matteBorder, matteBorder, matteBorder, matteBorder, matteBorder, OKCancelDialog, OKCancelDialog, OKDialog, OKDialog, refreshComponent, remove, remove, removeAll, removeBorder, reset, sandwichBorder, setCodec, setDeepBackground, setDeepBackground, setDefaultViewState, setDefaultViewStates, setEnabled, setViewState, setViewStates, startAlert, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, uniformizeHeight, uniformizeSize, uniformizeWidth, YesNoCancelDialog, YesNoCancelDialog
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZooContainer

public ZooContainer()
Constructs a new container.

Method Detail

addChildItem

public Component addChildItem(Component c)
Adds the given component to this container at the highest z-order position.

Parameters:
c - a component to be added to this container
Returns:
the added component
See Also:
addChildItem(Component, int)

addChildItem

public Component addChildItem(Component c,
                              int z)
Adds the given component to this container at the given z-order position.

Parameters:
c - a component to be added to this zoo
z - the z-order position at which to add the component, or -1 if the component is to be added at the deepest z-order position
Returns:
the added component
Throws:
ArrayIndexOutOfBoundsException - if the given z-order is invalid
See Also:
addChildItem(Component)

findItemAt

public Component findItemAt(int x,
                            int y)

Returns the visible item that contains the given position, null if the given position is out of bounds, or this container if there is no item at the given position. The item at the highest z-order is returned in the case where there is overlap in the components. Items which are not visible are ignored during the search.

The findItemAt method is different from the findChildItemAt method in that findChildItemAt only searches the top-level components in this container; if the top-level component contained the given position is a ZooGroup, findItemAt will search the group to find a nested component.

Parameters:
x - the x-coordinate of the desired component given in terms of this container's coordinate space
y - the y-coordinate of the desired component given in terms of this container's coordinate space
See Also:
findItemAt(Point), findChildItemAt(int, int), findChildItemAt(Point)

findItemAt

public Component findItemAt(Point p)

Returns the visible item that contains the given point, null if the given point is out of bounds, or this container if there is no item at the given position. The item at the highest z-order is returned in the case where there is overlap in the components. Items which are not visible are ignored during the search.

The findItemAt method is different from the findChildItemAt method in that findChildItemAt only searches the top-level components in this container; if the top-level component contained the given point is a ZooGroup, findItemAt will search the group to find a nested component.

Parameters:
p - the point location of the desired component given in terms of this container's coordinate space
Throws:
NullPointerException - if the given point is null
See Also:
findItemAt(int, int), findChildItemAt(Point), findChildItemAt(int, int)

findChildItemAt

public Component findChildItemAt(int x,
                                 int y)

Returns the visible top-level component that contains the given position, null if the given position is out of bounds, or this container if there is no top-level component at the given position. The top-level component at the highest z-order is returned in the case where there is overlap in the components. Top-level components which are not visible are ignored during the search.

The findItemAt method is different from the findChildItemAt method in that findChildItemAt only searches the top-level components in this container; if the top-level component contained the given position is a ZooGroup, findItemAt will search the group to find a nested component.

Parameters:
x - the x-coordinate of the desired component given in terms of this container's coordinate space
y - the y-coordinate of the desired component given in terms of this container's coordinate space
See Also:
findChildItemAt(Point), findItemAt(int, int), findItemAt(Point)

findChildItemAt

public Component findChildItemAt(Point p)

Returns the visible top-level component that contains the given point, null if the given point is out of bounds, or this container if there is no top-level component at the given point. The top-level component at the highest z-order is returned in the case where there is overlap in the components. Top-level components which are not visible are ignored during the search.

The findItemAt method is different from the findChildItemAt method in that findChildItemAt only searches the top-level components in this container; if the top-level component contained the given point is a ZooGroup, findItemAt will search the group to find a nested component.

Parameters:
p - the point location of the desired component given in terms of this container's coordinate space
Throws:
NullPointerException - if the given point is null
See Also:
findChildItemAt(int, int), findItemAt(Point), findItemAt(int, int)

getItem

public Component getItem(int index)
Returns the component in this container at the given index in the overall collection of components contained in this container, including components that are nested within groups. Components in the returned array are provided in the order of their z-order positions. Since grouped components exist at the same z-order, components within a nested group appear in the returned array in the order of their z-order positions within the nested group.

Parameters:
index - the index of the desired component
Throws:
ArrayIndexOutOfBoundsException - if the given index is invalid
See Also:
getChildItem(int), getItems(), getItemCount(), inverseGetItem(Component)

getItems

public Component[] getItems()
Returns an array containing all of the components contained in this container, including components that are nested within groups. Components in the returned array are provided in the order of their z-order positions. Since components in a top-level group exist at the same z-order position, such components appear in the returned array in the order of their z-order positions within the nested group.

See Also:
getChildItems(), getItem(int), getItemCount()

getItemCount

public int getItemCount()
Returns the number of components in this container, including components that are nested within groups.

See Also:
getChildItemCount(), getItem(int), getItems()

inverseGetItem

public int inverseGetItem(Component c)
Returns the index at which the given component is located in the array returned by the getItems method, or -1 if the given component is not in this container.

Parameters:
c - a component whose index is to be retrieved
See Also:
inverseGetChildItem(Component), getItem(int), getItems(), getItemCount()

getChildItem

public Component getChildItem(int z)
Returns the top-level component in this container at the given z-order.

Parameters:
z - the z-order of the desired component
Throws:
ArrayIndexOutOfBoundsException - if the given z-order is invalid
See Also:
getItem(int), getChildItems(), getChildItemCount()

getChildItems

public Component[] getChildItems()
Returns an array containing all of the top-level components in this container. Components in the returned array are provided in order of their z-order positions. Since a group may be at the top-level, the array may contain groups as well as single components.

See Also:
getItems(), getChildItem(int), getChildItemCount()

getChildItemCount

public int getChildItemCount()
Returns the number of top-level components in this container. The returned value is one greater than the z-order position of the component at the deepest z-order position.

See Also:
getItemCount(), getChildItem(int), getChildItems()

inverseGetChildItem

public int inverseGetChildItem(Component c)
Returns the z-order position in this container of the given component, or -1 if the component is not in this container.

Parameters:
c - a component or group in this zoo whose z-order is desired
See Also:
inverseGetItem(Component), getChildItem(int), getChildItems(), getChildItemCount()

getParentContainer

public ZooContainer getParentContainer(Component c)
Returns the parent container for the given component, or null if the given component is not an item in this container.

Parameters:
c - a component whose parent container is to be retrieved
See Also:
getRootZoo(), getAncestorZoo()

getRootZoo

public Zoo getRootZoo()
Returns the Zoo at the highest level of the containment hierarchy for this container, or null if the containment hierarchy does not include a root zoo. An arbitrary amount of nesting may exist between this component and its root zoo.

See Also:
getParentContainer(Component), getAncestorZoo()

getAncestorZoo

public Zoo getAncestorZoo()
Returns the Zoo at the next-higher level of the containment hierarchy for this container, or null if there is no zoo at a higher level in the containment hierarchy. An arbitrary amount of nesting may exist between this component and its ancestor zoo.

See Also:
getParentContainer(Component), getRootZoo()

removeChildItem

public Component removeChildItem(Component c)
Removes the given top-level component from this container. If the given component is not at the top level of this container, this container is not changed. If the given component is a group, the group and its contents are removed.

Parameters:
c - a component to remove from this container
Returns:
the removed component, or null if the given component is not at the top level of this container
See Also:
removeChildItem(int), removeAllItems()

removeChildItem

public Component removeChildItem(int z)
Removes the top-level component at the given z-order position from this container. If the top-level component at the given z-order position is a group, the group and its contents are removed.

Parameters:
z - the z-order position of a component to be removed from this container
Returns:
the removed component
Throws:
ArrayIndexOutOfBoundsException - if the given z-order position is out of bounds
See Also:
removeChildItem(Component), removeAllItems()

removeAllItems

public void removeAllItems()
Removes all of the components from this container.

See Also:
removeChildItem(Component), removeChildItem(int)

bringToFront

public int bringToFront(Component c)
Moves the given component to the highest z-order position in this container. If the given component is not in this container, this container is not changed.

Parameters:
c - the component to move to the front
Returns:
the z-order position of the component after the move is completed
See Also:
sendToBack(Component), moveUp(Component), moveDown(Component), moveToZOrder(Component, int), nextHigherInZOrder(int), nextDeeperInZOrder(int)

sendToBack

public int sendToBack(Component c)
Moves the given component to the deepest z-order position in this container. If the given component is not in this container, this container is not changed.

Parameters:
c - the component to send to the back
Returns:
the z-order position of the component after the move is completed
See Also:
bringToFront(Component), moveUp(Component), moveDown(Component), moveToZOrder(Component, int), nextHigherInZOrder(int), nextDeeperInZOrder(int)

moveUp

public int moveUp(Component c)
Moves the given component to the next higher relative z-order position in this container. The next higher relative z-order position may not be numerically one less than a given z-order position. If the bounding box of the given component is not overlapped by the bounding box of any other component in this container, the given component is brought to the front. If the given component is not in this container, this container is not changed.

Parameters:
c - the component to move up
Returns:
the z-order position of the component after the move is completed
See Also:
bringToFront(Component), sendToBack(Component), moveDown(Component), moveToZOrder(Component, int), nextHigherInZOrder(int), nextDeeperInZOrder(int)

moveDown

public int moveDown(Component c)
Moves the given component to the next deeper relative z-order position in this container. The next deeper relative z-order position may not be numerically one greater than a given z-order position. If the bounding box of the given component does not overlap the bounding box of any other component in this container, the given component is sent to the back. If the given component is not in this container, this container is not changed.

Parameters:
c - the component to move down
Returns:
the z-order position of the component after the move is completed
See Also:
bringToFront(Component), sendToBack(Component), moveUp(Component), moveToZOrder(Component, int), nextHigherInZOrder(int), nextDeeperInZOrder(int)

moveToZOrder

public int moveToZOrder(Component c,
                        int newZ)
Moves the given component to the given z-order position in this container. The given z-order is to be expressed in terms of the z-order of this container before the move. The resulting z-order position of the moved component may not be equal to the given z-order position after the component is moved. If the given component is not in this container, this container is not changed.

Parameters:
c - the component to move
newZ - the z-order position to which to move the component
Returns:
the z-order position of the component after the move is completed, or -1 if the component is not in this zoo
Throws:
ArrayIndexOutOfBoundsException - if the given z-order is invalid
See Also:
bringToFront(Component), sendToBack(Component), moveUp(Component), moveDown(Component), nextHigherInZOrder(int), nextDeeperInZOrder(int)

nextHigherInZOrder

public int nextHigherInZOrder(int z)
Returns the z-order position of the component whose bounding box overlaps the bounding box of the component at the given z-order position. If the bounding box of more than one component overlaps the bounding box of the component at the given z-order position, the z-order position of the overlapping component whose z-order position is closest to the given z-order position is returned.

Parameters:
z - the z-order position for which to find the next higher position
Throws:
ArrayIndexOutOfBoundsException - if the given z-order is invalid
See Also:
bringToFront(Component), sendToBack(Component), moveUp(Component), moveDown(Component), moveToZOrder(Component, int), nextDeeperInZOrder(int)

nextDeeperInZOrder

public int nextDeeperInZOrder(int z)
Returns the z-order position of the component whose bounding box is overlapped by the bounding box of the component at the given z-order position. If the bounding box of more than one component is overlapped by the bounding box of the component at the given z-order position, the z-order position of the overlapped component whose z-order position is closest to the given z-order position is returned.

Parameters:
z - the z-order position for which to find the next deepest position
Throws:
ArrayIndexOutOfBoundsException - if the given z-order is invalid
See Also:
bringToFront(Component), sendToBack(Component), moveUp(Component), moveDown(Component), moveToZOrder(Component, int), nextHigherInZOrder(int)

group

public ZooGroup group(Component[] components)
Groups the given top-level components of this container. The group will exist at the relative z-order position of the highest z-order position among the components it contains. The resulting z-order position for the group may not be equal to the actual z-order position of the highest z-order position among the components the group contains.

Parameters:
components - the components to be grouped
Returns:
the resulting group of components, or null if there were less than two components to be grouped
Throws:
NullPointerException - if the given array is null
See Also:
ungroup(ZooGroup)

ungroup

public Component[] ungroup(ZooGroup group)
Disassociates the components in the given group. If the given group is not at the top level of this container, this container is not changed. The individual components will exist at the relative z-order position of the disassociated group. The resulting z-order positions for the individual components may not be equal to the actual z-order position of the group prior to disassociation.

Parameters:
group - the group of components to disassociate
Returns:
an array containing the disassociated components or a zero-length array if the given group is not at the top level of this zoo
See Also:
group(Component[])

isFocusTraversable

public boolean isFocusTraversable()
Returns whether or not the keyboard focus can traverse over the components in this container.


isManagingFocus

public boolean isManagingFocus()
Returns whether or not this container is managing the focus for its child components.


addChildItemImpl

private Component addChildItemImpl(Component c,
                                   int z)
Adds the given component at the given z-order.

Parameters:
c - a component to be added
z - the desired z-order for the component
Throws:
ArrayIndexOutOfBoundsException - if the given z-order is invalid

findItemImpl

private Component findItemImpl(int x,
                               int y,
                               boolean recurse)
Returns the child component at the given position, the container itself, or null as specified in the contracts for the findItemAt and findChildItemAt methods.

Parameters:
x - the x-coordinate of the component to locate
y - the y-coordinate of the component to locate
recurse - whether or not to recur the search into nested containers

removeChildItemImpl

private Component removeChildItemImpl(Component c)
Removes the given component from this zoo.

Parameters:
c - a component to be removed