Class LocalObjectTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
org.ka2ddo.yaac.gui.LocalObjectTableModel
All Implemented Interfaces:
Serializable, TableModel, LocalObjectTracker.LocalObjectListener, FastComparableTableModel, ExtraColumnProviderChangeListener, ClearableTableModel

This class provides the table information for displaying all locally managed Objects/Items.
Author:
Andrew Pavlin, KA2DDO
See Also:
  • Method Details

    • getColumnCount

      public int getColumnCount()
      Returns the number of columns in the model.
      Specified by:
      getColumnCount in interface TableModel
      Returns:
      the number of columns in the model
      See Also:
    • getColumnClass

      public Class<?> getColumnClass(int columnIndex)
      Returns the Class for interpreting the value of the specified column
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AbstractTableModel
      Parameters:
      columnIndex - the column being queried
      Returns:
      the Class for the specified column
    • getColumnName

      public String getColumnName(int column)
      Returns the name for the column,
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
      Parameters:
      column - the column being queried
      Returns:
      a string containing the name of column
    • getRowCount

      public int getRowCount()
      Returns the number of rows in the model. A JTable uses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.
      Specified by:
      getRowCount in interface TableModel
      Returns:
      the number of rows in the model
      See Also:
    • getValueAt

      public Object getValueAt(int rowIndex, int columnIndex)
      Returns the value for the cell at columnIndex and rowIndex.
      Specified by:
      getValueAt in interface TableModel
      Parameters:
      rowIndex - the row whose value is to be queried
      columnIndex - the column whose value is to be queried
      Returns:
      the value Object at the specified cell
    • isCellEditable

      public boolean isCellEditable(int rowIndex, int columnIndex)
      Reports whether the specified cell can be modified by the user.
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class AbstractTableModel
      Parameters:
      rowIndex - the row being queried
      columnIndex - the column being queried
      Returns:
      boolean true if cell is editable
    • setValueAt

      public void setValueAt(Object aValue, int rowIndex, int columnIndex)
      Set the value of editable cells of the table.
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class AbstractTableModel
      Parameters:
      aValue - value to assign to cell
      rowIndex - row of cell
      columnIndex - column of cell
    • addTableModelListener

      public void addTableModelListener(TableModelListener l)
      Adds a listener to the list that's notified each time a change to the data model occurs.
      Specified by:
      addTableModelListener in interface TableModel
      Overrides:
      addTableModelListener in class AbstractTableModel
      Parameters:
      l - the TableModelListener
    • removeTableModelListener

      public void removeTableModelListener(TableModelListener l)
      Removes a listener from the list that's notified each time a change to the data model occurs.
      Specified by:
      removeTableModelListener in interface TableModel
      Overrides:
      removeTableModelListener in class AbstractTableModel
      Parameters:
      l - the TableModelListener
    • deleteAllRows

      public int deleteAllRows(ClearableTableModel.ClearType clearType)
      Delete all rows from this table.
      Specified by:
      deleteAllRows in interface ClearableTableModel
      Parameters:
      clearType - type of rows to be deleted
      Returns:
      number of rows deleted
    • tableCanContainPlayback

      public boolean tableCanContainPlayback()
      Identifies whether this table can contain playback (historical) data.
      Specified by:
      tableCanContainPlayback in interface ClearableTableModel
      Returns:
      boolean true if table can contain playback data.
    • tableCanContainRealtime

      public boolean tableCanContainRealtime()
      Identifies whether this table can contain realtime data.
      Specified by:
      tableCanContainRealtime in interface ClearableTableModel
      Returns:
      boolean true if table can contain realtime data.
    • objectAdded

      public void objectAdded(int index, LocalObjectTracker.ObjectLink objectLink)
      Report that an Object was added to the LocalObjectTracker.
      Specified by:
      objectAdded in interface LocalObjectTracker.LocalObjectListener
      Parameters:
      index - zero-based index into tracker list
      objectLink - ObjectLink containing the new Object
    • objectModified

      public void objectModified(int index, LocalObjectTracker.ObjectLink objectLink)
      Report that an Object was modified in the LocalObjectTracker.
      Specified by:
      objectModified in interface LocalObjectTracker.LocalObjectListener
      Parameters:
      index - zero-based index into tracker list
      objectLink - ObjectLink containing the modified Object
    • objectDeleted

      public void objectDeleted(int index, LocalObjectTracker.ObjectLink objectLink)
      Report that an Object was deleted from the LocalObjectTracker.
      Specified by:
      objectDeleted in interface LocalObjectTracker.LocalObjectListener
      Parameters:
      index - zero-based index into tracker list
      objectLink - ObjectLink containing the deleted Object
    • compareRows

      public int compareRows(int rowIndex1, int rowIndex2, int columnIndex)
      Compare the selected column of the two rows.
      Specified by:
      compareRows in interface FastComparableTableModel
      Parameters:
      rowIndex1 - zero-based model row index of first row to compare
      rowIndex2 - zero-based model row index of second row to compare
      columnIndex - zero-based model column index of column to compare
      Returns:
      +1 if the 1st row's column is after the 2nd row's column, -1 if before, or 0 if equal precedence
    • columnListChanged

      public void columnListChanged(ExtraColumnProvider provider, GuiContentType guiContentType)
      This method is called by an ExtraColumnProvider when its set of columns changes. Note this does not mean the values of individual rows for the column, but when the presence/absence, data type, or column name of any column provided by this provider is modified. Typically, this event would cause a table model data structure change on tables using these columns.
      Specified by:
      columnListChanged in interface ExtraColumnProviderChangeListener
      Parameters:
      provider - the ExtraColumnProvider reporting the change
      guiContentType - the GuiContentType of the set of modified extra columns
    • cellValueChanged

      public void cellValueChanged(ExtraColumnProvider provider, GuiContentType guiContentType, int extraColumnIndex, SupportsExtraData rowData)
      This method is cslled by an ExtraColumnProvider when the value in a cell of an extra column changes (corresponding to a TableModelEvent.UPDATE on the displaying table's model). Allows ExtraColumnProvider instances to have dynamically changing values.
      Specified by:
      cellValueChanged in interface ExtraColumnProviderChangeListener
      Parameters:
      provider - the ExtraColumnProvider reporting the change
      guiContentType - the GuiContentType of the set of extra columns
      extraColumnIndex - zero-based index of extra column from this provider that changed
      rowData - SupportsExtraData object for the modified row, or null for all rows