public class TableModel<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
extends javax.swing.table.AbstractTableModel
Constructor and Description |
---|
TableModel(ArchetypeTypeSet archetypeTypeSet)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(R archetype)
Add an archetype to the model.
|
void |
clear()
Clear the model's contents.
|
int |
findTableIndex(R archetype)
Return the row index of an archetype.
|
void |
finishUpdate()
Finish updating the model's contents.
|
R |
get(int index)
Return one archetype.
|
int |
getColumnCount() |
java.lang.String |
getColumnName(int column) |
int |
getRowCount() |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
void |
sortTable()
Sort the table contents by name.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
public TableModel(ArchetypeTypeSet archetypeTypeSet)
archetypeTypeSet
- the instance for looking up archetype typespublic void clear()
public void add(@NotNull R archetype)
archetype
- the archetype to add@NotNull public R get(int index)
index
- the table row indexpublic int getColumnCount()
public int getRowCount()
@NotNull public java.lang.Object getValueAt(int rowIndex, int columnIndex)
@NotNull public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
public void sortTable()
public void finishUpdate()
add(Archetype)
. If at
least one element has been added, sortTable()
must be called
first.public int findTableIndex(@Nullable R archetype)
archetype
- the archetype to look up-1
if the archetype is not part of the
model