org.jgraph.graph

Class DefaultPort

public class DefaultPort extends DefaultGraphCell implements Port

A simple implementation for a port.
Field Summary
protected Portanchor
Reference to the anchor of this port
protected HashSetedges
Edges that are connected to the port
Constructor Summary
DefaultPort()
Constructs an empty port.
DefaultPort(Object userObject)
Constructs a port that holds a reference to the specified user object.
DefaultPort(Object userObject, Port anchor)
Constructs a port that holds a reference to the specified user object and a reference to the specified anchor.
Method Summary
booleanaddEdge(Object edge)
Adds edge to the list of edges.
Objectclone()
Create a clone of the cell.
Iteratoredges()
Returns an iterator of the edges connected to the port.
PortgetAnchor()
Returns the anchor of this port.
SetgetEdges()
Returns the collection of edges connected to this port.
booleanremoveEdge(Object edge)
Removes edge from the list of edges.
voidsetAnchor(Port port)
Sets the anchor of this port.
voidsetEdges(Set edges)
Sets the collection of edges connected to this port.

Field Detail

anchor

protected Port anchor
Reference to the anchor of this port

edges

protected HashSet edges
Edges that are connected to the port

Constructor Detail

DefaultPort

public DefaultPort()
Constructs an empty port.

DefaultPort

public DefaultPort(Object userObject)
Constructs a port 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 port that holds a reference to the specified user object and a reference to the specified anchor.

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

Method Detail

addEdge

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

clone

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

Returns: Object a clone of this object.

edges

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

getAnchor

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

getEdges

public Set getEdges()
Returns the collection of edges connected to this port.

removeEdge

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

setAnchor

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

setEdges

public void setEdges(Set edges)
Sets the collection of edges connected to this port.
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.