org.annotation.wordfreak.project
Class Project

java.lang.Object
  extended byorg.annotation.wordfreak.project.Project

public class Project
extends java.lang.Object

Projects contain sets of associations between text files and annotation files. Projects can be opened, and saved, and modified.

Author:
tsmorton

Field Summary
static java.lang.String ANNOTATOR
           
static java.lang.String DATA_DIRECTORY
           
static java.lang.String ENCODING
           
static java.lang.String FONT_TYPE
           
static java.lang.String SCHEME
           
static java.lang.String TAG_SET
           
static java.lang.String VIEWER
           
 
Constructor Summary
Project()
           
Project(java.lang.String path, FileRequestListener frl)
          Initialize the project, set's it's default path used when saving the file, and parse the config file specified.
 
Method Summary
 ProjectItem addFile(java.lang.String annotationName, java.lang.String sourceName, AnnotatedFileFormat ff)
          Adds an annotation file to the project.
 java.lang.String[] getAnnotatedFilePaths()
          Provides array of all paths to annotated files.
 AnnotationFilter getAnnotationFilter()
          Returns the filter used to determine whether an annotation is displayed to the user.
 java.lang.String getDataDirectory()
          Gets the dataDirectory attribute of the Project object
 java.lang.String getDefaultAnnotationScheme()
          Gets the defaultAnnotationScheme attribute of the Project object
 java.lang.String getDefaultAnnotator()
          Gets the defaultAnnotator attribute of the Project object
 java.lang.String getDefaultEncoding()
          Gets the defaultEncoding attribute of the Project object
 java.lang.String getDefaultFontSize()
          Gets the defaultFontSize attribute of the Project object
 java.lang.String getDefaultFontType()
          Gets the defaultFontType attribute of the Project object
 java.lang.String getDefaultTagSet()
          Gets the defaultTagSet attribute of the Project object
 java.lang.String getDefaultViewer()
          Gets the defaultViewer attribute of the Project object
 java.lang.String[] getFilePaths()
          Provides source and annotation files for all files in the project.
 javax.swing.tree.TreeModel getItemsModel()
           
 javax.swing.tree.TreeNode getNodeForPath(java.lang.String path)
           
 javax.swing.Icon getNodeIcon(java.lang.String nodePath)
          Returns the icon for the specfied path to a node.
 java.lang.String getPathForNode(javax.swing.tree.TreeNode node)
           
 java.lang.String[] getPathsForChildren(javax.swing.tree.TreeNode node)
           
 java.lang.String getProjectName()
          Gets the projectName attribute of the Project object
 java.lang.String getProjectPath()
          Gets the projectPath attribute of the Project object
 AnnotationFilter getSavingFilter()
          Returns the filter used to determine whether an annotation should be saved.
 java.lang.String getSourceFilePath(java.lang.String annPath)
           
 AnnotationFilter getTaggingFilter()
          Gets the taggingFilter attribute of the Project object
 AnnotationFilter getTrainingFilter()
          Gets the trainingFilter attribute of the Project object
 boolean isGold(java.lang.String path)
           
 boolean isLoaded(java.lang.String path)
           
 boolean isLoading(java.lang.String path)
           
 boolean isSourcePath(java.lang.String path)
           
 boolean readProjectFile(java.lang.String path)
          Return true if the project file specified by the path could be loaded.
 void removeFile(java.lang.String pathName)
           
 boolean save()
          Saves the project to projectPath.
 boolean save(java.lang.String fileName)
          Save the project to the file, fileName
 void setDataDirectory(java.lang.String dir)
          Sets the dataDirectory attribute of the Project object
 void setDefaultAnnotationScheme(java.lang.String das)
          Sets the defaultAnnotationScheme attribute of the Project object
 void setDefaultAnnotator(java.lang.String da)
          Sets the defaultAnnotator attribute of the Project object
 void setDefaultEncoding(java.lang.String ts)
          Sets the defaultEncoding attribute of the Project object
 void setDefaultFontSize(java.lang.String ts)
          Sets the defaultFontSize attribute of the Project object
 void setDefaultFontType(java.lang.String ts)
          Sets the defaultFontType attribute of the Project object
 void setDefaultTagSet(java.lang.String ts)
          Sets the defaultTagSet attribute of the Project object
 void setDefaultViewer(java.lang.String dv)
          Sets the defaultViewer attribute of the Project object
 void setFileRequestListener(FileRequestListener frl)
           
 void setGold(java.lang.String path, boolean gold)
           
 void setLoaded(java.lang.String path, boolean loaded)
          Allows a file with the specified path to be loaded (loaded=true) or unloaded (loaded=false).
 void setLoading(java.lang.String path, boolean loaded)
           
 void setProjectPath(java.lang.String path)
          Sets the projectPath attribute of the Project object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEWER

public static java.lang.String VIEWER

SCHEME

public static java.lang.String SCHEME

ANNOTATOR

public static java.lang.String ANNOTATOR

TAG_SET

public static java.lang.String TAG_SET

FONT_TYPE

public static java.lang.String FONT_TYPE

ENCODING

public static java.lang.String ENCODING

DATA_DIRECTORY

public static java.lang.String DATA_DIRECTORY
Constructor Detail

Project

public Project()

Project

public Project(java.lang.String path,
               FileRequestListener frl)
Initialize the project, set's it's default path used when saving the file, and parse the config file specified.

Parameters:
path - Name of the file where the project file should be saved.
Method Detail

setFileRequestListener

public void setFileRequestListener(FileRequestListener frl)

readProjectFile

public boolean readProjectFile(java.lang.String path)
Return true if the project file specified by the path could be loaded.

Parameters:
path - file path of the project file.
Returns:
true if the project file could be loaded, false otherwise.

getNodeForPath

public javax.swing.tree.TreeNode getNodeForPath(java.lang.String path)

getPathForNode

public java.lang.String getPathForNode(javax.swing.tree.TreeNode node)

getPathsForChildren

public java.lang.String[] getPathsForChildren(javax.swing.tree.TreeNode node)

isSourcePath

public boolean isSourcePath(java.lang.String path)

addFile

public ProjectItem addFile(java.lang.String annotationName,
                           java.lang.String sourceName,
                           AnnotatedFileFormat ff)
Adds an annotation file to the project.

Parameters:
annotationName - The name/path of the annotation file or null.
sourceName - The name/path of the source file or null.
Returns:
The item added to the project, or null if the item could not be added.

isLoaded

public boolean isLoaded(java.lang.String path)

isLoading

public boolean isLoading(java.lang.String path)

isGold

public boolean isGold(java.lang.String path)

setLoaded

public void setLoaded(java.lang.String path,
                      boolean loaded)
Allows a file with the specified path to be loaded (loaded=true) or unloaded (loaded=false).

Parameters:
path - The file to be loaded or unloaded.
loaded - The loade/unloaded state.

setGold

public void setGold(java.lang.String path,
                    boolean gold)

setLoading

public void setLoading(java.lang.String path,
                       boolean loaded)

getItemsModel

public javax.swing.tree.TreeModel getItemsModel()

removeFile

public void removeFile(java.lang.String pathName)

getProjectPath

public java.lang.String getProjectPath()
Gets the projectPath attribute of the Project object

Returns:
The projectPath value

setProjectPath

public void setProjectPath(java.lang.String path)
Sets the projectPath attribute of the Project object

Parameters:
path - The new projectPath value

setDefaultAnnotationScheme

public void setDefaultAnnotationScheme(java.lang.String das)
Sets the defaultAnnotationScheme attribute of the Project object

Parameters:
das - The new defaultAnnotationScheme value

getDefaultAnnotationScheme

public java.lang.String getDefaultAnnotationScheme()
Gets the defaultAnnotationScheme attribute of the Project object

Returns:
The defaultAnnotationScheme value

setDefaultViewer

public void setDefaultViewer(java.lang.String dv)
Sets the defaultViewer attribute of the Project object

Parameters:
dv - The new defaultViewer value

getDefaultViewer

public java.lang.String getDefaultViewer()
Gets the defaultViewer attribute of the Project object

Returns:
The defaultViewer value

setDefaultAnnotator

public void setDefaultAnnotator(java.lang.String da)
Sets the defaultAnnotator attribute of the Project object

Parameters:
da - The new defaultAnnotator value

getDefaultAnnotator

public java.lang.String getDefaultAnnotator()
Gets the defaultAnnotator attribute of the Project object

Returns:
The defaultAnnotator value

setDefaultTagSet

public void setDefaultTagSet(java.lang.String ts)
Sets the defaultTagSet attribute of the Project object

Parameters:
ts - The new defaultTagSet value

getDefaultTagSet

public java.lang.String getDefaultTagSet()
Gets the defaultTagSet attribute of the Project object

Returns:
The defaultTagSet value

setDefaultFontType

public void setDefaultFontType(java.lang.String ts)
Sets the defaultFontType attribute of the Project object

Parameters:
ts - The new defaultFontType value

getDefaultFontType

public java.lang.String getDefaultFontType()
Gets the defaultFontType attribute of the Project object

Returns:
The defaultFontType value

setDefaultFontSize

public void setDefaultFontSize(java.lang.String ts)
Sets the defaultFontSize attribute of the Project object

Parameters:
ts - The new defaultFontSize value

getDefaultFontSize

public java.lang.String getDefaultFontSize()
Gets the defaultFontSize attribute of the Project object

Returns:
The defaultFontSize value

setDefaultEncoding

public void setDefaultEncoding(java.lang.String ts)
Sets the defaultEncoding attribute of the Project object

Parameters:
ts - The new defaultEncoding value

getDefaultEncoding

public java.lang.String getDefaultEncoding()
Gets the defaultEncoding attribute of the Project object

Returns:
The defaultEncoding value

getTaggingFilter

public AnnotationFilter getTaggingFilter()
Gets the taggingFilter attribute of the Project object

Returns:
The taggingFilter value

getTrainingFilter

public AnnotationFilter getTrainingFilter()
Gets the trainingFilter attribute of the Project object

Returns:
The trainingFilter value

getAnnotationFilter

public AnnotationFilter getAnnotationFilter()
Returns the filter used to determine whether an annotation is displayed to the user.

Returns:
The filter used to determine whether an annotation is displayed to the user.

getSavingFilter

public AnnotationFilter getSavingFilter()
Returns the filter used to determine whether an annotation should be saved.

Returns:
The filter used to determine whether an annotation should be saved.

save

public boolean save()
Saves the project to projectPath.

Returns:
true is the project was saved successfully, false otherwise.

save

public boolean save(java.lang.String fileName)
Save the project to the file, fileName

Parameters:
fileName - the name of the file to which the project is saved.
Returns:
true if the file was saved successfully.

getProjectName

public java.lang.String getProjectName()
Gets the projectName attribute of the Project object

Returns:
The projectName value

getFilePaths

public java.lang.String[] getFilePaths()
Provides source and annotation files for all files in the project.

Returns:
An array of source, annotation file path pairs where source files are in even positions in the array and annotation paths are in the following odd position.

getNodeIcon

public javax.swing.Icon getNodeIcon(java.lang.String nodePath)
Returns the icon for the specfied path to a node.

Parameters:
nodePath - The path to a tree node.
Returns:
An icon for the specified tree node path.

getAnnotatedFilePaths

public java.lang.String[] getAnnotatedFilePaths()
Provides array of all paths to annotated files.

Returns:
an array containing all paths to annotated files in project.

getSourceFilePath

public java.lang.String getSourceFilePath(java.lang.String annPath)

getDataDirectory

public java.lang.String getDataDirectory()
Gets the dataDirectory attribute of the Project object

Returns:
The dataDirectory value

setDataDirectory

public void setDataDirectory(java.lang.String dir)
Sets the dataDirectory attribute of the Project object

Parameters:
dir - The new dataDirectory value


Copyright © 2004 Thomas Morton and Jeremy LaCivita. All Rights Reserved.