public class BrowseArchetypesTableModel<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
extends javax.swing.table.AbstractTableModel
TableModel
that displays a selected set of
attributes within a list of archetypes.Constructor and Description |
---|
BrowseArchetypesTableModel(ArchetypeSet<G,A,R> archetypeSet)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.lang.String attribute)
Adds a column for an attribute to the table.
|
R |
get(int index)
Return one archetype.
|
java.lang.Class<?> |
getColumnClass(int columnIndex) |
int |
getColumnCount() |
java.lang.String |
getColumnName(int column) |
int |
getRowCount() |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
java.lang.String |
removeAttribute(int index)
Removes an attribute from the table.
|
void |
saveAsCsv(java.io.File file)
Saves the current contents as a CSV file.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
public BrowseArchetypesTableModel(@NotNull ArchetypeSet<G,A,R> archetypeSet)
archetypeSet
- the archetype set from which archetypes are shownpublic int getRowCount()
public int getColumnCount()
@Nullable public java.lang.Object getValueAt(int rowIndex, int columnIndex)
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
public java.lang.Class<?> getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
public void addAttribute(@NotNull java.lang.String attribute)
attribute
- the attribute@Nullable public java.lang.String removeAttribute(int index)
index
- the index of the columnnull
if the index is invalid@NotNull public R get(int index)
index
- the table row indexpublic void saveAsCsv(@NotNull java.io.File file) throws java.io.IOException
file
- the file to write tojava.io.IOException
- if an I/O error occurs writing the file