edu.umd.cs.jazz
Class ZAnchorGroup

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSceneGraphObject
        |
        +--edu.umd.cs.jazz.ZNode
              |
              +--edu.umd.cs.jazz.ZGroup
                    |
                    +--edu.umd.cs.jazz.ZVisualGroup
                          |
                          +--edu.umd.cs.jazz.ZAnchorGroup
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ZSerializable

public class ZAnchorGroup
extends ZVisualGroup
implements ZSerializable, java.io.Serializable

ZAnchorGroup holds the information for a spatial hyperlink. An anchor represents a hyperlink from its children to an internally specified destination. Anchors can link to either another node, or to a bounds. There is an associated event handler ZLinkEventHandler that provides interaction for specifying these links.

ZAnchorGroup indicates the link with a visual component that can be defined by extending this class and overriding createLinkComponent. By default, it creates an arrow pointing to the destination of the link.

ZSceneGraphEditor provides a convenience mechanism to locate, create and manage nodes of this type.

Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.

Author:
Benjamin B. Bederson
See Also:
ZLinkEventHandler, Serialized Form

Fields inherited from class edu.umd.cs.jazz.ZVisualGroup
visualComponentPickable_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZGroup
children, childrenFindable_DEFAULT, childrenPickable_DEFAULT, hasOneChild_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZNode
findable_DEFAULT, pickable_DEFAULT, savable_DEFAULT, selectable_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject
bounds, listenerList, volatileBounds, volatileBounds_DEFAULT
 
Constructor Summary
ZAnchorGroup()
          Constructs a new ZAnchorGroup
ZAnchorGroup(ZNode child)
          Constructs a new link group node with the specified node as a child of the new group.
 
Method Summary
 void computeBounds()
          Trap computeBounds requests as it indicates that the anchor source has changed, and the visual link needs to be updated.
protected  ZVisualComponent createLinkComponent()
          Internal method to create the visual component that represents the link.
 java.lang.String dump()
          Generate a string that represents this object for debugging.
protected  java.lang.Object duplicateObject()
          Returns a clone of this object.
 void finalize()
          Disposes of this anchor group when it is no longer used.
 void follow(ZCamera camera)
          Follow the link, animating the viewpoint in the specified camera to the link destination.
 java.awt.geom.Rectangle2D getDestBounds()
          Determine the bounds that are the destination of this link.
 ZNode getDestNode()
          Determine the node that is the destination of this link.
 boolean hasDestination()
          Determine if this ZAnchorGroup has a destination to link to.
 boolean isVisible()
          Determine if the visual depiction of this link is currently visible.
 void setDestBounds(java.awt.geom.Rectangle2D bounds, ZCamera camera)
          Set the bounds destination of this link.
 void setDestNode(ZNode node, ZCamera camera)
          Set the node destination of this link.
 void setDestPt(java.awt.geom.Point2D pt)
          Set the destination point of the link for purposes of visually indicating the link.
 void setSrcPt(java.awt.geom.Point2D pt)
          Set the source point of the link for purposes of visually indicating the link.
 void setState(java.lang.String fieldType, java.lang.String fieldName, java.lang.Object fieldValue)
          Set some state of this object as it gets read back in.
 void setVisible(boolean visible, ZCamera camera)
          Specify whether the visual depiction of this link should be visible or not.
 void updateLinkComponent(ZCamera camera)
          Update the visual component that represents the link.
protected  void updateObjectReferences(ZObjectReferenceTable objRefTable)
          Called to update internal object references after a clone operation by ZSceneGraphObject.clone().
 void writeObject(ZObjectOutputStream out)
          Write out all of this object's state.
 void writeObjectRecurse(ZObjectOutputStream out)
          Specify which objects this object references in order to write out the scenegraph properly
 
Methods inherited from class edu.umd.cs.jazz.ZVisualGroup
getBackVisualComponent, getBackVisualComponentBounds, getBackVisualComponentGlobalBounds, getFrontVisualComponent, getFrontVisualComponentBounds, getFrontVisualComponentGlobalBounds, getShallowBounds, isBackVisualComponentPickable, isFrontVisualComponentPickable, pick, render, setBackVisualComponent, setBackVisualComponentPickable, setFrontVisualComponent, setFrontVisualComponentPickable, updateVolatility
 
Methods inherited from class edu.umd.cs.jazz.ZGroup
addChild, addChildImpl, addChildren, addGroupListener, childAddedNotification, childRemovedNotification, extract, findNodes, getChild, getChildren, getChildrenFindable, getChildrenIterator, getChildrenPickable, getChildrenReference, getNumChildren, getVolatileBounds, hasOneChild, indexOf, insertAbove, iterator, lower, lowerTo, raise, raiseTo, removeAllChildren, removeChild, removeChild, removeChild, removeChildImpl, removeGroupListener, removeNodeListener, setChildrenFindable, setChildrenPickable, setHasOneChild, trimToSize, updateHasNodeListener
 
Methods inherited from class edu.umd.cs.jazz.ZNode
addClientProperty, addNodeListener, editor, getClientProperty, getGlobalBounds, getGlobalToLocalTransform, getLocalToGlobalTransform, getParent, getRoot, globalToLocal, globalToLocal, hasNodeListener, isAncestorOf, isDescendentOf, isFindable, isPickable, isSavable, isSelectable, localToGlobal, localToGlobal, lower, lowerTo, percolateEventUpSceneGraph, putClientProperty, raise, raiseTo, remove, repaint, repaint, repaint, reparent, replaceWith, setEditorFactory, setFindable, setParent, setPickable, setSavable, setSelectable, updateBounds, writeReplace
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
addMouseListener, addMouseMotionListener, clone, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getListenerList, hasLisenerOfType, hasMouseListener, processMouseEvent, removeEventListener, removeMouseListener, removeMouseMotionListener, reshape, setBounds, setVolatileBounds
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZAnchorGroup

public ZAnchorGroup()
Constructs a new ZAnchorGroup

ZAnchorGroup

public ZAnchorGroup(ZNode child)
Constructs a new link group node with the specified node as a child of the new group.
Parameters:
child - Child of the new group node.
Method Detail

duplicateObject

protected java.lang.Object duplicateObject()
Returns a clone of this object.
Overrides:
duplicateObject in class ZVisualGroup
See Also:
ZSceneGraphObject.duplicateObject()

updateObjectReferences

protected void updateObjectReferences(ZObjectReferenceTable objRefTable)
Called to update internal object references after a clone operation by ZSceneGraphObject.clone().
Overrides:
updateObjectReferences in class ZNode
See Also:
ZSceneGraphObject.updateObjectReferences(edu.umd.cs.jazz.util.ZObjectReferenceTable)

finalize

public void finalize()
Disposes of this anchor group when it is no longer used.
Overrides:
finalize in class java.lang.Object

getDestNode

public ZNode getDestNode()
Determine the node that is the destination of this link.
Returns:
The destination node, or null if none.

setDestNode

public void setDestNode(ZNode node,
                        ZCamera camera)
Set the node destination of this link. Setting the link destination to be a node clears the bounds destination if there was one.
Parameters:
node - The node that is the destination of this link.
camera - The camera the link is going to be primarily viewed within. This is used to determine the appropriate visual display of the link.
See Also:
setDestBounds(java.awt.geom.Rectangle2D, edu.umd.cs.jazz.ZCamera)

getDestBounds

public java.awt.geom.Rectangle2D getDestBounds()
Determine the bounds that are the destination of this link.
Returns:
The destination bounds, or null if none.

setDestBounds

public void setDestBounds(java.awt.geom.Rectangle2D bounds,
                          ZCamera camera)
Set the bounds destination of this link. Setting the bounds destination to be a node clears the link destination if there was one.
Parameters:
bounds - The bounds (in global coordinates) that is the destination of this link.
camera - The camera the link is going to be primarily viewed within. This is used to determine the appropriate visual display of the link.
See Also:
setDestNode(edu.umd.cs.jazz.ZNode, edu.umd.cs.jazz.ZCamera)

computeBounds

public void computeBounds()
Trap computeBounds requests as it indicates that the anchor source has changed, and the visual link needs to be updated.
Overrides:
computeBounds in class ZVisualGroup

createLinkComponent

protected ZVisualComponent createLinkComponent()
Internal method to create the visual component that represents the link. Applications can change visual representation of a selected object by extending this class, and overriding this method.
Returns:
the visual component that represents the selection.

setSrcPt

public void setSrcPt(java.awt.geom.Point2D pt)
Set the source point of the link for purposes of visually indicating the link.
Parameters:
pt - The source point in global coordinates

setDestPt

public void setDestPt(java.awt.geom.Point2D pt)
Set the destination point of the link for purposes of visually indicating the link.
Parameters:
pt - The destination point in global coordinates

updateLinkComponent

public void updateLinkComponent(ZCamera camera)
Update the visual component that represents the link. This should be called whenever any internal state has changed that the visual link depends on.
Parameters:
camera - The camera the link is going to be primarily viewed within. This is used to determine the appropriate visual display of the link.

setVisible

public void setVisible(boolean visible,
                       ZCamera camera)
Specify whether the visual depiction of this link should be visible or not.
Parameters:
visible - True if the link should be shown, or false otherwise.
camera - The camera the link is going to be primarily viewed within. This is used to determine the appropriate visual display of the link.

isVisible

public boolean isVisible()
Determine if the visual depiction of this link is currently visible.
Returns:
True if the link is visible.

follow

public void follow(ZCamera camera)
Follow the link, animating the viewpoint in the specified camera to the link destination.
Parameters:
camera - The camera to animate

dump

public java.lang.String dump()
Generate a string that represents this object for debugging.
Overrides:
dump in class ZGroup
Returns:
the string that represents this object for debugging
See Also:
ZDebug.dump(edu.umd.cs.jazz.ZNode)

writeObject

public void writeObject(ZObjectOutputStream out)
                 throws java.io.IOException
Write out all of this object's state.
Specified by:
writeObject in interface ZSerializable
Overrides:
writeObject in class ZVisualGroup
Parameters:
out - The stream that this object writes into

writeObjectRecurse

public void writeObjectRecurse(ZObjectOutputStream out)
                        throws java.io.IOException
Specify which objects this object references in order to write out the scenegraph properly
Specified by:
writeObjectRecurse in interface ZSerializable
Overrides:
writeObjectRecurse in class ZVisualGroup
Parameters:
out - The stream that this object writes into

setState

public void setState(java.lang.String fieldType,
                     java.lang.String fieldName,
                     java.lang.Object fieldValue)
Set some state of this object as it gets read back in. After the object is created with its default no-arg constructor, this method will be called on the object once for each bit of state that was written out through calls to ZObjectOutputStream.writeState() within the writeObject method.
Specified by:
setState in interface ZSerializable
Overrides:
setState in class ZVisualGroup
Parameters:
fieldType - The fully qualified type of the field
fieldName - The name of the field
fieldValue - The value of the field

hasDestination

public boolean hasDestination()
Determine if this ZAnchorGroup has a destination to link to.


Copyright © 2001 by University of Maryland, College Park, MD 20742, USA All rights reserved.