pl.edu.agh.cast.model.visual.backward
Interface IDiagram

All Superinterfaces:
AttributeValueContainer, IDataProvider, IPropertyChangeProvider, Serializable
All Known Implementing Classes:
Diagram

public interface IDiagram
extends Serializable, IPropertyChangeProvider, AttributeValueContainer, IDataProvider

Interface of a diagram which consists of Nodes and Connections.

Author:
AGH CAST Team

Method Summary
 void addAttributesFromEntities(Collection<IEntity> entities, Collection<String> attributes, Map<String,AttributeMergePolicy> mergePolicies, String nodeType, org.eclipse.core.runtime.IProgressMonitor monitor)
          Adds attributes from a collection of entities to the diagram with join on entity and node IDs.
 void addAttributesFromEntities(Collection<IEntity> entities, Collection<String> attributes, Map<String,AttributeMergePolicy> mergePolicies, String nodeType, String sourceJoinAttribute, String targetJoinAttribute, org.eclipse.core.runtime.IProgressMonitor monitor)
          Adds attributes from a collection of entities to the diagram.
 Connection addConnection(Connection c)
          Adds a Connection to the diagram.
 void addConnections(Collection<Connection> connections)
          Adds multiple Connections.
 Node addNode(Node node)
          Adds a Node to the model.
 Collection<Node> addNodes(Collection<Node> nodes)
          Adds Nodes to the model.
 void deselect()
          Removes selection in diagram edit part.
 Connection findConnection(String sourceNodeId, String targetNodeId, Date date)
          Returns the Connection matching given criteria.
 Node findNode(String nodeId)
          Returns the Node with given id.
 IRelation findRelation(Connection connection)
          Finds IRelation for given connection.
 Collection<Connection> getConnections()
          Returns a collection of Connections.
 String getDisplayName()
          Returns the display name of the diagram.
 IDataSet getDomainModel()
          Returns all model data (packaged as one IDataSet) kept in the diagram.
 org.eclipse.core.resources.IFile getFile()
          Return file in which this diagram is stored.
 NodeAttributeManager getNodeAttributeManager()
          Returns the NodeAttributeManager of this diagram.
 Collection<Node> getNodes()
          Returns a collection of all diagram Nodes.
 IDiagramSettings getSettings()
          Returns diagram settings.
 List<Statistic> getStatistics()
          Deprecated. Use the getStatistics(IProgressMonitor) version with progress reporting
 List<Statistic> getStatistics(org.eclipse.core.runtime.IProgressMonitor monitor)
          Returns statistics for current diagram.
 boolean isEnhancable()
          Checks if the nodes of this diagram may be enhanced with attributes of entities from another IDataSet.
 void removeConnection(Connection connection)
          Removes a Connection from the model.
 void removeNode(Node node)
          Removes a Node from the diagram.
 void removeNodes(Collection<Node> nodes)
          Removes Nodes from the model.
 void setDisplayName(String name)
          Sets the display name of the diagram.
 void setFile(org.eclipse.core.resources.IFile file)
          Set the file in which this diagram is stored.
 void setSettings(IDiagramSettings settings)
          Sets diagram settings.
 void setSuppressEvents(boolean newSuppressEvents)
          Suppresses all events fired by this diagram.
 
Methods inherited from interface pl.edu.agh.cast.data.model.property.IPropertyChangeProvider
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface pl.edu.agh.cast.model.visual.backward.AttributeValueContainer
getAllValues, getAttributeManager, getAttributeValue, isAttributeEditable, removePropertyValue, setAttributeValue, setAttributeValue
 

Method Detail

getNodes

Collection<Node> getNodes()
Returns a collection of all diagram Nodes.

Returns:
collection of Nodes

getConnections

Collection<Connection> getConnections()
Returns a collection of Connections. This can throw UnsupportedOperationException if diagram does not have information about single connections.

Returns:
collection of Connections

getSettings

IDiagramSettings getSettings()
Returns diagram settings.

Returns:
diagram settings

setSettings

void setSettings(IDiagramSettings settings)
Sets diagram settings.

Parameters:
settings - diagram settings

getFile

org.eclipse.core.resources.IFile getFile()
Return file in which this diagram is stored.

Returns:
the file containing this diagram

setFile

void setFile(org.eclipse.core.resources.IFile file)
Set the file in which this diagram is stored.

Parameters:
file - the file to store the diagram in

getDisplayName

String getDisplayName()
Returns the display name of the diagram.

Returns:
the name of the diagram

setDisplayName

void setDisplayName(String name)
Sets the display name of the diagram.

Parameters:
name - the name of the diagram

getStatistics

@Deprecated
List<Statistic> getStatistics()
Deprecated. Use the getStatistics(IProgressMonitor) version with progress reporting

Returns statistics for current diagram.

Returns:
statistics for current diagram

getStatistics

List<Statistic> getStatistics(org.eclipse.core.runtime.IProgressMonitor monitor)
Returns statistics for current diagram. Uses IProgressMonitor.

Parameters:
monitor - non-null progress monitor
Returns:
statistics for current diagram

getNodeAttributeManager

NodeAttributeManager getNodeAttributeManager()
Returns the NodeAttributeManager of this diagram.

Returns:
NodeAttributeManager of this diagram

findNode

Node findNode(String nodeId)
Returns the Node with given id.

Parameters:
nodeId - id of the node to find
Returns:
node with given id

findConnection

Connection findConnection(String sourceNodeId,
                          String targetNodeId,
                          Date date)
Returns the Connection matching given criteria.

Parameters:
sourceNodeId - id of the connection source node
targetNodeId - id of the connection target node
date - date of the connection
Returns:
connection matching given criteria

addNode

Node addNode(Node node)
Adds a Node to the model.

Parameters:
node - the node to add
Returns:
the node that was actually added to the diagram (useful for undo)

addNodes

Collection<Node> addNodes(Collection<Node> nodes)
Adds Nodes to the model.

Parameters:
nodes - collection of nodes to add
Returns:
collection of nodes that were actually added to the diagram (doesn't include nodes already present in the diagram); this information can be used to undo the adding operation

addConnection

Connection addConnection(Connection c)
Adds a Connection to the diagram.

Parameters:
c - connection to add
Returns:
non-null, added connection

addConnections

void addConnections(Collection<Connection> connections)
Adds multiple Connections. Calls addConnection(pl.edu.agh.cast.model.visual.backward.Connection).

Parameters:
connections - collection of connections to add

removeNode

void removeNode(Node node)
Removes a Node from the diagram. Node must have been created by this diagram's factory (i.e. must be a diagram's node).

Parameters:
node - the node to remove
Throws:
IllegalArgumentException - if node is not a child of the diagram

removeNodes

void removeNodes(Collection<Node> nodes)
Removes Nodes from the model. Nodes must have been created by this diagram's factory (i.e. must be diagram's nodes).

Parameters:
nodes - collection of nodes to remove
Throws:
IllegalArgumentException - if any of the nodes is not a child of the diagram

removeConnection

void removeConnection(Connection connection)
Removes a Connection from the model. Connection must have been created by this diagram's factory (i.e. must be a diagram's connection).

Parameters:
connection - connection to add
Throws:
IllegalArgumentException - if connection is not a child of the diagram

deselect

void deselect()
Removes selection in diagram edit part.


getDomainModel

IDataSet getDomainModel()
Returns all model data (packaged as one IDataSet) kept in the diagram.

Returns:
IDataSet containing diagram model data

findRelation

IRelation findRelation(Connection connection)
Finds IRelation for given connection.

Parameters:
connection - the connection which was made of the relation
Returns:
the relation which was the base for given connection

addAttributesFromEntities

void addAttributesFromEntities(Collection<IEntity> entities,
                               Collection<String> attributes,
                               Map<String,AttributeMergePolicy> mergePolicies,
                               String nodeType,
                               org.eclipse.core.runtime.IProgressMonitor monitor)
Adds attributes from a collection of entities to the diagram with join on entity and node IDs. For details see #addAttributesFromEntities(Collection, Map, String, String, String)

Parameters:
entities - collection of entities to add attributes from
attributes - collection of attributes from entities that should be added to nodes
mergePolicies - map of AttributeMergePolicy policies
nodeType - type of nodes that the attributes should be added to, if null then all types are taken into account
monitor - progress monitor for this task, if null then NullProgressMonitor is used

addAttributesFromEntities

void addAttributesFromEntities(Collection<IEntity> entities,
                               Collection<String> attributes,
                               Map<String,AttributeMergePolicy> mergePolicies,
                               String nodeType,
                               String sourceJoinAttribute,
                               String targetJoinAttribute,
                               org.eclipse.core.runtime.IProgressMonitor monitor)
Adds attributes from a collection of entities to the diagram. The join between the entities and nodes is performed on the sourceJoinAttribute of entities and targetJoinAttribute of diagram nodes. For each Node node of type nodeType from the current Diagram, if there is an entity (of type IEntity) such that:
 node.getAttributeValue(targetJoinAttribute).equals(entity.getAttribute(sourceJoinAttribute));
 
then the attributes from the entity are added to the node. The sourceJoinAttribute entity attribute should be unique across the entities collection, in order for the results to be deterministic. In order to resolve conflicts where the same attribute is present in both entity and node, instances AttributeMergePolicy can be used. These policies should be supplied in a map with entity attribute IDs as keys. A null key defines the default policy, otherwise AttributeMergePolicy.MERGE_POLICY_ALWAYS_SECOND is used.

Parameters:
entities - collection of entities to add attributes from
attributes - collection of attributes from entities that should be added to nodes
mergePolicies - map of AttributeMergePolicy policies
nodeType - type of nodes that the attributes should be added to, if null then all types are taken into account
sourceJoinAttribute - id of the entity attribute to join on
targetJoinAttribute - id of the node attribute to join on
monitor - progress monitor for this task, if null then NullProgressMonitor is used

isEnhancable

boolean isEnhancable()
Checks if the nodes of this diagram may be enhanced with attributes of entities from another IDataSet. For details see #addAttributesFromEntities(Collection, Collection, Map, String, String, String) .

Returns:
whether this diagram may be enhanced

setSuppressEvents

void setSuppressEvents(boolean newSuppressEvents)
Suppresses all events fired by this diagram.

Parameters:
newSuppressEvents - new value of suppression flag


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.