public class ActorGraphModel extends AbstractBasicGraphModel
In the terminology of diva, the graph elements are "nodes" (icons, vertices, and ports), and the "edges" link them. Edges are represented in the model by instances of the Link class. Edges may link a port and a vertex, or a port and another port. For visual simplicity, both types of edges are represented by an instance of the Link class. If an edge is placed between a port and a vertex then the Link represents a Ptolemy II link between the port and the vertex's Relation. However, if an edge is placed between two ports, then it represents a relation (with no vertex) and links from the relation to each port (in Ptolemy II, this is called a "connection").
This model uses a ptolemy change listener to detect changes to the model that do not originate from this model. These changes are propagated as structure changed graph events to all graphListeners registered with this model. This mechanism allows a graph visualization of a ptolemy model to remain synchronized with the state of a mutating model.
Red (johnr) |
Yellow (neuendor) |
Modifier and Type | Class and Description |
---|---|
class |
ActorGraphModel.ExternalPortModel
The model for ports that make external connections to this graph.
|
static class |
ActorGraphModel.IconModel
The model for an icon that contains ports.
|
class |
ActorGraphModel.LinkModel
The model for links that connect two ports, or a port and a vertex.
|
class |
ActorGraphModel.PortModel
The model for ports that are contained in icons in this graph.
|
class |
ActorGraphModel.VertexModel
The model for vertexes that are contained within the relations of the
ptolemy model.
|
_graphListeners
Constructor and Description |
---|
ActorGraphModel(NamedObj composite)
Construct a new graph model whose root is the given composite entity.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<?> |
_getLinkSet()
Get an unmodifiable copy of the link set.
|
protected void |
_removeLink(Link link)
Remove a link from the link set.
|
protected boolean |
_update()
Update the graph model.
|
void |
changeExecuted(ChangeRequest change)
This implementation will delegate to the implementation in the parent
class and will additionally update the model in case it is necessary.
|
void |
disconnectEdge(java.lang.Object eventSource,
java.lang.Object edge)
Disconnect an edge from its two endpoints and notify graph
listeners with an EDGE_HEAD_CHANGED and an EDGE_TAIL_CHANGED
event whose source is the given source.
|
CompositeModel |
getCompositeModel(java.lang.Object composite)
Return the model for the given composite object.
|
java.lang.String |
getDeleteEdgeMoML(java.lang.Object edge)
Return a MoML String that will delete the given edge from the
Ptolemy model.
|
java.lang.String |
getDeleteNodeMoML(java.lang.Object node)
Return a MoML String that will delete the given node from the
Ptolemy model.
|
EdgeModel |
getEdgeModel(java.lang.Object edge)
Return the model for the given edge object.
|
ActorGraphModel.ExternalPortModel |
getExternalPortModel()
Get the external port model.
|
ActorGraphModel.IconModel |
getIconModel()
Get the icon model.
|
ActorGraphModel.LinkModel |
getLinkModel()
Return the model for edge objects that are instance of Link.
|
NodeModel |
getNodeModel(java.lang.Object node)
Return the node model for the given object.
|
ActorGraphModel.PortModel |
getPortModel()
Get the port model.
|
java.lang.Object |
getSemanticObject(java.lang.Object element)
Return the semantic object corresponding to the given node, edge,
or composite.
|
ActorGraphModel.VertexModel |
getVertexModel()
Get the vertex model.
|
void |
removeNode(java.lang.Object eventSource,
java.lang.Object node)
Delete a node from its parent graph and notify
graph listeners with a NODE_REMOVED event.
|
_getLocation, changeFailed, getProperty, getPtolemyModel, isNode, removeListeners, setProperty, setSemanticObject
containsNode, getHead, getNodeCount, getParent, getRoot, getTail, inEdges, isComposite, isDirected, isEdge, nodes, nodesAfterEdges, nodesBeforeEdges, outEdges
addGraphListener, dispatchGraphEvent, removeGraphListener, setDispatchEnabled
public ActorGraphModel(NamedObj composite)
composite
- The top-level composite entity for the model.public void changeExecuted(ChangeRequest change)
changeExecuted
in interface ChangeListener
changeExecuted
in class AbstractBasicGraphModel
change
- The change that has been executed.public void disconnectEdge(java.lang.Object eventSource, java.lang.Object edge)
disconnectEdge
in class AbstractBasicGraphModel
eventSource
- The source of the event that will be dispatched,
e.g. the view that made this call.edge
- The edge.public CompositeModel getCompositeModel(java.lang.Object composite)
getCompositeModel
in class AbstractBasicGraphModel
composite
- A composite object.public java.lang.String getDeleteEdgeMoML(java.lang.Object edge)
getDeleteEdgeMoML
in class AbstractBasicGraphModel
edge
- The edge.public java.lang.String getDeleteNodeMoML(java.lang.Object node)
getDeleteNodeMoML
in class AbstractBasicGraphModel
node
- The node.public EdgeModel getEdgeModel(java.lang.Object edge)
getEdgeModel
in class ModularGraphModel
edge
- An object which is assumed to be in this graph model.public ActorGraphModel.LinkModel getLinkModel()
public NodeModel getNodeModel(java.lang.Object node)
getNodeModel
in class AbstractBasicGraphModel
node
- An object which is assumed to be in this graph model.public java.lang.Object getSemanticObject(java.lang.Object element)
getSemanticObject
in interface GraphModel
getSemanticObject
in class AbstractBasicGraphModel
element
- A graph element.AbstractBasicGraphModel.setSemanticObject(Object, Object)
public void removeNode(java.lang.Object eventSource, java.lang.Object node)
removeNode
in class AbstractBasicGraphModel
eventSource
- The source of the event that will be dispatched,
e.g. the view that made this call.node
- The node.public ActorGraphModel.IconModel getIconModel()
public ActorGraphModel.PortModel getPortModel()
public ActorGraphModel.ExternalPortModel getExternalPortModel()
public ActorGraphModel.VertexModel getVertexModel()
protected java.util.Set<?> _getLinkSet()
protected void _removeLink(Link link)
link
- The link to be removed.protected boolean _update()
_update
in class AbstractBasicGraphModel