Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table
Class DefaultListTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by com.citra.table.DefaultListTableModel
All Implemented Interfaces:
ListTableModel, Serializable, TableModel

public class DefaultListTableModel
extends DefaultTableModel
implements ListTableModel

DefaultListTableModel is a subclass of DefaultTableModel that implements ListTableModel. This makes it possible for this class to be used with other classes in this library, i.e. ListTableMap, SortTableModel and FilterTableModel.

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
DefaultListTableModel()
          Constructs a default DefaultListTableModel which is a table of zero columns and zero rows.
DefaultListTableModel(int numRows, int numColumns)
          Constructs a DefaultListTableModel with numRows and numColumns of null object values.
DefaultListTableModel(Object[][] data, Object[] columnNames)
          Constructs a DefaultListTableModel and initializes the table by passing data and columnNames to the setDataVector() method.
DefaultListTableModel(Object[] columnNames, int numRows)
          Constructs a DefaultListTableModel with as many columns as there are elements in columnNames and numRows of null object values.
DefaultListTableModel(Vector columnNames, int numRows)
          Constructs a DefaultTableModel with as many columns as there are elements in columnNames and numRows of null object values.
DefaultListTableModel(Vector data, Vector columnNames)
          Constructs a DefaultListTableModel and initializes the table by passing data and columnNames to the setDataVector() method.
 
Method Summary
 void addRow(Object row)
          Adds a row to the end of the model.
 void addRows(List addedRows)
          Adds a list of rows to the end of the model.
 void clear()
          Clears the model of any data.
 Object getCellValue(Object o, int index)
          Returns the Object found at index of row passed as a parameter.
 List getRows()
          Returns the data of this tablemodel
 void removeRows(int[] deletedRows)
          Removes a few rows from the data model
 
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
 
Methods inherited from interface com.citra.table.ListTableModel
fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, removeRow
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

DefaultListTableModel

public DefaultListTableModel()
Constructs a default DefaultListTableModel which is a table of zero columns and zero rows.


DefaultListTableModel

public DefaultListTableModel(Object[][] data,
                             Object[] columnNames)
Constructs a DefaultListTableModel and initializes the table by passing data and columnNames to the setDataVector() method. The first index in the Object[][] is the row index and the second is the column index.

Parameters:
data - The data of the table
columnNames - The names of the columns.

DefaultListTableModel

public DefaultListTableModel(Object[] columnNames,
                             int numRows)
Constructs a DefaultListTableModel with as many columns as there are elements in columnNames and numRows of null object values. Each column's name will be taken from the columnNames array.

Parameters:
columnNames - Array containing the names of the new columns. If this null then the model has no columns
numRows - The number of rows the table holds

DefaultListTableModel

public DefaultListTableModel(int numRows,
                             int numColumns)
Constructs a DefaultListTableModel with numRows and numColumns of null object values.

Parameters:
numRows - The number of rows the table holds
numColumns - The number of columns the table holds

DefaultListTableModel

public DefaultListTableModel(Vector columnNames,
                             int numRows)
Constructs a DefaultTableModel with as many columns as there are elements in columnNames and numRows of null object values. Each column's name will be taken from the columnNames vector.

Parameters:
columnNames - Vector containing the names of the new columns. If this null then the model has no columns
numRows - The number of rows the table holds

DefaultListTableModel

public DefaultListTableModel(Vector data,
                             Vector columnNames)
Constructs a DefaultListTableModel and initializes the table by passing data and columnNames to the setDataVector() method.

Parameters:
data - The data of the table
columnNames - Vector containing the names of the new columns.
Method Detail

addRow

public void addRow(Object row)
Adds a row to the end of the model.

Specified by:
addRow in interface ListTableModel
Parameters:
row - the row being added

addRows

public void addRows(List addedRows)
Adds a list of rows to the end of the model.

addedRows contains objects representing the actual rows being added. e.g. Vector, for DefaultTableModel.

Specified by:
addRows in interface ListTableModel
Parameters:
addedRows - the rows being added.

clear

public void clear()
Clears the model of any data.

Specified by:
clear in interface ListTableModel

getCellValue

public Object getCellValue(Object o,
                           int index)
Returns the Object found at index of row passed as a parameter.

Specified by:
getCellValue in interface ListTableModel
Parameters:
o - the row data
index - an index
Returns:
the object found at column index of the row data row

getRows

public List getRows()
Returns the data of this tablemodel

Specified by:
getRows in interface ListTableModel
Returns:
the rows of the datamodel as a List

removeRows

public void removeRows(int[] deletedRows)
Removes a few rows from the data model

Specified by:
removeRows in interface ListTableModel
Parameters:
deletedRows - an integer array that contains indexes of the rows being deleted

Copyright © 2011 Citra Technologies. All Rights Reserved.