org.annotation.wordfreak.io
Class TextFileFormat

java.lang.Object
  extended byorg.annotation.wordfreak.io.TextFileFormat
All Implemented Interfaces:
FileFormat, Plugin, SourceFileFormat

public class TextFileFormat
extends java.lang.Object
implements SourceFileFormat


Field Summary
static java.lang.String SGM_EXTENSION
           
static java.lang.String TXT_EXTENSION
           
 
Constructor Summary
TextFileFormat()
           
 
Method Summary
 void addProgressListener(ProgressListener pl)
           
 java.lang.String getExtension()
          Returns the default file extension for files in this format.
 javax.swing.filechooser.FileFilter getFileFilter()
          Returns the file filter for this file format.
 java.lang.String getFormatName()
          Returns the name of the file format.
 javax.swing.Icon getIcon(boolean gold, boolean loaded, boolean loading)
          Returns an icon to be displayed with files of this type.
static SourceFileFormat getInstance()
           
 boolean handlesFile(java.lang.String af)
          Returns true if this can open the file specified by af.
 java.lang.String read(java.lang.String source, java.lang.String encoding)
          Reads the source file specified by the parameter source.
 void removeProgressListener(ProgressListener pl)
           
 void setOtherFileFormats(java.util.List otherFileFormats)
           
 void write(AnnotationFile af, java.io.Writer out)
          Writes the contents of the AnnotationFile to the Writer specified by out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TXT_EXTENSION

public static final java.lang.String TXT_EXTENSION
See Also:
Constant Field Values

SGM_EXTENSION

public static final java.lang.String SGM_EXTENSION
See Also:
Constant Field Values
Constructor Detail

TextFileFormat

public TextFileFormat()
Method Detail

getInstance

public static SourceFileFormat getInstance()

getIcon

public javax.swing.Icon getIcon(boolean gold,
                                boolean loaded,
                                boolean loading)
Description copied from interface: FileFormat
Returns an icon to be displayed with files of this type.

Specified by:
getIcon in interface FileFormat
Parameters:
gold - true if this is a gold file.
loaded - true if this file has been loaded.
loading - true if this file is loading.
Returns:
the icon to be display with files of this type.

setOtherFileFormats

public void setOtherFileFormats(java.util.List otherFileFormats)

read

public java.lang.String read(java.lang.String source,
                             java.lang.String encoding)
Description copied from interface: SourceFileFormat
Reads the source file specified by the parameter source.

Specified by:
read in interface SourceFileFormat
Parameters:
source - the name of the file which contains the source.
encoding - the encoding which should be used to read the source file.
Returns:
A string containing the source.

write

public void write(AnnotationFile af,
                  java.io.Writer out)
           throws java.io.IOException
Description copied from interface: FileFormat
Writes the contents of the AnnotationFile to the Writer specified by out. This method should not close the Writer.

Specified by:
write in interface FileFormat
Parameters:
af - the annotation file.
out - the Writer to which the file should be written.
Throws:
java.io.IOException

getFileFilter

public javax.swing.filechooser.FileFilter getFileFilter()
Description copied from interface: FileFormat
Returns the file filter for this file format.

Specified by:
getFileFilter in interface FileFormat
Returns:
the file filter for this file format.

getFormatName

public java.lang.String getFormatName()
Description copied from interface: FileFormat
Returns the name of the file format.

Specified by:
getFormatName in interface FileFormat
Returns:
the name of the file format.

getExtension

public java.lang.String getExtension()
Description copied from interface: FileFormat
Returns the default file extension for files in this format. The extension should not include the period.

Specified by:
getExtension in interface FileFormat
Returns:
The file extension for in this format.

handlesFile

public boolean handlesFile(java.lang.String af)
Description copied from interface: FileFormat
Returns true if this can open the file specified by af.

Specified by:
handlesFile in interface FileFormat
Returns:
true if this can open the file specified by af, false otherwise.

addProgressListener

public void addProgressListener(ProgressListener pl)
Specified by:
addProgressListener in interface FileFormat

removeProgressListener

public void removeProgressListener(ProgressListener pl)
Specified by:
removeProgressListener in interface FileFormat


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