org.jgraph.graph
Class DefaultPort

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.jgraph.graph.DefaultGraphCell
          extended by org.jgraph.graph.DefaultPort
All Implemented Interfaces:
Serializable, Cloneable, MutableTreeNode, TreeNode, GraphCell, Port

public class DefaultPort
extends DefaultGraphCell
implements Port

A simple implementation for a port.

Version:
1.0 1/1/02
Author:
Gaudenz Alder
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgraph.graph.DefaultGraphCell
DefaultGraphCell.ValueChangeHandler
 
Field Summary
protected  Port anchor
          Reference to the anchor of this port
protected  HashSet edges
          Edges that are connected to the port
 
Fields inherited from class org.jgraph.graph.DefaultGraphCell
attributes, defaultBounds
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
DefaultPort()
          Constructs an empty port.
DefaultPort(Object userObject)
          Constructs a vertex that holds a reference to the specified user object.
DefaultPort(Object userObject, Port anchor)
          Constructs a vertex that holds a reference to the specified user object and a reference to the specified anchor.
 
Method Summary
 boolean addEdge(Object edge)
          Adds edge to the list of ports.
 Object clone()
          Create a clone of the cell.
 Iterator edges()
          Returns an iterator of the edges connected to the port.
 Port getAnchor()
          Returns the anchor of this port.
 Set getEdges()
          Returns the anchor of this port.
 boolean removeEdge(Object edge)
          Removes edge from the list of ports.
 void setAnchor(Port port)
          Sets the anchor of this port.
 void setEdges(Set edges)
          Sets the anchor of this port.
 
Methods inherited from class org.jgraph.graph.DefaultGraphCell
changeAttributes, cloneUserObject, getAttributes, getChildren, setAttributes, setUserObject
 
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, 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

edges

protected HashSet edges
Edges that are connected to the port


anchor

protected Port anchor
Reference to the anchor of this port

Constructor Detail

DefaultPort

public DefaultPort()
Constructs an empty port.


DefaultPort

public DefaultPort(Object userObject)
Constructs a vertex that holds a reference to the specified user object.

Parameters:
userObject - reference to the user object

DefaultPort

public DefaultPort(Object userObject,
                   Port anchor)
Constructs a vertex that holds a reference to the specified user object and a reference to the specified anchor.

Parameters:
userObject - reference to the user object
anchor - to a a graphcell that constitutes the anchor
Method Detail

edges

public Iterator edges()
Returns an iterator of the edges connected to the port.

Specified by:
edges in interface Port

addEdge

public boolean addEdge(Object edge)
Adds edge to the list of ports.

Specified by:
addEdge in interface Port

removeEdge

public boolean removeEdge(Object edge)
Removes edge from the list of ports.

Specified by:
removeEdge in interface Port

getEdges

public Set getEdges()
Returns the anchor of this port.


setEdges

public void setEdges(Set edges)
Sets the anchor of this port.


getAnchor

public Port getAnchor()
Returns the anchor of this port.

Specified by:
getAnchor in interface Port

setAnchor

public void setAnchor(Port port)
Sets the anchor of this port.

Specified by:
setAnchor in interface Port

clone

public Object clone()
Create a clone of the cell. The cloning of the user object is deferred to the cloneUserObject() method.

Overrides:
clone in class DefaultGraphCell
Returns:
Object a clone of this object.