graph
Class Link

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.jgraph.graph.DefaultGraphCell
          extended by org.jgraph.graph.DefaultEdge
              extended by graph.Link
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode, org.jgraph.graph.Edge, org.jgraph.graph.GraphCell
Direct Known Subclasses:
Arrow

public class Link
extends org.jgraph.graph.DefaultEdge

A link connects two nodes and may contain a data label.

Author:
pearce
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgraph.graph.DefaultEdge
org.jgraph.graph.DefaultEdge.DefaultRouting, org.jgraph.graph.DefaultEdge.LoopRouting
 
Nested classes/interfaces inherited from interface org.jgraph.graph.Edge
org.jgraph.graph.Edge.Routing
 
Field Summary
private static long serialVersionUID
           
 
Fields inherited from class org.jgraph.graph.DefaultEdge
source, target
 
Fields inherited from class org.jgraph.graph.DefaultGraphCell
attributes
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
Link(Node source, Node target)
          Calls Link(source, target, "")
Link(Node source, Node target, java.lang.Object label)
          Creates a link between the specified nodes with the specified label.
 
Method Summary
 java.lang.Object getLabel()
          Gets the data label of this link
 Node getSourceNode()
          Gets the source node of this link.
 Node getTargetNode()
          Gets the target node of this link.
 void setLabel(java.lang.Object data)
          Sets the data label of this link.
 
Methods inherited from class org.jgraph.graph.DefaultEdge
clone, getSource, getTarget, setSource, setTarget
 
Methods inherited from class org.jgraph.graph.DefaultGraphCell
addPort, addPort, addPort, changeAttributes, getAttributes, getChildren, setAttributes
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jgraph.graph.GraphCell
changeAttributes, getAttributes, setAttributes
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Link

public Link(Node source,
            Node target,
            java.lang.Object label)
Creates a link between the specified nodes with the specified label. Note that although source and target nodes are distinguished, this is not intended to imply that the link is directed. Arrows should be used to represent directed links.

Parameters:
source - a node to be connected
target - the other node to be connected.
label - the data object labeling this node.

Link

public Link(Node source,
            Node target)
Calls Link(source, target, "")

Parameters:
source - a node to be connected
target - the other node to be connected.
Method Detail

getLabel

public java.lang.Object getLabel()
Gets the data label of this link

Returns:
the data label

setLabel

public void setLabel(java.lang.Object data)
Sets the data label of this link.

Parameters:
data - the new label of this link

getSourceNode

public Node getSourceNode()
Gets the source node of this link. For non-arrow links, this should not be construed as implying a link direction.

Returns:
the source node of this link

getTargetNode

public Node getTargetNode()
Gets the target node of this link. For non-arrow links, this should not be construed as implying a link direction.

Returns:
the target node of this link