public class MTBTableModel extends DefaultTableModel
The class implements a table model for data results in
MiToBo. One main feature is the dynamic reallocation
of memory when inserting new data.
Objects of this class can be integrated in graphical
user interfaces by using class MTBTableWindow
.
Modifier and Type | Field and Description |
---|---|
protected int |
cols
Number of columns of the table.
|
protected Object[][] |
data
The data contained in the table.
|
protected de.unihalle.informatik.Alida.dataio.provider.swing.components.ALDTableWindow.TableModelDelimiter |
delimiter
Delimiter to be used when exporting the model.
|
protected Vector<String> |
headerStrings
Header defines.
|
protected int |
rows
Number of rows of the table.
|
columnIdentifiers, dataVector
listenerList
Constructor and Description |
---|
MTBTableModel(int r,
int c)
Default constructor.
|
MTBTableModel(int r,
int c,
Vector<String> headers)
Constructor with given header strings.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Deletes all(!)
|
int |
getColumnCount() |
String |
getColumnName(int col) |
de.unihalle.informatik.Alida.dataio.provider.swing.components.ALDTableWindow.TableModelDelimiter |
getDelimiter()
Returns the currently chosen delimiter.
|
int |
getRowCount() |
Object |
getValueAt(int row,
int col) |
void |
insertData(Vector<Object[]> resultData)
Appends a set of results to the table, i.e. adds a new row at the end.
|
void |
saveTable(File file)
Saves the contents of the table to given file, TSV format.
|
void |
setColumnName(int col,
String name)
Sets the header of column to specified string.
|
void |
setDelimiter(de.unihalle.informatik.Alida.dataio.provider.swing.components.ALDTableWindow.TableModelDelimiter delim)
Configure the delimiter to be used when exporting the table.
|
void |
setValueAt(Object o,
int row,
int col) |
StringBuffer[] |
tableToString()
Converts the contents of the table to a string array
in CSV format (suitable for import in Excel).
|
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getDataVector, insertRow, insertRow, isCellEditable, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
protected int rows
protected int cols
protected Object[][] data
protected de.unihalle.informatik.Alida.dataio.provider.swing.components.ALDTableWindow.TableModelDelimiter delimiter
public MTBTableModel(int r, int c)
r
- Initial number of rows.c
- Initial number of columns.public void setDelimiter(de.unihalle.informatik.Alida.dataio.provider.swing.components.ALDTableWindow.TableModelDelimiter delim)
delim
- Delimiter type to use.public de.unihalle.informatik.Alida.dataio.provider.swing.components.ALDTableWindow.TableModelDelimiter getDelimiter()
public String getColumnName(int col)
getColumnName
in interface TableModel
getColumnName
in class DefaultTableModel
public void setColumnName(int col, String name)
col
- Index of column.name
- New title string.public int getColumnCount()
getColumnCount
in interface TableModel
getColumnCount
in class DefaultTableModel
public int getRowCount()
getRowCount
in interface TableModel
getRowCount
in class DefaultTableModel
public Object getValueAt(int row, int col)
getValueAt
in interface TableModel
getValueAt
in class DefaultTableModel
public void setValueAt(Object o, int row, int col)
setValueAt
in interface TableModel
setValueAt
in class DefaultTableModel
public void insertData(Vector<Object[]> resultData)
resultData
- Result data to be appended.public void clear()
public void saveTable(File file)
public StringBuffer[] tableToString()
For separating the columns the formerly configured delimiter is used, e.g., tabulators or just spaces.
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.