gui
Class Session

java.lang.Object
  |
  +--gui.Session
All Implemented Interfaces:
java.io.Serializable

public class Session
extends java.lang.Object
implements java.io.Serializable

Class Session. The Session object keeps all information of a program execution. It keeps track of all SFCs and their status, which are included in the current program run. The Session manages the Projects and offers the ability to create new, import or export Projects.

Version:
$Revision: 1.18 $
Author:
Hans Theman and Ingo Schiller
See Also:
Serialized Form

Constructor Summary
Session()
          The standard constructor.
Session(java.io.File _file)
          The constructor.
 
Method Summary
 void addProject(Project _project)
          Adds a Project object to the session.
 void disposeEditors()
          Shuts down all pending editor frames.
 java.io.File getFile()
          Returns the session filename.
 java.lang.String getName()
          Returns the session name.
 java.util.Vector getNamesList()
           
 Project getProject(java.lang.Object key)
          Returns the corresponding Project object.
 java.util.Vector getProjectList()
          to get the projectvector to display the list
 boolean isEmpty()
           
 boolean isModified()
          Returns the modified flag.
 boolean isSaved()
          Returns the saved flag of a session.
 int noOfProjects()
          Returns the number of Projects in the session.
static Session read(java.io.File _file)
           
 void removeProject(Project _project)
          Removes a Project from the session.
 void save(java.io.File _file)
          Saves the whole Session inclusive all Projects.
 void setFile(java.io.File _file)
          Sets the session filename.
 void setModified(boolean status)
          Sets the modified flag.
 void setSaved(boolean status)
          Sets the saved status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Session

public Session()
The standard constructor. Creates new Session without any SFCs.

Session

public Session(java.io.File _file)
The constructor. Creates new Session with the specified parameters. There are no SFCs.
Method Detail

getName

public java.lang.String getName()
Returns the session name.

getFile

public java.io.File getFile()
Returns the session filename.
Returns:
fileName The filename of the session.

setFile

public void setFile(java.io.File _file)
             throws java.lang.Exception
Sets the session filename. The session name is extracted from the filename excluding the filename extension and set. The is_saved flag is also set.
Parameters:
_file - The defined filename with full pathname.

setSaved

public void setSaved(boolean status)
Sets the saved status. If saved, status = true, else status = false.
Parameters:
status - The actual condition of the saved flag.

isSaved

public boolean isSaved()
Returns the saved flag of a session.
Returns:
is_saved The satus of the saved flag. If saved, status = true, else false.

setModified

public void setModified(boolean status)
Sets the modified flag.
Parameters:
status - The condition of the modified flag. If modified, status = true, else false.

isModified

public boolean isModified()
Returns the modified flag.
Returns:
is_modified The status of the modified flag. If modified, status = true, else false.

noOfProjects

public int noOfProjects()
Returns the number of Projects in the session.
Returns:
size The number of Project objects included in the session.

getProject

public Project getProject(java.lang.Object key)
Returns the corresponding Project object.
Parameters:
key - Specifies the object to search for.
Returns:
Project The Project object that belongs to the passed key object. If the key is not found, null is retruned.

addProject

public void addProject(Project _project)
                throws java.lang.Exception
Adds a Project object to the session. By the way the modified flag of the session is set.
Parameters:
_project - Specifies the Object to be added to the session.
Throws:
java.lang.Exception - if parameter is null or the added Object allready was part of the session.

removeProject

public void removeProject(Project _project)
Removes a Project from the session. If the Project has active Editorframes they are disposed.
Parameters:
_project - Specifies the object to be removed from the current session.

isEmpty

public boolean isEmpty()

disposeEditors

public void disposeEditors()
Shuts down all pending editor frames. It is called when closing the session in order to clean up the desktop.

save

public void save(java.io.File _file)
          throws java.lang.Exception
Saves the whole Session inclusive all Projects. The passed File parameter is stored in the Session object. Once stored, the is_saved flag is set. When saving the Session the next time, the File parameter may be null.
Parameters:
_file - Specifies the file in which to store the entire Session.

read

public static Session read(java.io.File _file)
                    throws java.lang.Exception

getProjectList

public java.util.Vector getProjectList()
to get the projectvector to display the list

getNamesList

public java.util.Vector getNamesList()