com.jgraph.example.panelexample
Class PortLabelCell

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.jgraph.graph.DefaultGraphCell
          extended by com.jgraph.example.panelexample.PortLabelCell
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode, org.jgraph.graph.GraphCell

public class PortLabelCell
extends org.jgraph.graph.DefaultGraphCell

Graph model cell that has a number of fixed offset ports on the left and right hand sides. It provides a number of utility methods to add and remove those ports.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
PortLabelCell()
          Default constructor
PortLabelCell(java.lang.Object userObject)
          Constructor with user object to set for cell.
 
Method Summary
 org.jgraph.graph.Port addLeftPort(int position, org.jgraph.graph.Port port, java.util.Map nestedMap, org.jgraph.graph.ParentMap parentMap)
          Adds a port to the left hand side of the vertex at the specified position order
 org.jgraph.graph.Port addLeftPort(int position, java.lang.String portLabel, java.util.Map nestedMap, org.jgraph.graph.ParentMap parentMap)
          Adds a port with the specified label to the left hand side of the vertex at the specified position order
 org.jgraph.graph.Port addRightPort(int position, org.jgraph.graph.Port port, java.util.Map nestedMap, org.jgraph.graph.ParentMap parentMap)
          Adds a port to the right hand side of the vertex at the specified position order
 org.jgraph.graph.Port addRightPort(int position, java.lang.String portLabel, java.util.Map nestedMap, org.jgraph.graph.ParentMap parentMap)
          Adds a port with the specified label to the right hand side of the vertex at the specified position order
 int getNumLeftPorts()
           
 int getNumRightPorts()
           
 void removeLeftPort(int position, java.util.Map nestedMap, org.jgraph.graph.ParentMap parentMap)
          Removes the left-hand side port at the specified position order
 void removeRightPort(int position, java.util.Map nestedMap, org.jgraph.graph.ParentMap parentMap)
          Removes the left-hand side port at the specified position order
 void setNumLeftPorts(int numLeftPorts)
           
 void setNumRightPorts(int numRightPorts)
           
 
Methods inherited from class org.jgraph.graph.DefaultGraphCell
addPort, addPort, addPort, changeAttributes, clone, 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, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PortLabelCell

public PortLabelCell()
Default constructor


PortLabelCell

public PortLabelCell(java.lang.Object userObject)
Constructor with user object to set for cell. Whatever the user object returns with toString will appear in the vertex label.

Parameters:
userObject - the userObject to set
Method Detail

addLeftPort

public org.jgraph.graph.Port addLeftPort(int position,
                                         java.lang.String portLabel,
                                         java.util.Map nestedMap,
                                         org.jgraph.graph.ParentMap parentMap)
Adds a port with the specified label to the left hand side of the vertex at the specified position order

Parameters:
position - this ports position in the order of port from top to bottom
portLabel - the label to set for this port
Returns:
the new Port created

addLeftPort

public org.jgraph.graph.Port addLeftPort(int position,
                                         org.jgraph.graph.Port port,
                                         java.util.Map nestedMap,
                                         org.jgraph.graph.ParentMap parentMap)
Adds a port to the left hand side of the vertex at the specified position order

Parameters:
position - this ports position in the order of port from top to bottom
port - the instance of the new port
Returns:
the the port

addRightPort

public org.jgraph.graph.Port addRightPort(int position,
                                          java.lang.String portLabel,
                                          java.util.Map nestedMap,
                                          org.jgraph.graph.ParentMap parentMap)
Adds a port with the specified label to the right hand side of the vertex at the specified position order

Parameters:
position - this ports position in the order of port from top to bottom
portLabel - the label to set for this port
Returns:
the new Port created

addRightPort

public org.jgraph.graph.Port addRightPort(int position,
                                          org.jgraph.graph.Port port,
                                          java.util.Map nestedMap,
                                          org.jgraph.graph.ParentMap parentMap)
Adds a port to the right hand side of the vertex at the specified position order

Parameters:
position - this ports position in the order of port from top to bottom
port - the instance of the new port
Returns:
the the port

removeLeftPort

public void removeLeftPort(int position,
                           java.util.Map nestedMap,
                           org.jgraph.graph.ParentMap parentMap)
Removes the left-hand side port at the specified position order

Parameters:
position - the position order of the port to be removed

removeRightPort

public void removeRightPort(int position,
                            java.util.Map nestedMap,
                            org.jgraph.graph.ParentMap parentMap)
Removes the left-hand side port at the specified position order

Parameters:
position - the position order of the port to be removed

getNumLeftPorts

public int getNumLeftPorts()
Returns:
Returns the numLeftPorts.

setNumLeftPorts

public void setNumLeftPorts(int numLeftPorts)
Parameters:
numLeftPorts - The numLeftPorts to set.

getNumRightPorts

public int getNumRightPorts()
Returns:
Returns the numRightPorts.

setNumRightPorts

public void setNumRightPorts(int numRightPorts)
Parameters:
numRightPorts - The numRightPorts to set.