Class BeanListTableModel<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected BeanTableAdapter<T> beanTableAdapter  
      • Fields inherited from class javax.swing.table.AbstractTableModel

        listenerList
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRow​(int row, T bean)  
      void addRow​(T bean)  
      T getBean​(int index)
      Get the bean at the specified index.
      int getBeanCount()
      Get the number of beans in the model.
      java.util.List<T> getBeans()  
      protected ColumnAdapter<? super T,​?> getColumnAdapter​(int index)  
      java.lang.Class<?> getColumnClass​(int columnIndex)  
      int getColumnCount()  
      ColumnAdapter<? super T,​?> getColumnIdentifier​(int columnIndex)  
      java.lang.String getColumnName​(int columnIndex)  
      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.
      T getRow​(int index)  
      int getRowCount()  
      java.lang.Object getValue​(T row, int columnIndex)
      Get a column cell value for a bean.
      java.lang.Object getValueAt​(int rowIndex, int columnIndex)  
      void handleClick​(java.awt.event.MouseEvent event, javax.swing.JTable table, int rowIndex, int columnIndex)
      Handle a mouse click on a cell.
      int indexOf​(T bean)  
      boolean isCellEditable​(int rowIndex, int columnIndex)  
      protected void notifyDataProviders​(T row, java.lang.String columnId, java.lang.Object oldValue)  
      void removeAll​(java.lang.Iterable<T> rowBeans)  
      void removeRow​(T bean)  
      protected void removeRowAt​(int index)  
      void setBeans​(java.util.Collection<T> beans)
      Replace all rows of the table model.
      void setRow​(int row, T bean)  
      protected void setValue​(java.lang.Object value, int rowIndex, int columnIndex)  
      void setValueAt​(java.lang.Object value, int rowIndex, int columnIndex)  
      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.
      • Methods inherited from class javax.swing.table.AbstractTableModel

        addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.table.TableModel

        addTableModelListener, removeTableModelListener
    • Constructor Detail

      • BeanListTableModel

        public BeanListTableModel​(java.util.List<? extends ColumnAdapter<? super T,​?>> columnAdapters)
      • BeanListTableModel

        public BeanListTableModel​(java.util.List<? extends ColumnAdapter<? super T,​?>> columnAdapters,
                                  java.lang.Iterable<? extends TableDataProvider<T>> dataProviders)
    • Method Detail

      • getBeanCount

        public int getBeanCount()
        Description copied from interface: BeanTableModel
        Get the number of beans in the model. Need not be the same as the number of the rows in the table.
        Specified by:
        getBeanCount in interface BeanTableModel<T>
      • getBean

        public T getBean​(int index)
        Description copied from interface: BeanTableModel
        Get the bean at the specified index.
        Specified by:
        getBean in interface BeanTableModel<T>
        Parameters:
        index - the index of the bean.
      • getRowCount

        public int getRowCount()
        Specified by:
        getRowCount in interface javax.swing.table.TableModel
      • getColumnAdapter

        protected ColumnAdapter<? super T,​?> getColumnAdapter​(int index)
      • getColumnCount

        public int getColumnCount()
        Specified by:
        getColumnCount in interface javax.swing.table.TableModel
      • getColumnName

        public java.lang.String getColumnName​(int columnIndex)
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int columnIndex)
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
      • isCellEditable

        public boolean isCellEditable​(int rowIndex,
                                      int columnIndex)
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.AbstractTableModel
      • getCursor

        public java.awt.Cursor getCursor​(java.awt.event.MouseEvent event,
                                         javax.swing.JTable table,
                                         int rowIndex,
                                         int columnIndex)
        Description copied from interface: BeanTableModel
        Get the mouse cursor to display for a cell.
        Specified by:
        getCursor in interface BeanTableModel<T>
        rowIndex - the row index of the cell
        columnIndex - the column index of the cell
        Returns:
        the mouse cursor to use for the cell or null to use the default cursor.
      • handleClick

        public void handleClick​(java.awt.event.MouseEvent event,
                                javax.swing.JTable table,
                                int rowIndex,
                                int columnIndex)
        Description copied from interface: BeanTableModel
        Handle a mouse click on a cell.
        Specified by:
        handleClick in interface BeanTableModel<T>
        Parameters:
        event - the click event
        rowIndex - the row containing the cell
        columnIndex - the column index of the cell
      • getRow

        public T getRow​(int index)
      • setRow

        public void setRow​(int row,
                           T bean)
      • getValueAt

        public java.lang.Object getValueAt​(int rowIndex,
                                           int columnIndex)
        Specified by:
        getValueAt in interface javax.swing.table.TableModel
      • setValueAt

        public void setValueAt​(java.lang.Object value,
                               int rowIndex,
                               int columnIndex)
        Specified by:
        setValueAt in interface javax.swing.table.TableModel
        Overrides:
        setValueAt in class javax.swing.table.AbstractTableModel
      • setValue

        protected void setValue​(java.lang.Object value,
                                int rowIndex,
                                int columnIndex)
      • notifyDataProviders

        protected void notifyDataProviders​(T row,
                                           java.lang.String columnId,
                                           java.lang.Object oldValue)
      • getValue

        public java.lang.Object getValue​(T row,
                                         int columnIndex)
        Description copied from interface: BeanTableModel
        Get a column cell value for a bean.
        Specified by:
        getValue in interface BeanTableModel<T>
      • getBeans

        public java.util.List<T> getBeans()
      • setBeans

        public void setBeans​(java.util.Collection<T> beans)
        Description copied from interface: BeanTableModel
        Replace all rows of the table model.
        Specified by:
        setBeans in interface BeanTableModel<T>
        Parameters:
        beans - the new rows
      • indexOf

        public int indexOf​(T bean)
      • addRow

        public void addRow​(T bean)
      • addRow

        public void addRow​(int row,
                           T bean)
      • updateBeans

        public void updateBeans​(java.util.Collection<T> beans,
                                java.util.function.BiPredicate<T,​T> isEqual)
        Description copied from interface: BeanTableModel
        Update existing rows and add missing rows to the table model.
        Specified by:
        updateBeans in interface BeanTableModel<T>
        Parameters:
        beans - beans to update/append
        isEqual - used to determine if a row is already in the model
      • removeRow

        public void removeRow​(T bean)
      • removeRowAt

        protected void removeRowAt​(int index)
      • removeAll

        public void removeAll​(java.lang.Iterable<T> rowBeans)