|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tigris.gef.graph.MutableGraphSupport
public abstract class MutableGraphSupport
An abstract class that makes it easier to implement your own version of MutableGraphModel. This class basically includes the code for event notifications, so that you don't have to write that. It also provides a few utility methods.
Constructor Summary | |
---|---|
MutableGraphSupport()
|
|
MutableGraphSupport(ConnectionConstrainer cc)
|
Method Summary | |
---|---|
void |
addEdge(java.lang.Object edge)
Add the given edge to the graph, if valid. |
void |
addGraphEventListener(GraphListener listener)
|
void |
addNode(java.lang.Object node)
Add the given node to the graph, if valid. |
boolean |
canChangeConnectedNode(java.lang.Object newNode,
java.lang.Object oldNode,
java.lang.Object edge)
Return true if the connection to the old node can be rerouted to the new node. |
boolean |
canConnect(java.lang.Object fromPort,
java.lang.Object toPort,
java.lang.Class edgeClass)
Determine if the two given ports can be connected by the given kind of edge. |
boolean |
canConnect(java.lang.Object fromPort,
java.lang.Object toPort,
java.lang.Object edgeType)
Determine if the two given ports can be connected by the given kind of edge. |
boolean |
canDragNode(java.lang.Object node)
Return true if the type of the given node can be mapped to a type supported by this type of diagram |
void |
changeConnectedNode(java.lang.Object newNode,
java.lang.Object oldNode,
java.lang.Object edge,
boolean isSource)
Reroutes the connection to the old node to be connected to the new node. |
java.lang.Object |
connect(java.lang.Object fromPort,
java.lang.Object toPort,
java.lang.Object edgeClass)
Contruct and add a new edge of the given kind. |
java.lang.Object |
connect(java.lang.Object fromPort,
java.lang.Object toPort,
java.lang.Object edgeType,
java.util.Map styleAttributes)
Construct and add a new edge of the given kind and connect the given ports. |
boolean |
containsEdge(java.lang.Object edge)
Return true if the given object is present as a edge in the graph |
boolean |
containsEdgePort(java.lang.Object port)
|
boolean |
containsNode(java.lang.Object node)
Return true if the given object is present as a node in the graph |
boolean |
containsNodePort(java.lang.Object port)
|
boolean |
containsPort(java.lang.Object port)
|
java.lang.Object |
createNode(java.lang.String name,
java.util.Hashtable args)
Return a valid node in this graph TODO Should throw a GraphModelException or InvalidArgumentException |
void |
dragNode(java.lang.Object node)
Create a new node based on the given one and add it to the graph. |
void |
fireEdgeAdded(java.lang.Object edge)
|
void |
fireEdgeRemoved(java.lang.Object edge)
|
void |
fireGraphChanged()
|
void |
fireNodeAdded(java.lang.Object node)
|
void |
fireNodeRemoved(java.lang.Object node)
|
protected ConnectionConstrainer |
getConnectionConstrainer()
|
java.util.List |
getGraphListeners()
|
boolean |
isEnclosable(java.lang.Object handle,
java.lang.Object encloser)
Returns true if handle can be enclosed into encloser. |
void |
removeAll()
Remove all nodes and edges to reset the graph. |
void |
removeAllEdges()
Remove all the edges from the graph. |
void |
removeAllNodes()
Remove all the nodes from the graph. |
void |
removeEdge(java.lang.Object edge)
Remove the given edge from the graph. |
void |
removeFig(Fig fig)
Remove the given edge from the graph. |
void |
removeGraphEventListener(GraphListener listener)
|
void |
removeNode(java.lang.Object node)
Remove the given node from the graph. |
void |
setConnectionConstrainer(ConnectionConstrainer cc)
Apply the object containing the ruleset for what edges and ports can connect in the graph |
static void |
setSaveAction(javax.swing.Action action)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.tigris.gef.graph.MutableGraphModel |
---|
addNodeRelatedEdges, canAddEdge, canAddNode, canConnect, connect, connect |
Methods inherited from interface org.tigris.gef.graph.GraphModel |
---|
getEdges, getInEdges, getNodes, getOutEdges, getPorts |
Methods inherited from interface org.tigris.gef.graph.BaseGraphModel |
---|
getDestPort, getOwner, getSourcePort |
Constructor Detail |
---|
public MutableGraphSupport()
public MutableGraphSupport(ConnectionConstrainer cc)
Method Detail |
---|
public java.util.List getGraphListeners()
public java.lang.Object createNode(java.lang.String name, java.util.Hashtable args)
createNode
in interface MutableGraphModel
protected ConnectionConstrainer getConnectionConstrainer()
public void setConnectionConstrainer(ConnectionConstrainer cc)
setConnectionConstrainer
in interface GraphModel
cc
- A connection constrainerpublic boolean canDragNode(java.lang.Object node)
canDragNode
in interface MutableGraphModel
public void dragNode(java.lang.Object node)
dragNode
in interface MutableGraphModel
public boolean canChangeConnectedNode(java.lang.Object newNode, java.lang.Object oldNode, java.lang.Object edge)
canChangeConnectedNode
in interface MutableGraphModel
public boolean canConnect(java.lang.Object fromPort, java.lang.Object toPort, java.lang.Object edgeType)
canConnect
in interface MutableGraphModel
fromPort
- the source port for which to testtoPort
- the destination port for which to testedgeType
- An identifier indicating the type of edge to createpublic boolean canConnect(java.lang.Object fromPort, java.lang.Object toPort, java.lang.Class edgeClass)
fromPort
- the source port for which to testtoPort
- the destination port for which to testedgeClass
- The edge class for which testpublic void changeConnectedNode(java.lang.Object newNode, java.lang.Object oldNode, java.lang.Object edge, boolean isSource)
changeConnectedNode
in interface MutableGraphModel
public java.lang.Object connect(java.lang.Object fromPort, java.lang.Object toPort, java.lang.Object edgeClass)
connect
in interface MutableGraphModel
public java.lang.Object connect(java.lang.Object fromPort, java.lang.Object toPort, java.lang.Object edgeType, java.util.Map styleAttributes)
connect
in interface MutableGraphModel
fromPort
- The originating port to connecttoPort
- The destination port to connectedgeType
- Some indicator of the type of edge to create. This
could be a Class
or some other value
as input to a factory to create the required edge
model.styleAttributes
- key/value pairs from which to create the edge.
edgeClass
if we succeeded,
null
otherwise)public boolean containsNode(java.lang.Object node)
MutableGraphModel
containsNode
in interface MutableGraphModel
public boolean containsEdge(java.lang.Object edge)
MutableGraphModel
containsEdge
in interface MutableGraphModel
public boolean containsNodePort(java.lang.Object port)
public boolean containsEdgePort(java.lang.Object port)
public boolean containsPort(java.lang.Object port)
public void addGraphEventListener(GraphListener listener)
addGraphEventListener
in interface BaseGraphModel
public void removeGraphEventListener(GraphListener listener)
removeGraphEventListener
in interface BaseGraphModel
public void fireNodeAdded(java.lang.Object node)
public void fireNodeRemoved(java.lang.Object node)
public void fireEdgeAdded(java.lang.Object edge)
public void fireEdgeRemoved(java.lang.Object edge)
public void fireGraphChanged()
public static void setSaveAction(javax.swing.Action action)
public void removeNode(java.lang.Object node)
MutableGraphModel
removeNode
in interface MutableGraphModel
public void addNode(java.lang.Object node)
addNode
in interface MutableGraphModel
public void addEdge(java.lang.Object edge)
addEdge
in interface MutableGraphModel
public void removeEdge(java.lang.Object edge)
removeEdge
in interface MutableGraphModel
public void removeFig(Fig fig)
public void removeAllNodes()
public void removeAllEdges()
public void removeAll()
public boolean isEnclosable(java.lang.Object handle, java.lang.Object encloser)
isEnclosable
in interface MutableGraphModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |