Class AbstractTableModel

java.lang.Object
com.globalmentor.beans.BoundPropertyObject
io.guise.framework.model.AbstractModel
io.guise.framework.model.AbstractTableModel
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Model, TableModel
Direct Known Subclasses:
CalendarMonthTableModel, DefaultTableModel

public abstract class AbstractTableModel extends AbstractModel implements TableModel
An abstract implementation of a table model. The table model is editable by default.
Author:
Garret Wilson
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.guise.framework.model.TableModel

    TableModel.Cell<C>
  • Field Summary

    Fields inherited from class com.globalmentor.beans.BoundPropertyObject

    NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Columns constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Adds a column to the table.
    protected void
    Clears all columns from the table.
    <C> C
    Returns the cell value for the given cell.
    int
     
    int
    Determines the logical index of the given table column.
     
    <C> void
    setCellValue(TableModel.Cell<C> cell, C newCellValue)
    Sets the cell value for the given cell.

    Methods inherited from class io.guise.framework.model.AbstractModel

    getEventListenerManager, getPlainText

    Methods inherited from class com.globalmentor.beans.BoundPropertyObject

    addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.globalmentor.beans.PropertyBindable

    addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener

    Methods inherited from interface com.globalmentor.beans.PropertyConstrainable

    addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener

    Methods inherited from interface io.guise.framework.model.TableModel

    getCellValue, getRowCount, setCellValue
  • Constructor Details

    • AbstractTableModel

      public AbstractTableModel(TableColumnModel<?>... columns)
      Columns constructor.
      Parameters:
      columns - The models representing the table columns.
  • Method Details

    • getColumns

      public List<TableColumnModel<?>> getColumns()
      Specified by:
      getColumns in interface TableModel
      Returns:
      A read-only list of table columns in physical order.
    • getColumnIndex

      public int getColumnIndex(TableColumnModel<?> column)
      Description copied from interface: TableModel
      Determines the logical index of the given table column.
      Specified by:
      getColumnIndex in interface TableModel
      Parameters:
      column - One of the table columns.
      Returns:
      The zero-based logical index of the column within the table, or -1 if the column is not one of the model's columns.
    • getColumnCount

      public int getColumnCount()
      Specified by:
      getColumnCount in interface TableModel
      Returns:
      The number of columns in this table.
    • addColumn

      protected void addColumn(TableColumnModel<?> column)
      Adds a column to the table.
      Parameters:
      column - The column to add.
    • clearColumns

      protected void clearColumns()
      Clears all columns from the table.
    • getCellValue

      public <C> C getCellValue(TableModel.Cell<C> cell)
      Description copied from interface: TableModel
      Returns the cell value for the given cell. This method delegates to TableModel.getCellValue(int, TableColumnModel).
      Specified by:
      getCellValue in interface TableModel
      Type Parameters:
      C - The type of cell value.
      Parameters:
      cell - The cell containing the row index and column information.
      Returns:
      The value in the cell at the given row and column, or null if there is no value in that cell.
    • setCellValue

      public <C> void setCellValue(TableModel.Cell<C> cell, C newCellValue)
      Description copied from interface: TableModel
      Sets the cell value for the given cell. This method delegates to TableModel.setCellValue(int, TableColumnModel, Object).
      Specified by:
      setCellValue in interface TableModel
      Type Parameters:
      C - The type of cell value.
      Parameters:
      cell - The cell containing the row index and column information.
      newCellValue - The value to place in the cell at the given row and column, or null if there should be no value in that cell.