org.jscience.io
Class FileTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by org.jscience.io.FileTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class FileTableModel
extends javax.swing.table.DefaultTableModel

creates an in-memory TableModel based on an import file where the first line contains headers

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
FileTableModel(java.io.File file, boolean firstLineContainsHeader, java.lang.String fieldSeparator, boolean usesQuotes)
          Creates a new FileTableModel object.
FileTableModel(java.io.File file, java.lang.String fieldSeparator, boolean usesQuotes)
          assumes that the first line contains header
FileTableModel(javax.swing.table.TableModel model)
          enables to create a FileTableModel from any model, so that it can be saved as a file
 
Method Summary
 void saveToFile(java.io.File file, java.lang.String fieldSeparator, boolean usesQuotes)
          will always write a header line.
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, isCellEditable, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTableModel

public FileTableModel(javax.swing.table.TableModel model)
enables to create a FileTableModel from any model, so that it can be saved as a file


FileTableModel

public FileTableModel(java.io.File file,
                      java.lang.String fieldSeparator,
                      boolean usesQuotes)
               throws java.io.IOException
assumes that the first line contains header

Throws:
java.io.IOException

FileTableModel

public FileTableModel(java.io.File file,
                      boolean firstLineContainsHeader,
                      java.lang.String fieldSeparator,
                      boolean usesQuotes)
               throws java.io.IOException
Creates a new FileTableModel object.

Parameters:
file - DOCUMENT ME!
firstLineContainsHeader - DOCUMENT ME!
fieldSeparator - DOCUMENT ME!
usesQuotes - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!
Method Detail

saveToFile

public void saveToFile(java.io.File file,
                       java.lang.String fieldSeparator,
                       boolean usesQuotes)
                throws java.io.IOException
will always write a header line. If the model didn't contain header, some default header will be provided (1, 2, ..).

Parameters:
file - DOCUMENT ME!
fieldSeparator - DOCUMENT ME!
usesQuotes - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!