org.annotation.wordfreak
Interface FileRequestListener

All Known Implementing Classes:
AnnotatedFileManager

public interface FileRequestListener

This inteface determines how components request file related resources. Components which implement the AnnotatedFileListener interface are notified of changes which result from these requests.


Method Summary
 void addAnnotatedFileListener(AnnotatedFileListener afl)
          Registers an AnnotatedFileListener to be notified of file related changes.
 void addGold(java.lang.String fileName)
          Adds the annotated file name/path specified by fileName to the set of gold files.
 boolean allAnnotatedFilesSaved()
          Returns true is all annotated files have been saved, false otherwise.
 boolean closeAnnotatedFile(java.lang.String fileName)
          Returns true if the the annotated file specified by annFileName could be closed.
 java.io.File getAnnotatedFile(java.lang.String sourceFileName)
          Returns a likly annotated file for this source file name.
 int getFileCount()
          Returns the number of files which have been opened.
 FileFormat getFileFormat(javax.swing.filechooser.FileFilter ff)
          Returns the file format associated with the specified file filter.
 FileFormat getFileFormat(java.lang.String name)
          Returns the file format associated with the specified file format name.
 FileFormat getFileFormatForFile(java.lang.String fileName)
          Returns the file format associated with the specified file name.
 java.util.Iterator getFileFormatNames()
          Returns an iterator over the names of currently loaded file formats.
 AnnotationFile getFileFromPath(java.lang.String p)
          Returns the annotated file associated with the name/path of the file sent as a parameter.
 java.util.Iterator iterator()
          Returns an iterator over the opened files.
 boolean openAnnotatedFile(java.lang.String fileName)
          Returns true if the source file specified by fileName and its coresponding annotated file could be opened.
 boolean openAnnotatedFile(java.lang.String fileName, java.lang.String annFileName)
          Returns true if the source file specified by fileName and the annotated file specified by annFileName could be opened.'
 void removeAnnotatedFileListener(AnnotatedFileListener afl)
          Un-registers an AnnotatedFileListener.
 void removeGold(java.lang.String fileName)
          Removes the annotated file name/path specified by fileName from the set of gold files.
 boolean saveAnnotatedFile(java.lang.String annFileName)
          Returns true if the the annotated file specified by annFileName could be saved.
 boolean scanAnnotatedFile(java.lang.String fileName, java.lang.String annFileName)
          Returns true if the source file specified by fileName and the annotated file specified by annFileName could be scaned.
 java.lang.String[] setFileFormat(java.lang.String file, AnnotatedFileFormat format)
          Assigns the annotated file specified by file to the format specified by format and returns the name of the annotated file and the source file.
 void setFilter(AnnotationFilter f)
          Set the saving filter for all files.
 

Method Detail

setFileFormat

public java.lang.String[] setFileFormat(java.lang.String file,
                                        AnnotatedFileFormat format)
Assigns the annotated file specified by file to the format specified by format and returns the name of the annotated file and the source file.

Parameters:
file - the name of the source file.
format - the format of the file.
Returns:
the name of the annotated file and source file in position 0 and 1 of a String array respectively or null if no file name is appropiate.

getFileFormatNames

public java.util.Iterator getFileFormatNames()
Returns an iterator over the names of currently loaded file formats.

Returns:
iterator over the names of currently loaded file formats.

getFileFormat

public FileFormat getFileFormat(java.lang.String name)
Returns the file format associated with the specified file format name.

Parameters:
name - the name of the file format.
Returns:
the file format associated with the specified file format name or null if no associated file format exists.

getFileFormat

public FileFormat getFileFormat(javax.swing.filechooser.FileFilter ff)
Returns the file format associated with the specified file filter.

Parameters:
ff - the file filter.
Returns:
the FileFormat object associated with the ff parameter.

getFileFormatForFile

public FileFormat getFileFormatForFile(java.lang.String fileName)
Returns the file format associated with the specified file name.

Parameters:
fileName - the nae of the file.
Returns:
the FileFormat object associated with the fileName parameter, or null of no file format handles this type of file.

setFilter

public void setFilter(AnnotationFilter f)
Set the saving filter for all files. Only annotations which match this filter will be saved.

Parameters:
f - the filter.

openAnnotatedFile

public boolean openAnnotatedFile(java.lang.String fileName)
Returns true if the source file specified by fileName and its coresponding annotated file could be opened. The annotated file is deduced from the name of the source file.

Parameters:
fileName - the name/path of the source file to be opened.
Returns:
true if the source file and coresponding annotated file were opened.

openAnnotatedFile

public boolean openAnnotatedFile(java.lang.String fileName,
                                 java.lang.String annFileName)
Returns true if the source file specified by fileName and the annotated file specified by annFileName could be opened.'

Parameters:
fileName - the name/path of the source file to be opene.
annFileName - the name/path of the annotated file to be opened.
Returns:
true if the source file and annotated file were successfully opened.

scanAnnotatedFile

public boolean scanAnnotatedFile(java.lang.String fileName,
                                 java.lang.String annFileName)
Returns true if the source file specified by fileName and the annotated file specified by annFileName could be scaned.

Parameters:
fileName - the name/path of the source file to be opene.
annFileName - the name/path of the annotated file to be opened.
Returns:
true if the source file and annotated file were could be scaned.

saveAnnotatedFile

public boolean saveAnnotatedFile(java.lang.String annFileName)
Returns true if the the annotated file specified by annFileName could be saved.

Parameters:
annFileName - the name/path of the annotated file to be saved.
Returns:
true if the annotated file was succ.

closeAnnotatedFile

public boolean closeAnnotatedFile(java.lang.String fileName)
Returns true if the the annotated file specified by annFileName could be closed.

Parameters:
fileName - the name/path of the annotated file to be closed.
Returns:
true if the annotated file was succussfully closed, false otherwise.

allAnnotatedFilesSaved

public boolean allAnnotatedFilesSaved()
Returns true is all annotated files have been saved, false otherwise.

Returns:
returns true is all annotated files have been saved, false otherwise.

getFileFromPath

public AnnotationFile getFileFromPath(java.lang.String p)
Returns the annotated file associated with the name/path of the file sent as a parameter.

Parameters:
p - the file name/path.
Returns:
the annotated file associated with the parameter p.

addAnnotatedFileListener

public void addAnnotatedFileListener(AnnotatedFileListener afl)
Registers an AnnotatedFileListener to be notified of file related changes.

Parameters:
afl - the annotated file listener.

removeAnnotatedFileListener

public void removeAnnotatedFileListener(AnnotatedFileListener afl)
Un-registers an AnnotatedFileListener.

Parameters:
afl - the annotated file listener.

getFileCount

public int getFileCount()
Returns the number of files which have been opened.

Returns:
the number of files which have been opened.

iterator

public java.util.Iterator iterator()
Returns an iterator over the opened files.

Returns:
an iterator over the opens files.

addGold

public void addGold(java.lang.String fileName)
Adds the annotated file name/path specified by fileName to the set of gold files.

Parameters:
fileName - the name/path of the annotated file.

removeGold

public void removeGold(java.lang.String fileName)
Removes the annotated file name/path specified by fileName from the set of gold files.

Parameters:
fileName - the name/path of the annotated file.

getAnnotatedFile

public java.io.File getAnnotatedFile(java.lang.String sourceFileName)
Returns a likly annotated file for this source file name.

Returns:
Returns a likly annotated file for this source file name, or null if no annotated file could be found.


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