org.statcato.file
Class Project

java.lang.Object
  extended by org.statcato.file.Project

public class Project
extends java.lang.Object

A project file that stores the LogWindow instance, DatasheetTabbedPane instance,as well as generated charts of this application.

Since:
1.0
Version:
%I%, %G%
Author:
Margaret Yau

Field Summary
static java.lang.String extension
           
 
Constructor Summary
Project(Statcato app)
          Constructor.
 
Method Summary
 void autoSaveWrite()
          Writes project file to the temporary file path.
 boolean close()
          If the project is not yet saved, prompts the user to save.
 boolean exists()
          Returns whether this project exists (is valid).
 void exit()
          Deletes temporary file if it exists.
 java.io.File getFile()
          Returns the saved project file.
 java.lang.String getName()
          Returns the name of this project.
 boolean isModified()
          Returns true if the project is modified since the last save.
 boolean readFile(java.lang.String path)
          Read a project file from the given path.
 void setAutoSaveInterval(int seconds)
          Sets the auto save interval variable to the given value.
 void setDeleteAutoSaveFile(boolean delete)
          Sets the delete auto save file boolean to the given value.
 boolean writeToFile(boolean saveAs)
          Writes this project to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extension

public static java.lang.String extension
Constructor Detail

Project

public Project(Statcato app)
Constructor.

Parameters:
app - Parent Statcato application
Method Detail

setAutoSaveInterval

public void setAutoSaveInterval(int seconds)
Sets the auto save interval variable to the given value.

Parameters:
seconds - number of seconds

setDeleteAutoSaveFile

public void setDeleteAutoSaveFile(boolean delete)
Sets the delete auto save file boolean to the given value.

Parameters:
delete - boolean indicating whether to delete auto save file

exists

public boolean exists()
Returns whether this project exists (is valid).

Returns:
whether this project exists (is valid)

isModified

public boolean isModified()
Returns true if the project is modified since the last save.

Returns:
true if the project is modified since the last save or false otherwise

writeToFile

public boolean writeToFile(boolean saveAs)
Writes this project to a file. Opens a file chooser for the user to select file for save as or if the project has not been saved before.

Parameters:
saveAs - whether it is an save as operation
Returns:
true if the project is saved successfully or false otherwise.

getFile

public java.io.File getFile()
Returns the saved project file.

Returns:
project file

autoSaveWrite

public void autoSaveWrite()
Writes project file to the temporary file path.


getName

public java.lang.String getName()
Returns the name of this project.

Returns:
name, or empty string if this project has no name

readFile

public boolean readFile(java.lang.String path)
Read a project file from the given path. The read log is appended to the existing log, and the datasheets are added to the existing datasheet pane.

Parameters:
path - project file path
Returns:
true if a project file is read successfully, or false otherwise

close

public boolean close()
If the project is not yet saved, prompts the user to save. Closes the open project (log and datasheets).

Returns:
whether the project can be closed.

exit

public void exit()
Deletes temporary file if it exists.