easik.sketch.document
Class DocumentInfo

java.lang.Object
  extended by easik.sketch.document.DocumentInfo

public class DocumentInfo
extends java.lang.Object

Stores information about the current document. This information includes the name of the sketch, the authors of sketch, a description, and creation/last modification dates.
Information about dates is created automatically, while other information is provided by the user through a DocInfoUI object.

Since:
2006-07-14 Vera Ranieri
Version:
2006-08-02 Kevin Green
Author:
Vera Ranieri 2006, Kevin Green 2006

Field Summary
private  java.util.ArrayList<java.lang.String> _authors
          The authors of this document
private  java.lang.String _creationDate
          The creation date of this document
private  java.lang.String _desc
          The description of this document
private  java.lang.String _lastMod
          The last modification date of this document
private  java.lang.String _name
          The name of this document
 
Constructor Summary
DocumentInfo()
          Standard constructor with empty strings for all document information.
 
Method Summary
 void addAuthor(java.lang.String author)
          Adds an author to the list of authors.
 java.util.ArrayList<java.lang.String> getAuthors()
          Gets the authors of this sketch
 java.lang.String getAuthorString()
          Returns a single string of the authors, with commas acting as separators
 java.lang.String getCreationDate()
          Gets the creation date.
private static java.lang.String getDateTime()
          Determines the current date/time and formats it in the XML dateTime format
 java.lang.String getDesc()
          Gets the description of the current sketch
 java.lang.String getLastMod()
          Gets the last modification date.
 java.lang.String getName()
          Gets the name of this sketch
 void setAllInfo(java.lang.String name, java.lang.String author, java.lang.String desc)
          Sets all editable information, with the parameters determined by the user.
 void setCreationDate(java.lang.String date)
          Sets the creation date.
 void setDateInfo()
          Sets the date information when a save is called.
 void setDesc(java.lang.String desc)
          Sets the description of the current sketch
 void setModificationDate(java.lang.String date)
          Sets the last modification date.
 void setName(java.lang.String name)
          Sets the name of this sketch, and also sets the name above the information tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_name

private java.lang.String _name
The name of this document


_authors

private java.util.ArrayList<java.lang.String> _authors
The authors of this document


_desc

private java.lang.String _desc
The description of this document


_creationDate

private java.lang.String _creationDate
The creation date of this document


_lastMod

private java.lang.String _lastMod
The last modification date of this document

Constructor Detail

DocumentInfo

public DocumentInfo()
Standard constructor with empty strings for all document information.

Method Detail

getName

public java.lang.String getName()
Gets the name of this sketch

Returns:
The name of this sketch

setName

public void setName(java.lang.String name)
Sets the name of this sketch, and also sets the name above the information tree.

Parameters:
name - The name of this sketch

getAuthors

public java.util.ArrayList<java.lang.String> getAuthors()
Gets the authors of this sketch

Returns:
An array list of the authors

getAuthorString

public java.lang.String getAuthorString()
Returns a single string of the authors, with commas acting as separators

Returns:
A single string of all authors

addAuthor

public void addAuthor(java.lang.String author)
Adds an author to the list of authors.

Parameters:
author - The authors name

getDesc

public java.lang.String getDesc()
Gets the description of the current sketch

Returns:
The description of the sketch

setDesc

public void setDesc(java.lang.String desc)
Sets the description of the current sketch

Parameters:
desc - The description of the sketch

getCreationDate

public java.lang.String getCreationDate()
Gets the creation date. If the creation date is the empty string, it returns "N/A".

Returns:
The creation date if set, "N/A" otherwise.

setCreationDate

public void setCreationDate(java.lang.String date)
Sets the creation date. If the date is the empty string, it sets creation date as the current date.

Parameters:
date - The date of creation of this sketch, based on the first save.

getLastMod

public java.lang.String getLastMod()
Gets the last modification date. If the last modification date has not been set, it returns "N/A"

Returns:
The last modification date if set, "N/A" otherwise.

setModificationDate

public void setModificationDate(java.lang.String date)
Sets the last modification date. If date is the empty string, it sets the last modifation date to the current date/time.

Parameters:
date - The date of the last modification, or the empty string if this is the latest modification.

setAllInfo

public void setAllInfo(java.lang.String name,
                       java.lang.String author,
                       java.lang.String desc)
Sets all editable information, with the parameters determined by the user. If any parameters have been changed, the sketch is set to dirty so user will be prompted for a save if an attempt to discard the current sketch is made before a save.

Parameters:
name - The name of the sketch
author - The string of all authors of the sketch
desc - The description of the sketch

setDateInfo

public void setDateInfo()
Sets the date information when a save is called. This information is set by leaving the current creation date and resetting the last modification date to the current date.


getDateTime

private static java.lang.String getDateTime()
Determines the current date/time and formats it in the XML dateTime format

Returns:
The current date/time formatted as a string for XML