Package org.graffiti.session
Class Session
java.lang.Object
org.graffiti.session.Session
- All Implemented Interfaces:
ConstraintCheckerListener
- Direct Known Subclasses:
EditorSession
public class Session extends Object implements ConstraintCheckerListener
Contains a session. A session consists of a
org.graffiti.graph.Graph
and a list of corresponding
org.graffiti.plugin.view.View
s. Every Session
contains a GraphConstraintChecker
which checks the constraints
defined by the current mode.-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
addView(View view)
Adds a new View to the inner list of views.void
changeActiveMode(Mode activeMode)
Changes the active mode of this session.void
checkFailed(String msg)
Handles the failed constraint check.void
close()
Closes this session.Mode
getActiveMode()
Returns the mode that is active in this session.View
getActiveView()
Returns the activeView.String
getClassName(Algorithm algorithm)
Returns the class name of the specified algorithm.Graph
getGraph()
Returns the graph of this session.List<View>
getViews()
Returns the list of views in the manager.boolean
isModified()
Returnstrue
, if the graph in this session has been modified.void
pluginAdded(GenericPlugin plugin, PluginDescription desc)
Called by the plugin manager, iff a plugin has been added.void
removeView(View view)
Removes the given view from this session.void
setActiveView(View activeView)
Sets the activeView.String
toString()
-
Constructor Details
-
Session
public Session()Constructs a new session instance with an empty graph and the corresponding constraint checker. -
Session
Constructs a new session instance with the given graph.- Parameters:
graph
- the graph to be used for this session.
-
-
Method Details
-
getActiveMode
Returns the mode that is active in this session.- Returns:
- the mode active in this session.
-
setActiveView
Sets the activeView.- Parameters:
activeView
- The activeView to set
-
getActiveView
Returns the activeView.- Returns:
- View
-
getClassName
Returns the class name of the specified algorithm. Using theInstanceLoader
an instance of thisAlgorithm
can be created.- Parameters:
algorithm
- theAlgorithm
of which to get the class name.- Returns:
- the class name of the specified algorithm.
- Throws:
RuntimeException
- DOCUMENT ME!
-
getGraph
Returns the graph of this session.- Returns:
- the graph of this session.
-
isModified
public boolean isModified()Returnstrue
, if the graph in this session has been modified.- Returns:
- True, if the graph has been modified. False, if not.
-
getViews
Returns the list of views in the manager.- Returns:
- the list of views in the manager.
-
addView
Adds a new View to the inner list of views.- Parameters:
view
- a view to be added.
-
changeActiveMode
Changes the active mode of this session.- Parameters:
activeMode
- the new active mode.
-
checkFailed
Handles the failed constraint check.- Specified by:
checkFailed
in interfaceConstraintCheckerListener
- Parameters:
msg
- tells details about the unsatisfied constraints.
-
close
public void close()Closes this session. Closes all the views of this session. -
pluginAdded
Called by the plugin manager, iff a plugin has been added.- Parameters:
plugin
- the added plugin.desc
- the description of the new plugin.
-
removeView
Removes the given view from this session.- Parameters:
view
- the view to be removed from this session.- Throws:
IllegalArgumentException
- DOCUMENT ME!
-
toString
-