public class ListTableModel<Item> extends TableViewModel<Item> implements EditableModel
Constructor and Description |
---|
ListTableModel(ColumnInfo... columnInfos) |
ListTableModel(ColumnInfo [] columnNames,
java.util.List<Item> items) |
ListTableModel(ColumnInfo [] columnNames,
java.util.List<Item> items,
int selectedColumn) |
ListTableModel(ColumnInfo [] columnNames,
java.util.List<Item> items,
int selectedColumn,
javax.swing.SortOrder order) |
Modifier and Type | Method and Description |
---|---|
void |
addRow() |
void |
addRow(Item item) |
void |
addRows(java.util.Collection<? extends Item> items) |
boolean |
canExchangeRows(int oldIndex,
int newIndex) |
void |
exchangeRows(int idx1,
int idx2) |
protected java.lang.Object |
getAspectOf(int aspectIndex,
java.lang.Object item) |
java.lang.Class<?> |
getColumnClass(int columnIndex) |
int |
getColumnCount() |
ColumnInfo[] |
getColumnInfos() |
java.lang.String |
getColumnName(int column) |
javax.swing.RowSorter.SortKey |
getDefaultSortKey() |
Item |
getItem(int rowIndex) |
java.util.List<Item> |
getItems() |
int |
getRowCount() |
Item |
getRowValue(int row) |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
int |
indexOf(Item item) |
void |
insertRow(int index,
Item item) |
boolean |
isCellEditable(int rowIndex,
int columnIndex) |
boolean |
isSortable() |
void |
removeRow(int idx)
Remove row with index
idx and fire DELETE event (e.g. |
boolean |
setColumnInfos(ColumnInfo[] columnInfos)
true if changed
|
void |
setItems(java.util.List<Item> items) |
void |
setSortable(boolean aBoolean) |
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex) |
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex,
boolean notifyListeners)
Sets the value in the cell at
columnIndex and rowIndex to aValue . |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
public ListTableModel(ColumnInfo... columnInfos)
public ListTableModel(ColumnInfo [] columnNames, java.util.List<Item> items, int selectedColumn)
public ListTableModel(ColumnInfo [] columnNames, java.util.List<Item> items)
public ListTableModel(ColumnInfo [] columnNames, java.util.List<Item> items, int selectedColumn, javax.swing.SortOrder order)
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
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 ColumnInfo[] getColumnInfos()
getColumnInfos
in interface SortableColumnModel
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public javax.swing.RowSorter.SortKey getDefaultSortKey()
getDefaultSortKey
in interface SortableColumnModel
public Item getRowValue(int row)
getRowValue
in interface SortableColumnModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public void setItems(java.util.List<Item> items)
setItems
in class TableViewModel<Item>
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex, boolean notifyListeners)
columnIndex
and rowIndex
to aValue
.
This method allows to choose will the model listeners notified or not.aValue
- the new valuerowIndex
- the row whose value is to be changedcolumnIndex
- the column whose value is to be changednotifyListeners
- indicates whether the model listeners are notifiedpublic boolean setColumnInfos(ColumnInfo[] columnInfos)
public java.util.List<Item> getItems()
getItems
in class TableViewModel<Item>
protected java.lang.Object getAspectOf(int aspectIndex, java.lang.Object item)
public void setSortable(boolean aBoolean)
setSortable
in interface SortableColumnModel
public boolean isSortable()
isSortable
in interface SortableColumnModel
public int indexOf(Item item)
public void addRow()
addRow
in interface EditableModel
public void removeRow(int idx)
ItemRemovable
idx
and fire DELETE
event (e.g. by calling
AbstractTableModel.fireTableRowsDeleted(int, int)
)removeRow
in interface ItemRemovable
public void exchangeRows(int idx1, int idx2)
exchangeRows
in interface EditableModel
public boolean canExchangeRows(int oldIndex, int newIndex)
canExchangeRows
in interface EditableModel
public void addRow(Item item)
public void insertRow(int index, Item item)
public void addRows(java.util.Collection<? extends Item> items)
public Item getItem(int rowIndex)