be.ac.ulg.montefiore.run.totem.visualtopo.guiComponents.domainTables.tableExport
Class TxtTableExporter

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.visualtopo.guiComponents.domainTables.tableExport.TxtTableExporter
All Implemented Interfaces:
TableExporter

public class TxtTableExporter
extends java.lang.Object
implements TableExporter

Exports a Jtable as a text file. Intended to work with tables that use row selections. If some rows are selected, only those ones are exported. In none is selected, the whole table is exported.

The first record will contain the column names beginning with a LINE_COMMENT and separated by a COL_DELIMITER. Then a ROW_DELIMITER is written. Each row of the table is represented by their cell values separated by a COL_DELIMITER and the rows are separated by a ROW_DELIMITER.

Creation date: 27/04/2007

Author:
Gaƫl Monfort (monfort@run.montefiore.ulg.ac.be)

Field Summary
static java.lang.String COL_DELIMITER
           
static java.lang.String LINE_COMMENT
           
static java.lang.String ROW_DELIMITER
           
 
Constructor Summary
TxtTableExporter()
           
 
Method Summary
 void export(java.io.File file, javax.swing.JTable table)
          Exports the given table to the given text file.
 void export(java.lang.String fileName, javax.swing.JTable table)
          Exports the given table to the given text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROW_DELIMITER

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

COL_DELIMITER

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

LINE_COMMENT

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

TxtTableExporter

public TxtTableExporter()
Method Detail

export

public void export(java.lang.String fileName,
                   javax.swing.JTable table)
            throws java.io.IOException
Exports the given table to the given text file.

Specified by:
export in interface TableExporter
Parameters:
fileName - Name of the file
table - Table to export
Throws:
java.io.IOException - Thrown if an error occurs while writing to the file.

export

public void export(java.io.File file,
                   javax.swing.JTable table)
            throws java.io.IOException
Exports the given table to the given text file.

Specified by:
export in interface TableExporter
Parameters:
file - a file
table - Table to export
Throws:
java.io.IOException - Thrown if an error occurs while writing to the file.


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.