Interface BeanTableModel<T>
-
- Type Parameters:
T- the class representing a row in the table
- All Superinterfaces:
javax.swing.table.TableModel
- All Known Subinterfaces:
ChangeBufferTableModel<T>,SectionTableModel<T>
- All Known Implementing Classes:
BeanListMultimapTableModel,BeanListTableModel,BufferedBeanListTableModel,BufferedHeaderDetailTableModel,HeaderDetailTableModel,ValidatedBeanListTableModel
public interface BeanTableModel<T> extends javax.swing.table.TableModelInterface for aTableModelthat uses a list of beans for the row data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TgetBean(int index)Get the bean at the specified index.intgetBeanCount()Get the number of beans in the model.java.awt.CursorgetCursor(java.awt.event.MouseEvent event, javax.swing.JTable table, int rowIndex, int columnIndex)Get the mouse cursor to display for a cell.java.lang.ObjectgetValue(T bean, int columnIndex)Get a column cell value for a bean.voidhandleClick(java.awt.event.MouseEvent event, javax.swing.JTable table, int rowIndex, int columnIndex)Handle a mouse click on a cell.voidsetBeans(java.util.Collection<T> beans)Replace all rows of the table model.voidupdateBeans(java.util.Collection<T> beans, java.util.function.BiPredicate<T,T> isEqual)Update existing rows and add missing rows to the table model.
-
-
-
Method Detail
-
getBeanCount
int getBeanCount()
Get the number of beans in the model. Need not be the same as the number of the rows in the table.
-
getBean
T getBean(int index)
Get the bean at the specified index.- Parameters:
index- the index of the bean.
-
getValue
java.lang.Object getValue(T bean, int columnIndex)
Get a column cell value for a bean.
-
setBeans
void setBeans(java.util.Collection<T> beans)
Replace all rows of the table model.- Parameters:
beans- the new rows
-
updateBeans
void updateBeans(java.util.Collection<T> beans, java.util.function.BiPredicate<T,T> isEqual)
Update existing rows and add missing rows to the table model.- Parameters:
beans- beans to update/appendisEqual- used to determine if a row is already in the model
-
getCursor
java.awt.Cursor getCursor(java.awt.event.MouseEvent event, javax.swing.JTable table, int rowIndex, int columnIndex)Get the mouse cursor to display for a cell.- Parameters:
rowIndex- the row index of the cellcolumnIndex- the column index of the cell- Returns:
- the mouse cursor to use for the cell or
nullto use the default cursor.
-
handleClick
void handleClick(java.awt.event.MouseEvent event, javax.swing.JTable table, int rowIndex, int columnIndex)Handle a mouse click on a cell.- Parameters:
event- the click eventrowIndex- the row containing the cellcolumnIndex- the column index of the cell
-
-