com.antelmann.io
Class FileTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
javax.swing.table.DefaultTableModel
com.antelmann.io.FileTableModel
- All Implemented Interfaces:
- Serializable, TableModel
public class FileTableModel
- extends DefaultTableModel
a table model that enables importing/exporting from/to a file easily
- Author:
- Holger Antelmann
- See Also:
- Serialized Form
|
Constructor Summary |
FileTableModel(File file,
boolean firstLineContainsHeader,
String fieldSeparator,
boolean usesQuotes)
creates an in-memory TableModel based on an import file where the first line contains headers |
FileTableModel(File file,
boolean firstLineContainsHeader,
String fieldSeparator,
boolean usesQuotes,
String charSet)
|
FileTableModel(File file,
String fieldSeparator,
boolean usesQuotes)
assumes that the first line contains header |
FileTableModel(TableModel model)
enables to create a FileTableModel from any model, so that it can be saved as a file |
|
Method Summary |
void |
saveToFile(File file,
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 |
FileTableModel
public FileTableModel(TableModel model)
- enables to create a FileTableModel from any model, so that it can be saved as a file
FileTableModel
public FileTableModel(File file,
String fieldSeparator,
boolean usesQuotes)
throws IOException
- assumes that the first line contains header
- Throws:
IOException
FileTableModel
public FileTableModel(File file,
boolean firstLineContainsHeader,
String fieldSeparator,
boolean usesQuotes)
throws IOException
- creates an in-memory TableModel based on an import file where the first line contains headers
- Throws:
IOException
FileTableModel
public FileTableModel(File file,
boolean firstLineContainsHeader,
String fieldSeparator,
boolean usesQuotes,
String charSet)
throws IOException
- Throws:
IOException
saveToFile
public void saveToFile(File file,
String fieldSeparator,
boolean usesQuotes)
throws IOException
- will always write a header line. If the model didn't contain header,
some default header will be provided (1, 2, ..).
If quotes are used, each occurence of a quote within a field is replaced by
a single quote.
- Throws:
IOException
(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads