|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.edu.agh.cast.model.visual.ModelElement
pl.edu.agh.cast.model.visual.Diagram
public class Diagram
Field Summary | |
---|---|
protected ConnectionGroupAttributeManager |
_connectionGroupAttributeManager
|
protected DiagramAttributeManager |
_diagramAttributeManager
|
protected org.eclipse.core.resources.IFile |
_file
|
protected NodeAttributeManager |
_nodeAttributeManager
|
protected IDiagramSettings |
_settings
|
protected VisualModelCachingFactory |
_visualModelFactory
|
static java.lang.String |
CHILD
|
static java.lang.String |
CHILDREN
|
static java.lang.String |
CONNECTION
|
static java.lang.String |
DESELECT
|
static java.lang.String |
DUMMY_ID
|
static java.lang.String |
FILE
|
static java.lang.String |
NAME
|
Fields inherited from class pl.edu.agh.cast.model.visual.ModelElement |
---|
_attributeValues, ATTRIBUTE_CHANGE |
Constructor Summary | |
---|---|
Diagram(java.util.Collection<pl.edu.agh.cast.model.base.IDataSet> model)
Constructs new diagram from model. |
|
Diagram(java.util.Collection<pl.edu.agh.cast.model.base.IDataSet> model,
org.eclipse.core.runtime.IProgressMonitor monitor)
Constructs new diagram from model. |
|
Diagram(java.util.Collection<pl.edu.agh.cast.model.base.IDataSet> model,
org.eclipse.core.runtime.IProgressMonitor monitor,
boolean enhancable)
Constructs new diagram from model. |
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. |
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 |
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 conn)
Finds relation for given connection |
protected void |
firePropertyChange(java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
|
AttributeManager |
getAttributeManager()
Returns element's attribute manager |
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()
|
java.util.List<Statistic> |
getStatistics(org.eclipse.core.runtime.IProgressMonitor monitor)
|
protected VisualModelCachingFactory |
getVisualModelFactory()
|
boolean |
isEnhancable()
Checks if the nodes of this diagram may be enhanced with attributes of entities from another IDataSet . |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
|
protected java.lang.Object |
readResolve()
|
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 displayName)
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. |
java.lang.String |
toString()
|
Methods inherited from class pl.edu.agh.cast.model.visual.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.model.IPropertyChangeProvider |
---|
addPropertyChangeListener, removePropertyChangeListener |
Methods inherited from interface pl.edu.agh.cast.model.visual.AttributeValueContainer |
---|
getAllValues, getAttributeValue, isAttributeEditable, removePropertyValue, setAttributeValue, setAttributeValue |
Field Detail |
---|
public static final java.lang.String DUMMY_ID
public static final java.lang.String NAME
public static final java.lang.String FILE
public static final java.lang.String CHILD
public static final java.lang.String CONNECTION
public static final java.lang.String CHILDREN
public static final java.lang.String DESELECT
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(java.util.Collection<pl.edu.agh.cast.model.base.IDataSet> model)
model
- base modelpublic Diagram(java.util.Collection<pl.edu.agh.cast.model.base.IDataSet> model, org.eclipse.core.runtime.IProgressMonitor monitor)
model
- base modelmonitor
- non-null progress monitor
java.lang.IllegalArgumentException
- if progress monitor is nullpublic Diagram(java.util.Collection<pl.edu.agh.cast.model.base.IDataSet> model, org.eclipse.core.runtime.IProgressMonitor monitor, boolean enhancable)
model
- base modelmonitor
- non-null progress monitorenhancable
- weather this Diagram may be enhanced (see
IDiagram.isEnhancable()
)
java.lang.IllegalArgumentException
- if progress monitor is nullMethod Detail |
---|
protected java.lang.Object readResolve()
readResolve
in class ModelElement
public java.lang.String toString()
toString
in class java.lang.Object
public org.eclipse.core.resources.IFile getFile()
IDiagram
getFile
in interface IDiagram
public void setFile(org.eclipse.core.resources.IFile file)
IDiagram
setFile
in interface IDiagram
file
- The file to store the diagram in.public void setDisplayName(java.lang.String displayName)
IDiagram
setDisplayName
in interface IDiagram
displayName
- new namepublic java.lang.String getDisplayName()
getDisplayName
in interface IDiagram
public java.util.List<Statistic> getStatistics()
getStatistics
in interface IDiagram
public java.util.List<Statistic> getStatistics(org.eclipse.core.runtime.IProgressMonitor monitor)
getStatistics
in interface IDiagram
monitor
- non-null progress monitor
public IDiagramSettings getSettings()
getSettings
in interface IDiagram
public void setSettings(IDiagramSettings settings)
setSettings
in interface IDiagram
public Node addNode(Node node)
addNode
in interface IDiagram
node
- is the node to add
public java.util.Collection<Node> addNodes(java.util.Collection<Node> nodes)
addNodes
in interface IDiagram
protected Node addNodeInternal(Node node)
node
- node to addprotected void addConnectionsForNode(Node node)
node
- public Connection addConnection(Connection c)
addConnection
in interface IDiagram
c
- connection to add
public void addConnections(java.util.Collection<Connection> connections)
addConnections
in interface IDiagram
public void removeNode(Node node)
removeNode
in interface IDiagram
java.lang.IllegalArgumentException
- if node is not a child of the diagrampublic void removeNodes(java.util.Collection<Node> nodes)
removeNodes
in interface IDiagram
java.lang.IllegalArgumentException
- if any of the nodes is not a child of the diagrampublic void removeConnection(Connection connection)
removeConnection
in interface IDiagram
java.lang.IllegalArgumentException
- if connection is not a child of the diagrampublic NodeAttributeManager getNodeAttributeManager()
getNodeAttributeManager
in interface IDiagram
public java.util.Collection<Node> getNodes()
getNodes
in interface IDiagram
public java.util.Collection<Connection> getConnections()
IDiagram
UnsupportedOperationException
if diagram does not
have information about single connections.
getConnections
in interface IDiagram
protected final VisualModelCachingFactory getVisualModelFactory()
public Node findNode(java.lang.String nodeId)
findNode
in interface IDiagram
public Connection findConnection(java.lang.String sourceNodeId, java.lang.String targetNodeId, java.util.Date date)
findConnection
in interface IDiagram
public 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)
IDiagram
#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 usedpublic 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)
IDiagram
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 usedpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class ModelElement
public void deselect()
deselect
in interface IDiagram
public pl.edu.agh.cast.model.base.IDataSet getDomainModel()
IDiagram
getDomainModel
in interface IDiagram
public pl.edu.agh.cast.model.base.IRelation findRelation(Connection conn)
IDiagram
findRelation
in interface IDiagram
conn
- The connection which was made of the relation
public AttributeManager getAttributeManager()
ModelElement
getAttributeManager
in interface AttributeValueContainer
getAttributeManager
in class ModelElement
public boolean isEnhancable()
IDiagram
IDataSet
. For details see
#addAttributesFromEntities(Collection, Collection, Map, String, String, String)
.
isEnhancable
in interface IDiagram
public void setSuppressEvents(boolean newSuppressEvents)
setSuppressEvents
in interface IDiagram
newSuppressEvents
- new value of suppression flagprotected void firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
firePropertyChange
in class ModelElement
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |