net.sourceforge.jaulp.swing.tablemodel
Class GenericTableModel<T>

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by net.sourceforge.jaulp.swing.tablemodel.GenericTableModel<T>
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public abstract class GenericTableModel<T>
extends javax.swing.table.AbstractTableModel

The Class GenericTableModel.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
GenericTableModel()
          Instantiates a new generic table model.
GenericTableModel(java.util.List<T> list)
          Instantiates a new generic table model.
 
Method Summary
 void add(T row)
          Adds the row.
 void addList(java.util.List<T> list)
          Adds the list.
 void clear()
          Removes all data from this table model.
 T get(int row)
          Gets the row from the given index.
 java.util.List<T> getData()
          Gets the data.
 int getRowCount()
          
 T remove(T row)
          Removes the given Object.
 java.util.List<T> removeAll(int[] selectedRows)
          Removes the all.
 java.util.List<T> removeAll(java.util.List<T> toRemove)
          Removes the all the given Object.
 T removeAt(int row)
          Removes the row at the given index.
 void setData(java.util.List<T> data)
          Sets the data.
 void update(T row)
          Update the row.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
getColumnCount, getValueAt
 

Constructor Detail

GenericTableModel

public GenericTableModel()
Instantiates a new generic table model.


GenericTableModel

public GenericTableModel(java.util.List<T> list)
Instantiates a new generic table model.

Parameters:
list - The list with the data to set.
Method Detail

add

public void add(T row)
Adds the row.

Parameters:
row - the row to add.

addList

public void addList(java.util.List<T> list)
Adds the list.

Parameters:
list - the list of rows to add.

clear

public void clear()
Removes all data from this table model.


get

public T get(int row)
Gets the row from the given index.

Parameters:
row - The index from the row to get.
Returns:
the row from the given index.

getData

public java.util.List<T> getData()
Gets the data.

Returns:
the data

getRowCount

public int getRowCount()

Returns:
the row count
See Also:
TableModel.getRowCount()

remove

public T remove(T row)
Removes the given Object.

Parameters:
row - the row
Returns:
the removed Object or null if the object is not in the tablemodel.

removeAll

public java.util.List<T> removeAll(int[] selectedRows)
Removes the all.

Parameters:
selectedRows - the selected rows
Returns:
the list< t>

removeAll

public java.util.List<T> removeAll(java.util.List<T> toRemove)
Removes the all the given Object.

Parameters:
toRemove - the to remove
Returns:
the list< t> the removed Objects.

removeAt

public T removeAt(int row)
Removes the row at the given index.

Parameters:
row - The index from the row to remove.
Returns:
the removed row at the given index.

setData

public void setData(java.util.List<T> data)
Sets the data.

Parameters:
data - the new data

update

public void update(T row)
Update the row.

Parameters:
row - the row


Copyright © 2010. All Rights Reserved.