Class GenericTableModel<T>
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- de.alpharogroup.swing.table.model.GenericTableModel<T>
-
- Type Parameters:
T- the generic type of the model
- All Implemented Interfaces:
java.io.Serializable,javax.swing.table.TableModel
- Direct Known Subclasses:
BaseTableModel,DynamicTableModel
public abstract class GenericTableModel<T> extends javax.swing.table.AbstractTableModelThe classGenericTableModelas the name presume it can take a generic type of the model object.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GenericTableModel()Instantiates a new generic table model.GenericTableModel(java.util.List<T> list)Instantiates a new generic table model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(T row)Adds the row.voidaddList(java.util.List<T> list)Adds the list.voidclear()Removes all data from this table model.Tget(int row)Gets the row from the given index.java.util.List<T>getData()Gets the data.intgetRowCount()Gets the row count.Tremove(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.TremoveAt(int row)Removes the row at the given index.voidsetData(java.util.List<T> data)Sets the data.voidupdate(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
-
-
-
-
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()
Gets the row count.- 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
-
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 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
-
-