|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.graph.AbstractGraphModel
diva.graph.modular.ModularGraphModel
ptolemy.vergil.basic.AbstractBasicGraphModel
ptolemy.vergil.actor.ActorGraphModel
public class ActorGraphModel
This class represents one level of hierarchy of a Ptolemy II model. The graph model represents attributes, ports, entities and relations as nodes. Entities and attributes are represented in the model by the icon that is used to visually depict them. Relations are represented in the model by its vertices (which are visual elements that generally exist in multiple places in a visual rendition). Ports represent themselves in the model.
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) |
Nested Class Summary | |
---|---|
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. |
Field Summary | |
---|---|
private ActorGraphModel.ExternalPortModel |
_externalPortModel
The models of the different types of nodes and edges. |
private boolean |
_forceUpdate
A flag to force calling update when a ChangeRequest has been executed. |
private ActorGraphModel.IconModel |
_iconModel
|
private ActorGraphModel.LinkModel |
_linkModel
|
private java.util.Set<Link> |
_linkSet
The set of all links in the model. |
private ActorGraphModel.PortModel |
_portModel
|
private ActorGraphModel.VertexModel |
_vertexModel
|
Fields inherited from class diva.graph.AbstractGraphModel |
---|
_graphListeners |
Constructor Summary | |
---|---|
ActorGraphModel(NamedObj composite)
Construct a new graph model whose root is the given composite entity. |
Method Summary | |
---|---|
protected java.util.Set<?> |
_getLinkSet()
Get an unmodifiable copy of the link set. |
private boolean |
_isHidden(Relation relation)
Return true if the relation has a _hide attribute indicating that it is hidden. |
protected void |
_removeLink(Link link)
Remove a link from the link set. |
protected boolean |
_update()
Update the graph model. |
private void |
_updateLinks(ComponentRelation relation)
Make sure that there is a Link object representing every link connected to the given relation. |
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 enpoints 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. |
Methods inherited from class ptolemy.vergil.basic.AbstractBasicGraphModel |
---|
_getLocation, changeFailed, getProperty, getPtolemyModel, isNode, removeListeners, setProperty, setSemanticObject |
Methods inherited from class diva.graph.modular.ModularGraphModel |
---|
containsNode, getHead, getNodeCount, getParent, getRoot, getTail, inEdges, isComposite, isDirected, isEdge, nodes, nodesAfterEdges, nodesBeforeEdges, outEdges |
Methods inherited from class diva.graph.AbstractGraphModel |
---|
addGraphListener, dispatchGraphEvent, removeGraphListener, setDispatchEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private ActorGraphModel.ExternalPortModel _externalPortModel
private boolean _forceUpdate
private ActorGraphModel.IconModel _iconModel
private ActorGraphModel.LinkModel _linkModel
private java.util.Set<Link> _linkSet
private ActorGraphModel.PortModel _portModel
private ActorGraphModel.VertexModel _vertexModel
Constructor Detail |
---|
public ActorGraphModel(NamedObj composite)
composite
- The top-level composite entity for the model.Method Detail |
---|
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
private boolean _isHidden(Relation relation)
private void _updateLinks(ComponentRelation relation)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |