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.Views. Every Session contains a GraphConstraintChecker which checks the constraints defined by the current mode.
See Also:
Graph, View, Mode
  • Constructor Details

    • Session

      public Session()
      Constructs a new session instance with an empty graph and the corresponding constraint checker.
    • Session

      public Session​(Graph graph)
      Constructs a new session instance with the given graph.
      Parameters:
      graph - the graph to be used for this session.
  • Method Details

    • getActiveMode

      public Mode getActiveMode()
      Returns the mode that is active in this session.
      Returns:
      the mode active in this session.
    • setActiveView

      public void setActiveView​(View activeView)
      Sets the activeView.
      Parameters:
      activeView - The activeView to set
    • getActiveView

      public View getActiveView()
      Returns the activeView.
      Returns:
      View
    • getClassName

      public String getClassName​(Algorithm algorithm)
      Returns the class name of the specified algorithm. Using the InstanceLoader an instance of this Algorithm can be created.
      Parameters:
      algorithm - the Algorithm of which to get the class name.
      Returns:
      the class name of the specified algorithm.
      Throws:
      RuntimeException - DOCUMENT ME!
    • getGraph

      public Graph getGraph()
      Returns the graph of this session.
      Returns:
      the graph of this session.
    • isModified

      public boolean isModified()
      Returns true, if the graph in this session has been modified.
      Returns:
      True, if the graph has been modified. False, if not.
    • getViews

      public List<View> getViews()
      Returns the list of views in the manager.
      Returns:
      the list of views in the manager.
    • addView

      public void addView​(View view)
      Adds a new View to the inner list of views.
      Parameters:
      view - a view to be added.
    • changeActiveMode

      public void changeActiveMode​(Mode activeMode)
      Changes the active mode of this session.
      Parameters:
      activeMode - the new active mode.
    • checkFailed

      public void checkFailed​(String msg)
      Handles the failed constraint check.
      Specified by:
      checkFailed in interface ConstraintCheckerListener
      Parameters:
      msg - tells details about the unsatisfied constraints.
    • close

      public void close()
      Closes this session. Closes all the views of this session.
    • pluginAdded

      public void pluginAdded​(GenericPlugin plugin, PluginDescription desc)
      Called by the plugin manager, iff a plugin has been added.
      Parameters:
      plugin - the added plugin.
      desc - the description of the new plugin.
    • removeView

      public void removeView​(View view)
      Removes the given view from this session.
      Parameters:
      view - the view to be removed from this session.
      Throws:
      IllegalArgumentException - DOCUMENT ME!
    • toString

      public String toString()
      Overrides:
      toString in class Object