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

All Superinterfaces:
AttributeValueContainer, pl.edu.agh.cast.model.base.IDataProvider, IPropertyChangeProvider, java.io.Serializable
All Known Implementing Classes:
Diagram

public interface IDiagram
extends java.io.Serializable, IPropertyChangeProvider, AttributeValueContainer, pl.edu.agh.cast.model.base.IDataProvider

Author:
fox

Method Summary
 void addAttributesFromEntities(java.util.Collection<pl.edu.agh.cast.model.base.IEntity> entities, java.util.Collection<java.lang.String> attributes, java.util.Map<java.lang.String,AttributeMergePolicy> mergePolicies, java.lang.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(java.util.Collection<pl.edu.agh.cast.model.base.IEntity> entities, java.util.Collection<java.lang.String> attributes, java.util.Map<java.lang.String,AttributeMergePolicy> mergePolicies, java.lang.String nodeType, java.lang.String sourceJoinAttribute, java.lang.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(java.util.Collection<Connection> connections)
          Adds many connections.
 Node addNode(Node node)
          Adds a node to the model
 java.util.Collection<Node> addNodes(java.util.Collection<Node> nodes)
          Adds nodes to the model.
 void deselect()
           
 Connection findConnection(java.lang.String sourceNodeId, java.lang.String targetNodeId, java.util.Date date)
           
 Node findNode(java.lang.String nodeId)
           
 pl.edu.agh.cast.model.base.IRelation findRelation(Connection connection)
          Finds relation for given connection
 java.util.Collection<Connection> getConnections()
          This can throw UnsupportedOperationException if diagram does not have information about single connections.
 java.lang.String getDisplayName()
           
 pl.edu.agh.cast.model.base.IDataSet getDomainModel()
          Returns all model data (packaged as one DataSet) kept in the diagram.
 org.eclipse.core.resources.IFile getFile()
          Reterun file in which this diagram is stored.
 NodeAttributeManager getNodeAttributeManager()
           
 java.util.Collection<Node> getNodes()
           
 IDiagramSettings getSettings()
           
 java.util.List<Statistic> getStatistics()
          Deprecated. Use the getStatistics(IProgressMonitor) version with progress reporting
 java.util.List<Statistic> getStatistics(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 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 model.
 void removeNodes(java.util.Collection<Node> nodes)
          Removes nodes from the model.
 void setDisplayName(java.lang.String name)
          Set 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)
           
 void setSuppressEvents(boolean newSuppressEvents)
          Suppresses all events fired by this diagram.
 
Methods inherited from interface pl.edu.agh.cast.model.IPropertyChangeProvider
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface pl.edu.agh.cast.model.visual.AttributeValueContainer
getAllValues, getAttributeManager, getAttributeValue, isAttributeEditable, removePropertyValue, setAttributeValue, setAttributeValue
 

Method Detail

getNodes

java.util.Collection<Node> getNodes()

getConnections

java.util.Collection<Connection> getConnections()
This can throw UnsupportedOperationException if diagram does not have information about single connections.

Returns:

getSettings

IDiagramSettings getSettings()
Returns:

setSettings

void setSettings(IDiagramSettings settings)
Parameters:
settings -

getFile

org.eclipse.core.resources.IFile getFile()
Reterun 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

java.lang.String getDisplayName()
Returns:
The name of the diagram.

setDisplayName

void setDisplayName(java.lang.String name)
Set display name of the diagram

Parameters:
name - new name

getStatistics

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

Returns:
Statistics for current diagram.

getStatistics

java.util.List<Statistic> getStatistics(org.eclipse.core.runtime.IProgressMonitor monitor)
Parameters:
monitor - non-null progress monitor
Returns:
Statistics for current diagram.

getNodeAttributeManager

NodeAttributeManager getNodeAttributeManager()

findNode

Node findNode(java.lang.String nodeId)

findConnection

Connection findConnection(java.lang.String sourceNodeId,
                          java.lang.String targetNodeId,
                          java.util.Date date)

addNode

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

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

addNodes

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

Returns:
list 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(java.util.Collection<Connection> connections)
Adds many connections. Calls #addConnection


removeNode

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

Throws:
java.lang.IllegalArgumentException - if node is not a child of the diagram

removeNodes

void removeNodes(java.util.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).

Throws:
java.lang.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).

Throws:
java.lang.IllegalArgumentException - if connection is not a child of the diagram

deselect

void deselect()

getDomainModel

pl.edu.agh.cast.model.base.IDataSet getDomainModel()
Returns all model data (packaged as one DataSet) kept in the diagram.

Returns:
DataSet containing diagram model data.

findRelation

pl.edu.agh.cast.model.base.IRelation findRelation(Connection connection)
Finds relation 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(java.util.Collection<pl.edu.agh.cast.model.base.IEntity> entities,
                               java.util.Collection<java.lang.String> attributes,
                               java.util.Map<java.lang.String,AttributeMergePolicy> mergePolicies,
                               java.lang.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(java.util.Collection<pl.edu.agh.cast.model.base.IEntity> entities,
                               java.util.Collection<java.lang.String> attributes,
                               java.util.Map<java.lang.String,AttributeMergePolicy> mergePolicies,
                               java.lang.String nodeType,
                               java.lang.String sourceJoinAttribute,
                               java.lang.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:
weather 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-2008 AGH University of Science and Technology. All Rights Reserved.