www.sdmetrics.com

sdmetrics.app
Interface ExportFormatter


public interface ExportFormatter

Interface to provide file format specific text markup to export measurement data tables in a particular file format. You can easily generate FileFilter objects for Swing file chooser dialogs using methods accept(java.io.File) and getDescription().


Method Summary
 boolean accept(java.io.File f)
          Test if a file is of the appropriate type based on its file extension.
 boolean accept(java.lang.String s)
          Test if a file is of the appropriate type based on its file extension.
 void endRow()
          Print formatting to end a data table row.
 void endTable()
          Print formatting to end a table.
 void exit()
          Perform any processing after an output file has been closed.
 void fileBegin(java.lang.String fname, java.io.PrintWriter out)
          Print formatting required at the beginning of a new file.
 void fileEnd()
          Print formatting to end a file.
 java.lang.String getDescription()
          Get a description string of the file format.
 java.lang.String getExtension()
          Retrieve the extension for the file format.
 boolean init(java.lang.String file, DataTable data, boolean oneOutputFile, OverwriteConfirmation ovw)
          Perform any up-front activities before the individual data files are created, such as creating an index to the files or tables.
 void newTable(java.lang.String tablename)
          Print formatting required to start a new table.
 void startRow()
          Print formatting to start a new table data row.
 void tableCell(java.lang.Object c)
          Print a table data cell.
 void tableHeader()
          Print formatting required to start the table header row.
 void tableHeaderCell(java.lang.Object c)
          Print a table header cell.
 

Method Detail

init

public boolean init(java.lang.String file,
                    DataTable data,
                    boolean oneOutputFile,
                    OverwriteConfirmation ovw)
             throws java.io.IOException
Perform any up-front activities before the individual data files are created, such as creating an index to the files or tables.

Parameters:
file - URI of the output files to be created.
data - Object holding the tables to be written.
oneOutputFile - Flag indicating if all tables are to be written in one file.
ovw - Instance to prompt user to overwrite existing files.
Returns:
true if init was performed successfully, false if init was aborted because user vetoed file overwrite
Throws:
java.io.IOException - If the specified file could not be created.

fileBegin

public void fileBegin(java.lang.String fname,
                      java.io.PrintWriter out)
Print formatting required at the beginning of a new file.

Parameters:
fname - Name of the file.
out - PrintWriter output stream to write to.

newTable

public void newTable(java.lang.String tablename)
Print formatting required to start a new table.

Parameters:
tablename - Name of the table (usually, the metamodel element type).

tableHeader

public void tableHeader()
Print formatting required to start the table header row.


tableHeaderCell

public void tableHeaderCell(java.lang.Object c)
Print a table header cell.

Parameters:
c - Cell contents.

startRow

public void startRow()
Print formatting to start a new table data row.


tableCell

public void tableCell(java.lang.Object c)
Print a table data cell.

Parameters:
c - Cell contents.

endRow

public void endRow()
Print formatting to end a data table row.


endTable

public void endTable()
Print formatting to end a table.


fileEnd

public void fileEnd()
Print formatting to end a file.


exit

public void exit()
          throws java.io.IOException
Perform any processing after an output file has been closed.

Throws:
java.io.IOException - If some post-processing performs file operations that failed.

accept

public boolean accept(java.lang.String s)
Test if a file is of the appropriate type based on its file extension.

Parameters:
s - File name to test.
Returns:
true if the file name matches the file format extension, else false.

getExtension

public java.lang.String getExtension()
Retrieve the extension for the file format.

Returns:
The file format extension for this file format.

getDescription

public java.lang.String getDescription()
Get a description string of the file format.

Returns:
Description string suitable for a file chooser dialog, e.g. "HTML File (*.html)"

accept

public boolean accept(java.io.File f)
Test if a file is of the appropriate type based on its file extension.

Parameters:
f - File to test.
Returns:
true if the file is a directory or if its name matches the file format extension, else false.

www.sdmetrics.com