|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.neu.ccs.gui.DisplayPanel
edu.neu.ccs.gui.ZooContainer
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 .
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.ZooGroup
Note that this panel assumes an AbsoluteLayout.
Behavior is undefined if this panel is set to have a layout
other than an AbsoluteLayout.
| 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 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 javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ZooContainer()
| Method Detail |
public Component addChildItem(Component c)
c - a component to be added to this container
addChildItem(Component, int)
public Component addChildItem(Component c,
int z)
c - a component to be added to this zooz - 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
ArrayIndexOutOfBoundsException - if the given z-order is invalidaddChildItem(Component)
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
method in that findChildItemAtfindChildItemAt 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.
x - the x-coordinate of the desired component
given in terms of this container's coordinate spacey - the y-coordinate of the desired component
given in terms of this container's coordinate spacefindItemAt(Point),
findChildItemAt(int, int),
findChildItemAt(Point)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
method in that findChildItemAtfindChildItemAt 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.
p - the point location of the desired component
given in terms of this container's coordinate space
NullPointerException - if the given point is nullfindItemAt(int, int),
findChildItemAt(Point),
findChildItemAt(int, int)
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
method in that findChildItemAtfindChildItemAt 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.
x - the x-coordinate of the desired component
given in terms of this container's coordinate spacey - the y-coordinate of the desired component
given in terms of this container's coordinate spacefindChildItemAt(Point),
findItemAt(int, int),
findItemAt(Point)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
method in that findChildItemAtfindChildItemAt 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.
p - the point location of the desired component
given in terms of this container's coordinate space
NullPointerException - if the given point is nullfindChildItemAt(int, int),
findItemAt(Point),
findItemAt(int, int)public Component getItem(int index)
index - the index of the desired component
ArrayIndexOutOfBoundsException - if the given index is invalidgetChildItem(int),
getItems(),
getItemCount(),
inverseGetItem(Component)public Component[] getItems()
getChildItems(),
getItem(int),
getItemCount()public int getItemCount()
getChildItemCount(),
getItem(int),
getItems()public int inverseGetItem(Component c)
getItems method,
or -1 if the given component is not in this container.
c - a component whose index is to be retrievedinverseGetChildItem(Component),
getItem(int),
getItems(),
getItemCount()public Component getChildItem(int z)
z - the z-order of the desired component
ArrayIndexOutOfBoundsException - if the given z-order is invalidgetItem(int),
getChildItems(),
getChildItemCount()public Component[] getChildItems()
getItems(),
getChildItem(int),
getChildItemCount()public int getChildItemCount()
getItemCount(),
getChildItem(int),
getChildItems()public int inverseGetChildItem(Component c)
c - a component or group in this zoo
whose z-order is desiredinverseGetItem(Component),
getChildItem(int),
getChildItems(),
getChildItemCount()public ZooContainer getParentContainer(Component c)
null if the given component
is not an item in this container.
c - a component whose parent container
is to be retrievedgetRootZoo(),
getAncestorZoo()public Zoo getRootZoo()
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.
getParentContainer(Component),
getAncestorZoo()public Zoo getAncestorZoo()
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.
getParentContainer(Component),
getRootZoo()public Component removeChildItem(Component c)
c - a component to remove from this container
null
if the given component is not at the top level
of this containerremoveChildItem(int),
removeAllItems()public Component removeChildItem(int z)
z - the z-order position of a component
to be removed from this container
ArrayIndexOutOfBoundsException - if the given z-order position is out of boundsremoveChildItem(Component),
removeAllItems()public void removeAllItems()
removeChildItem(Component),
removeChildItem(int)public int bringToFront(Component c)
c - the component to move to the front
sendToBack(Component),
moveUp(Component),
moveDown(Component),
moveToZOrder(Component, int),
nextHigherInZOrder(int),
nextDeeperInZOrder(int)public int sendToBack(Component c)
c - the component to send to the back
bringToFront(Component),
moveUp(Component),
moveDown(Component),
moveToZOrder(Component, int),
nextHigherInZOrder(int),
nextDeeperInZOrder(int)public int moveUp(Component c)
c - the component to move up
bringToFront(Component),
sendToBack(Component),
moveDown(Component),
moveToZOrder(Component, int),
nextHigherInZOrder(int),
nextDeeperInZOrder(int)public int moveDown(Component c)
c - the component to move down
bringToFront(Component),
sendToBack(Component),
moveUp(Component),
moveToZOrder(Component, int),
nextHigherInZOrder(int),
nextDeeperInZOrder(int)
public int moveToZOrder(Component c,
int newZ)
c - the component to movenewZ - the z-order position
to which to move the component
ArrayIndexOutOfBoundsException - if the given z-order is invalidbringToFront(Component),
sendToBack(Component),
moveUp(Component),
moveDown(Component),
nextHigherInZOrder(int),
nextDeeperInZOrder(int)public int nextHigherInZOrder(int z)
z - the z-order position for which
to find the next higher position
ArrayIndexOutOfBoundsException - if the given z-order is invalidbringToFront(Component),
sendToBack(Component),
moveUp(Component),
moveDown(Component),
moveToZOrder(Component, int),
nextDeeperInZOrder(int)public int nextDeeperInZOrder(int z)
z - the z-order position for which
to find the next deepest position
ArrayIndexOutOfBoundsException - if the given z-order is invalidbringToFront(Component),
sendToBack(Component),
moveUp(Component),
moveDown(Component),
moveToZOrder(Component, int),
nextHigherInZOrder(int)public ZooGroup group(Component[] components)
components - the components to be grouped
null if there were
less than two components to be grouped
NullPointerException - if the given array is nullungroup(ZooGroup)public Component[] ungroup(ZooGroup group)
group - the group of components to disassociate
group(Component[])public boolean isFocusTraversable()
public boolean isManagingFocus()
private Component addChildItemImpl(Component c,
int z)
c - a component to be addedz - the desired z-order for the component
ArrayIndexOutOfBoundsException - if the given z-order is invalid
private Component findItemImpl(int x,
int y,
boolean recurse)
x - the x-coordinate of the component to locatey - the y-coordinate of the component to locaterecurse - whether or not to recur the search
into nested containersprivate Component removeChildItemImpl(Component c)
c - a component to be removed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||