jcreek.gui.conceptmap
Class ConceptMapModel

java.lang.Object
  extended byjcreek.util.graph.Graph
      extended byjcreek.gui.conceptmap.ConceptMapModel
All Implemented Interfaces:
Context, java.util.EventListener, ModelChangeListener, java.io.Serializable

public class ConceptMapModel
extends Graph
implements ModelChangeListener, java.io.Serializable, Context

This is and extention of the Graph class that serves as a model (in the model-view-controller paradigm) for the ConceptMapView. This model is made with the assumption that the nodes and edges are VisualEntities and VisualRelations. In addition to this, the model has a selction set that keeps the currently selected entities at all times. This selection set is not saved when the model is serialized.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jcreek.util.graph.Graph
changeListeners, edgeList, nodeList
 
Constructor Summary
ConceptMapModel(KnowledgeModel km)
          Creates a new, empty ConceptMapModel.
 
Method Summary
 void addEdge(Edge edge)
          Overrides the addEdge() method in Graph to ensure this is a VisualRelation.
 VisualEntity addEntity(Entity entity, java.awt.Point pos)
          Adds an Entity to the ConceptMapModel by creating a VisualEntity that is a wrapper for the Entity, containg the position of it within the model.
 void addNode(Node node)
          Overrides the addNode() method in Graph to ensure this is a VisualEntity and that all VisualEntities in the graph encapsulates entities in the same KnowledgeModel.
 VisualRelation addRelation(Relation rel)
          Adds a Relation to the ConceptMap by creating a VisualRealtion that is a wrapper for the Relation.
 boolean contains(Entity entity)
          Returns true if this model has a node representing the given entity.
 boolean contains(Relation rel)
          Returns true if this model has an edge representing the given relation.
 KnowledgeModel getKnowledgeModel()
          Returns the KnowledgeModel of this model.
 SelectionSet getSelectionSet()
          Returns the SelectionSet of the model - i.e. the VisualEntities that are currently marked as being selected.
 VisualEntity getVisualEntity(Entity entity)
          Returns the VisualEntity that represents the given entity in this model.
 VisualRelation getVisualRelation(Relation rel)
          Returns the VisualRelation that represents the given relation in this model.
 void modelChanged(ModelChangeEvent e)
           
 void remove()
          Removes the ConceptMapModel and unregisteres it with the KnowledgeModel.
 void removeEdge(Edge edge)
          Remove an edge from the graph.
 void removeNode(Node node)
          Remove a node from the graph.
 SubModel toSubModel()
          Returns a Submodel that contains all the entities and relations currently activated in this Concept Map.
 
Methods inherited from class jcreek.util.graph.Graph
addGraphChangeListener, clone, contains, contains, edgeSize, getEdgeIterator, getEdgeIterator, getEdges, getNodeIterator, getNodes, nodeSize, removeGraphChangeListener, toString, triggerEdgeAddedEvent, triggerEdgeChangeEvent, triggerEdgeRemovedEvent, triggerNodeAddedEvent, triggerNodeChangeEvent, triggerNodeRemovedEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConceptMapModel

public ConceptMapModel(KnowledgeModel km)
Creates a new, empty ConceptMapModel.

Method Detail

remove

public void remove()
Removes the ConceptMapModel and unregisteres it with the KnowledgeModel.


addEntity

public VisualEntity addEntity(Entity entity,
                              java.awt.Point pos)
Adds an Entity to the ConceptMapModel by creating a VisualEntity that is a wrapper for the Entity, containg the position of it within the model.

Parameters:
entity - The jcreek.representation Entity added to this ConceptMapModel
pos - The initial position of the new VisualEntity.
Returns:
The VisualEntity representing this entity.

addRelation

public VisualRelation addRelation(Relation rel)
Adds a Relation to the ConceptMap by creating a VisualRealtion that is a wrapper for the Relation. If 'from' and 'value' entities of the relation is not already added to the ConceptMapModel, this method will fail and return null.

Returns:
The relation

addNode

public void addNode(Node node)
Overrides the addNode() method in Graph to ensure this is a VisualEntity and that all VisualEntities in the graph encapsulates entities in the same KnowledgeModel.

Overrides:
addNode in class Graph
Parameters:
node - The node to add.

removeNode

public void removeNode(Node node)
Description copied from class: Graph
Remove a node from the graph. This will also remove all edges to and from the node through a call to removeEdge().

Overrides:
removeNode in class Graph
Parameters:
node - The node to remove.

getVisualEntity

public VisualEntity getVisualEntity(Entity entity)
Returns the VisualEntity that represents the given entity in this model.


contains

public boolean contains(Entity entity)
Returns true if this model has a node representing the given entity.


addEdge

public void addEdge(Edge edge)
Overrides the addEdge() method in Graph to ensure this is a VisualRelation.

Overrides:
addEdge in class Graph
Parameters:
edge - The edge to add.

removeEdge

public void removeEdge(Edge edge)
Description copied from class: Graph
Remove an edge from the graph.

Overrides:
removeEdge in class Graph
Parameters:
edge - The edge to remove.

getVisualRelation

public VisualRelation getVisualRelation(Relation rel)
Returns the VisualRelation that represents the given relation in this model.


contains

public boolean contains(Relation rel)
Returns true if this model has an edge representing the given relation.


getSelectionSet

public SelectionSet getSelectionSet()
Returns the SelectionSet of the model - i.e. the VisualEntities that are currently marked as being selected.


getKnowledgeModel

public KnowledgeModel getKnowledgeModel()
Returns the KnowledgeModel of this model.

Specified by:
getKnowledgeModel in interface Context

modelChanged

public void modelChanged(ModelChangeEvent e)
Specified by:
modelChanged in interface ModelChangeListener

toSubModel

public SubModel toSubModel()
Returns a Submodel that contains all the entities and relations currently activated in this Concept Map.



Created at IDI, NTNU by the Artificial Intelligence and Learning group