edu.umd.cs.jazz.component
Class ZLinkDecorator

java.lang.Object
  |
  +--edu.umd.cs.jazz.scenegraph.ZVisualComponent
        |
        +--edu.umd.cs.jazz.scenegraph.ZVisualComponentDecorator
              |
              +--edu.umd.cs.jazz.component.ZLinkDecorator

public class ZLinkDecorator
extends ZVisualComponentDecorator
implements ZSerializable

ZLinkDecorator is a ZVisualComponent decorator that creates a spatial hyperlink from this visual component chain to somewhere else. It can link to a ZNode, or to a specific bounds on the scenegraph. It has methods to visually show that there is a link (typically used by an application when the user mouses over the visual component), and to follow a link.

ZLinkDecorator indicates the link by simply drawing an arrowed line from the source to the destination of the link. Applications should extend this class and replace the show() method to make a different visual indication of the link.

See Also:
ZVisualComponent

Field Summary
protected static java.awt.Color boundsColor
           
protected  ZPolyline connector
           
protected  ZNode connectorNode
           
protected static int DEFAULT_CONNECTOR_WIDTH
           
protected  java.awt.geom.Rectangle2D destBounds
           
protected  ZNode destNode
           
protected static int LINK_ANIMATION_TIME
           
protected static java.awt.Color nodeColor
           
protected  float[] xp
           
protected  float[] yp
           
 
Fields inherited from class edu.umd.cs.jazz.scenegraph.ZVisualComponentDecorator
child
 
Fields inherited from class edu.umd.cs.jazz.scenegraph.ZVisualComponent
cacheVolatile, findable, findable_DEFAULT, isVolatile, localBounds, localBoundsDirty, parent, pickable, pickable_DEFAULT, selected
 
Constructor Summary
ZLinkDecorator()
          Constructs a new ZLinkDecorator
ZLinkDecorator(ZLinkDecorator link)
          Constructs a new ZLinkDecorator that is a duplicate of the reference link, i.e., a "copy constructor"
ZLinkDecorator(ZNode src)
           
 
Method Summary
 java.lang.Object clone()
          Duplicates the current ZLinkDecorator by using the copy constructor.
 ZPolyline createConnector()
           
 void follow(ZSurface surface)
           
 void hide()
           
 void remove()
          Remove this decorator from the visual component chain.
 void setDest(java.awt.geom.Rectangle2D bounds)
           
 void setDest(ZNode dest)
           
 void setDestPt(float x, float y)
           
 void setSrc(ZNode src)
           
protected  void setSrcPt(float x, float y)
           
 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 show(ZCamera camera)
           
 void updateConnectorPts()
           
 void updateConnectorWidth(ZCamera camera)
           
 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.scenegraph.ZVisualComponentDecorator
computeLocalBounds, getChild, insertAbove, paint, pick, setChild, setVisualComponent, toString
 
Methods inherited from class edu.umd.cs.jazz.scenegraph.ZVisualComponent
damage, damage, findNode, findVisualComponent, getLocalBounds, getParent, isFindable, isPickable, isSelected, isVolatile, pickBounds, select, select, setFindable, setParent, setPickable, setSelected, setVolatile, transformChanged, unselect, updateBounds, updateChildBounds, updateLocalBounds, updateVolatility
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LINK_ANIMATION_TIME

protected static final int LINK_ANIMATION_TIME

DEFAULT_CONNECTOR_WIDTH

protected static final int DEFAULT_CONNECTOR_WIDTH

nodeColor

protected static java.awt.Color nodeColor

boundsColor

protected static java.awt.Color boundsColor

destNode

protected ZNode destNode

destBounds

protected java.awt.geom.Rectangle2D destBounds

connector

protected ZPolyline connector

connectorNode

protected ZNode connectorNode

xp

protected float[] xp

yp

protected float[] yp
Constructor Detail

ZLinkDecorator

public ZLinkDecorator()
Constructs a new ZLinkDecorator

ZLinkDecorator

public ZLinkDecorator(ZNode src)

ZLinkDecorator

public ZLinkDecorator(ZLinkDecorator link)
Constructs a new ZLinkDecorator that is a duplicate of the reference link, i.e., a "copy constructor"
Parameters:
link - Reference link
Method Detail

clone

public java.lang.Object clone()
Duplicates the current ZLinkDecorator by using the copy constructor. See the copy constructor comments for complete information about what is duplicated.
Overrides:
clone in class ZVisualComponentDecorator
See Also:
ZLinkDecorator(ZLinkDecorator)

remove

public void remove()
Remove this decorator from the visual component chain.
Overrides:
remove in class ZVisualComponentDecorator

setSrc

public void setSrc(ZNode src)

setDest

public void setDest(ZNode dest)

setDest

public void setDest(java.awt.geom.Rectangle2D bounds)

updateConnectorPts

public void updateConnectorPts()

setSrcPt

protected void setSrcPt(float x,
                        float y)

setDestPt

public void setDestPt(float x,
                      float y)

updateConnectorWidth

public void updateConnectorWidth(ZCamera camera)

show

public void show(ZCamera camera)

createConnector

public ZPolyline createConnector()

hide

public void hide()

follow

public void follow(ZSurface surface)

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
Parameters:
fieldType - The fully qualified type of the field
fieldName - The name of the field
fieldValue - The value of the field
Overrides:
setState in class ZVisualComponentDecorator

writeObject

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

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
Parameters:
out - The stream that this object writes into
Overrides:
writeObjectRecurse in class ZVisualComponentDecorator