Interface TableModel

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  TableModel.Cell<C>
      A lightweight class representing a row and column in a table.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <C> C getCellValue​(int rowIndex, TableColumnModel<C> column)
      Returns the cell value at the given row and column.
      <C> C getCellValue​(TableModel.Cell<C> cell)
      Returns the cell value for the given cell.
      int getColumnCount()  
      int getColumnIndex​(TableColumnModel<?> column)
      Determines the logical index of the given table column.
      java.util.List<TableColumnModel<?>> getColumns()  
      int getRowCount()  
      <C> void setCellValue​(int rowIndex, TableColumnModel<C> column, C newCellValue)
      Sets the cell value at the given row and column.
      <C> void setCellValue​(TableModel.Cell<C> cell, C newCellValue)
      Sets the cell value for the given cell.
      • 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
    • Method Detail

      • getColumnIndex

        int getColumnIndex​(TableColumnModel<?> column)
        Determines the logical index of the given table column.
        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.
      • getColumns

        java.util.List<TableColumnModel<?>> getColumns()
        Returns:
        A read-only list of table columns in physical order.
      • getRowCount

        int getRowCount()
        Returns:
        The number of rows in this table.
      • getColumnCount

        int getColumnCount()
        Returns:
        The number of columns in this table.
      • getCellValue

        <C> C getCellValue​(TableModel.Cell<C> cell)
        Returns the cell value for the given cell. This method delegates to getCellValue(int, TableColumnModel).
        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.
        Throws:
        java.lang.IndexOutOfBoundsException - if the given row index represents an invalid location for the table.
        java.lang.IllegalArgumentException - if the given column is not one of this table's columns.
      • getCellValue

        <C> C getCellValue​(int rowIndex,
                           TableColumnModel<C> column)
        Returns the cell value at the given row and column.
        Type Parameters:
        C - The type of cell values in the given column.
        Parameters:
        rowIndex - The zero-based row index.
        column - The column for which a value should be returned.
        Returns:
        The value in the cell at the given row and column, or null if there is no value in that cell.
        Throws:
        java.lang.IndexOutOfBoundsException - if the given row index represents an invalid location for the table.
        java.lang.IllegalArgumentException - if the given column is not one of this table's columns.
      • setCellValue

        <C> void setCellValue​(TableModel.Cell<C> cell,
                              C newCellValue)
        Sets the cell value for the given cell. This method delegates to setCellValue(int, TableColumnModel, Object).
        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.
        Throws:
        java.lang.IndexOutOfBoundsException - if the given row index represents an invalid location for the table.
        java.lang.IllegalArgumentException - if the given column is not one of this table's columns.
      • setCellValue

        <C> void setCellValue​(int rowIndex,
                              TableColumnModel<C> column,
                              C newCellValue)
        Sets the cell value at the given row and column.
        Type Parameters:
        C - The type of cell values in the given column.
        Parameters:
        rowIndex - The zero-based row index.
        column - The column for which a value should be returned.
        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.
        Throws:
        java.lang.IndexOutOfBoundsException - if the given row index represents an invalid location for the table.
        java.lang.IllegalArgumentException - if the given column is not one of this table's columns.