|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.edu.agh.cast.model.visual.backward.ModelElement
pl.edu.agh.cast.model.visual.backward.Diagram
public class Diagram
Diagram, which consists of of Node
s and Connection
s.
Field Summary | |
---|---|
static String |
CHILD
Name of the Diagram node added/removed event. |
static String |
CHILDREN
Name of the Diagram nodes (multiple) added/removed event. |
static String |
CONNECTION
Name of the Diagram connections changed event. |
protected ConnectionGroupAttributeManager |
connectionGroupAttributeManager
Connection group attribute manager. |
static String |
DESELECT
Name of the Diagram nodes deselected event. |
protected DiagramAttributeManager |
diagramAttributeManager
Diagram attribute manager. |
static String |
DUMMY_ID
Default, dummy id of diagrams editor. |
protected org.eclipse.core.resources.IFile |
file
File this diagram is stored in. |
static String |
FILE
Name of the Diagram file changed event. |
protected static org.apache.log4j.Logger |
log
Logger for this class. |
static String |
NAME
Name of the Diagram name changed event. |
protected NodeAttributeManager |
nodeAttributeManager
Node attribute manager. |
protected IDiagramSettings |
settings
Diagram settings. |
protected VisualModelCachingFactory |
visualModelFactory
Caching factory of visual elements. |
Fields inherited from class pl.edu.agh.cast.model.visual.backward.ModelElement |
---|
ATTRIBUTE_CHANGE, attributeValues |
Constructor Summary | |
---|---|
Diagram(Collection<IDataSet> model)
Constructs new diagram from model. |
|
Diagram(Collection<IDataSet> model,
org.eclipse.core.runtime.IProgressMonitor monitor)
Constructs new diagram from model. |
|
Diagram(Collection<IDataSet> model,
org.eclipse.core.runtime.IProgressMonitor monitor,
boolean enhancable)
Constructs new diagram from model. |
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 Connection s. |
protected void |
addConnectionsForNode(Node node)
Adds connections of a given node to the diagram. |
Node |
addNode(Node node)
Adds a Node to the model. |
protected Node |
addNodeInternal(Node node)
Adds a node to the model. |
Collection<Node> |
addNodes(Collection<Node> nodes)
Adds Node s 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 conn)
Finds IRelation for given connection. |
protected void |
firePropertyChange(String property,
Object oldValue,
Object newValue)
Notifies about property change. |
AttributeManager |
getAttributeManager()
Returns attribute manager for this container. |
Collection<Connection> |
getConnections()
Returns a collection of Connection s. |
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 Node s. |
IDiagramSettings |
getSettings()
Returns diagram settings. |
List<Statistic> |
getStatistics()
Returns statistics for current diagram. |
List<Statistic> |
getStatistics(org.eclipse.core.runtime.IProgressMonitor monitor)
Returns statistics for current diagram. |
protected VisualModelCachingFactory |
getVisualModelFactory()
Returns caching factory of visual elements. |
boolean |
isEnhancable()
Checks if the nodes of this diagram may be enhanced with attributes of entities from another IDataSet . |
void |
propertyChange(PropertyChangeEvent evt)
|
protected Object |
readResolve()
|
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 Node s from the model. |
void |
setDisplayName(String displayName)
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. |
String |
toString()
|
Methods inherited from class pl.edu.agh.cast.model.visual.backward.ModelElement |
---|
addPropertyChangeListener, bindToAttributeManager, copyAttributes, copyAttributeValues, getAllValues, getAttributeValue, getMid, isAttributeEditable, isAttributeSettable, isSaved, removePropertyChangeListener, removePropertyValue, setAttributeValue, setAttributeValue, setMid, setSaved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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, getAttributeValue, isAttributeEditable, removePropertyValue, setAttributeValue, setAttributeValue |
Field Detail |
---|
public static final String DUMMY_ID
public static final String NAME
public static final String FILE
public static final String CHILD
public static final String CONNECTION
public static final String CHILDREN
public static final String DESELECT
protected static org.apache.log4j.Logger log
protected transient org.eclipse.core.resources.IFile file
protected IDiagramSettings settings
protected NodeAttributeManager nodeAttributeManager
protected ConnectionGroupAttributeManager connectionGroupAttributeManager
protected DiagramAttributeManager diagramAttributeManager
protected final VisualModelCachingFactory visualModelFactory
Constructor Detail |
---|
public Diagram(Collection<IDataSet> model)
model
- base modelpublic Diagram(Collection<IDataSet> model, org.eclipse.core.runtime.IProgressMonitor monitor)
model
- base modelmonitor
- non-null progress monitor
IllegalArgumentException
- if progress monitor is nullpublic Diagram(Collection<IDataSet> model, org.eclipse.core.runtime.IProgressMonitor monitor, boolean enhancable)
model
- base modelmonitor
- non-null progress monitorenhancable
- whether this Diagram may be enhanced (see IDiagram.isEnhancable()
)
IllegalArgumentException
- if progress monitor is nullMethod Detail |
---|
protected Object readResolve()
readResolve
in class ModelElement
public String toString()
toString
in class Object
Object.toString()
public org.eclipse.core.resources.IFile getFile()
getFile
in interface IDiagram
IDiagram.getFile()
public void setFile(org.eclipse.core.resources.IFile file)
setFile
in interface IDiagram
file
- the file to store the diagram inIDiagram.setFile(org.eclipse.core.resources.IFile)
public void setDisplayName(String displayName)
setDisplayName
in interface IDiagram
displayName
- the name of the diagramIDiagram.setDisplayName(java.lang.String)
public String getDisplayName()
getDisplayName
in interface IDiagram
IDiagram.getDisplayName()
public List<Statistic> getStatistics()
getStatistics
in interface IDiagram
IDiagram.getStatistics()
public List<Statistic> getStatistics(org.eclipse.core.runtime.IProgressMonitor monitor)
IProgressMonitor
.
getStatistics
in interface IDiagram
monitor
- non-null progress monitor
IDiagram.getStatistics(org.eclipse.core.runtime.IProgressMonitor)
public IDiagramSettings getSettings()
getSettings
in interface IDiagram
IDiagram.getSettings()
public void setSettings(IDiagramSettings settings)
setSettings
in interface IDiagram
settings
- diagram settingsIDiagram.setSettings(pl.edu.agh.cast.model.visual.backward.IDiagramSettings)
public Node addNode(Node node)
Node
to the model.
addNode
in interface IDiagram
node
- the node to add
IDiagram.addNode(pl.edu.agh.cast.model.visual.backward.Node)
public Collection<Node> addNodes(Collection<Node> nodes)
Node
s to the model.
addNodes
in interface IDiagram
nodes
- collection of nodes to add
IDiagram.addNodes(java.util.Collection)
protected Node addNodeInternal(Node node)
node
- node to addprotected void addConnectionsForNode(Node node)
node
- the nodepublic Connection addConnection(Connection c)
Connection
to the diagram.
addConnection
in interface IDiagram
c
- connection to add
IDiagram.addConnection(pl.edu.agh.cast.model.visual.backward.Connection)
public void addConnections(Collection<Connection> connections)
Connection
s. Calls IDiagram.addConnection(pl.edu.agh.cast.model.visual.backward.Connection)
.
addConnections
in interface IDiagram
connections
- collection of connections to addIDiagram.addConnections(java.util.Collection)
public void removeNode(Node node)
Node
from the diagram. Node must have been created by this diagram's factory (i.e. must be a
diagram's node).
removeNode
in interface IDiagram
node
- the node to removeIDiagram.removeNode(pl.edu.agh.cast.model.visual.backward.Node)
public void removeNodes(Collection<Node> nodes)
Node
s from the model. Nodes must have been created by this diagram's factory (i.e. must be
diagram's nodes).
removeNodes
in interface IDiagram
nodes
- collection of nodes to removeIDiagram.removeNodes(java.util.Collection)
public void removeConnection(Connection connection)
Connection
from the model. Connection must have been created by this diagram's factory (i.e.
must be a diagram's connection).
removeConnection
in interface IDiagram
connection
- connection to addIDiagram.removeConnection(pl.edu.agh.cast.model.visual.backward.Connection)
public NodeAttributeManager getNodeAttributeManager()
NodeAttributeManager
of this diagram.
getNodeAttributeManager
in interface IDiagram
NodeAttributeManager
of this diagramIDiagram.getNodeAttributeManager()
public Collection<Node> getNodes()
Node
s.
getNodes
in interface IDiagram
Node
sIDiagram.getNodes()
public Collection<Connection> getConnections()
Connection
s.
This can throw UnsupportedOperationException
if diagram does not have information about single
connections.
getConnections
in interface IDiagram
Connection
sIDiagram.getConnections()
protected final VisualModelCachingFactory getVisualModelFactory()
public Node findNode(String nodeId)
Node
with given id.
findNode
in interface IDiagram
nodeId
- id of the node to find
IDiagram.findNode(java.lang.String)
public Connection findConnection(String sourceNodeId, String targetNodeId, Date date)
Connection
matching given criteria.
findConnection
in interface IDiagram
sourceNodeId
- id of the connection source nodetargetNodeId
- id of the connection target nodedate
- date of the connection
IDiagram.findConnection(java.lang.String, java.lang.String, java.util.Date)
public void addAttributesFromEntities(Collection<IEntity> entities, Collection<String> attributes, Map<String,AttributeMergePolicy> mergePolicies, String nodeType, org.eclipse.core.runtime.IProgressMonitor monitor)
#addAttributesFromEntities(Collection, Map, String, String, String)
addAttributesFromEntities
in interface IDiagram
entities
- collection of entities to add attributes fromattributes
- collection of attributes from entities
that should be added to nodesmergePolicies
- map of AttributeMergePolicy
policiesnodeType
- type of nodes that the attributes should be added to, if null
then all types are taken
into accountmonitor
- progress monitor for this task, if null
then
NullProgressMonitor
is usedIDiagram.addAttributesFromEntities(java.util.Collection, java.util.Collection,
java.util.Map, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
public void addAttributesFromEntities(Collection<IEntity> entities, Collection<String> attributes, Map<String,AttributeMergePolicy> mergePolicies, String nodeType, String sourceJoinAttribute, String targetJoinAttribute, org.eclipse.core.runtime.IProgressMonitor monitor)
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.
addAttributesFromEntities
in interface IDiagram
entities
- collection of entities to add attributes fromattributes
- collection of attributes from entities
that should be added to nodesmergePolicies
- map of AttributeMergePolicy
policiesnodeType
- type of nodes that the attributes should be added to, if null
then all types are taken
into accountsourceJoinAttribute
- id of the entity attribute to join ontargetJoinAttribute
- id of the node attribute to join onmonitor
- progress monitor for this task, if null
then
NullProgressMonitor
is usedIDiagram.addAttributesFromEntities(java.util.Collection, java.util.Collection,
java.util.Map, java.lang.String, java.lang.String, java.lang.String,
org.eclipse.core.runtime.IProgressMonitor)
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
propertyChange
in class ModelElement
ModelElement.propertyChange(java.beans.PropertyChangeEvent)
public void deselect()
deselect
in interface IDiagram
IDiagram.deselect()
public IDataSet getDomainModel()
IDataSet
) kept in the diagram.
getDomainModel
in interface IDiagram
IDataSet
containing diagram model dataIDiagram.getDomainModel()
public IRelation findRelation(Connection conn)
IRelation
for given connection.
findRelation
in interface IDiagram
conn
- the connection which was made of the relation
IDiagram.findRelation(pl.edu.agh.cast.model.visual.backward.Connection)
public AttributeManager getAttributeManager()
getAttributeManager
in interface AttributeValueContainer
getAttributeManager
in class ModelElement
ModelElement.getAttributeManager()
public boolean isEnhancable()
IDataSet
.
For details see #addAttributesFromEntities(Collection, Collection, Map, String, String, String)
.
isEnhancable
in interface IDiagram
IDiagram.isEnhancable()
public void setSuppressEvents(boolean newSuppressEvents)
setSuppressEvents
in interface IDiagram
newSuppressEvents
- new value of suppression flagprotected void firePropertyChange(String property, Object oldValue, Object newValue)
firePropertyChange
in class ModelElement
property
- name of the propertyoldValue
- old value of the propertynewValue
- new value of the propertyModelElement.firePropertyChange(java.lang.String, java.lang.Object,
java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |