Class DataTable.OSPDataTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
org.opensourcephysics.display.DataTable.OSPDataTableModel
All Implemented Interfaces:
Serializable, EventListener, TableModelListener, TableModel
Direct Known Subclasses:
DataToolTable.DataToolTableModel
Enclosing class:
DataTable

protected class DataTable.OSPDataTableModel extends AbstractTableModel implements TableModelListener
See Also:
  • Field Details

    • lastModelEvent

      protected TableModelEvent lastModelEvent
    • columnCount

      protected int columnCount
    • haveColumnClasses

      protected boolean haveColumnClasses
  • Constructor Details

    • OSPDataTableModel

      protected OSPDataTableModel()
  • Method Details

    • setTainted

      protected void setTainted()
      The TableModelListener will clue us in
    • setColumnSelectionFromJTable

      public void setColumnSelectionFromJTable()
    • setSelectedRowsFromJTable

      public void setSelectedRowsFromJTable()
    • getModelRow

      protected int getModelRow(int row)
      Converts a table row index to the corresponding model row number (i.e., displayed in the "row" column).
      Parameters:
      row - the table row
      Returns:
      the model row
    • addColumnSelectionInterval

      protected void addColumnSelectionInterval(int coli, int colj)
    • find

      protected org.opensourcephysics.display.DataTable.DataTableElement find(int icol)
      Find the dataTableElement associated with this column.
      Parameters:
      rowNumberVisible -
      dataTableElements -
      icol -
      Returns:
    • sort

      protected void sort(int col)
      Sorts the table rows using the given column.
      Parameters:
      col - int
    • getSortedColumn

      public int getSortedColumn()
      Gets the sorted column. Added by D Brown 2010-10-24.
      Returns:
      the
    • resetSort

      protected void resetSort()
    • getSortedRow

      protected int getSortedRow(int j)
    • setColumnVisible

      protected void setColumnVisible(TableModel model, int columnIndex, boolean b)
      Method setColumnVisible
      Parameters:
      model -
      columnIndex -
      b -
    • refreshColumnModel

      protected void refreshColumnModel()
    • setRowNumberVisible

      public void setRowNumberVisible(boolean b)
      Method setRowNumberVisible
      Parameters:
      b -
    • setValueAt

      public void setValueAt(Object value, int rowIndex, int columnIndex)
      Method setValueAt modified by Doug Brown 12/19/2013
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class AbstractTableModel
      Parameters:
      value -
      rowIndex -
      columnIndex -
    • setElementValue

      protected void setElementValue(Object value, int rowIndex, int columnIndex)
    • isRowNumberVisible

      public boolean isRowNumberVisible()
      Method isRowNumberVisible
      Returns:
    • getColumnName

      public String getColumnName(int columnIndex)
      Method getColumnName
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
      Parameters:
      columnIndex -
      Returns:
      the name
    • getRowCount

      public int getRowCount()
      Method getRowCount
      Specified by:
      getRowCount in interface TableModel
      Returns:
    • getColumnCount

      public int getColumnCount()
      Method getColumnCount
      Specified by:
      getColumnCount in interface TableModel
      Returns:
      the number of VISIBLE columns
    • getValueAt

      public Object getValueAt(int rowIndex, int columnIndex)
      Method getValueAt
      Specified by:
      getValueAt in interface TableModel
      Parameters:
      rowIndex -
      columnIndex -
      Returns:
    • getElementValue

      protected Object getElementValue(int rowIndex, int columnIndex)
    • getElementValues

      protected Object[] getElementValues(org.opensourcephysics.display.DataTable.DataTableElement dte, int columnIndex, Object[] objects)
      Get an array of column values ready for sorting.
      Parameters:
      columnIndex -
      objects -
      Returns:
    • getColumnClass

      public Class<?> getColumnClass(int columnIndex)
      Method getColumnClass
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AbstractTableModel
      Parameters:
      columnIndex -
      Returns:
    • isCellEditable

      public boolean isCellEditable(int rowIndex, int columnIndex)
      Method isCellEditable
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class AbstractTableModel
      Parameters:
      rowIndex -
      columnIndex -
      Returns:
      true if editable
    • isElementEditable

      protected boolean isElementEditable(int row, int col)
    • remove

      public void remove(TableModel tableModel)
      Method remove
      Parameters:
      tableModel -
    • clear

      public void clear()
      Method clear
    • add

      protected void add(DataTable.OSPTableModel tableModel)
      Method to add an instance of OSPTableModel, including ComplexDataSet, DataSet, DataSetManager, Histogram, or TextColumnTableModel.
      Parameters:
      tableModel -
    • findElementContaining

      protected org.opensourcephysics.display.DataTable.DataTableElement findElementContaining(TableModel tableModel)
      returns the DataTableElement that contains the specified TableModel
      Parameters:
      tableModel -
      Returns:
      Description of the Returned Value
    • tableChanged

      public void tableChanged(TableModelEvent e)
      This will be from the DataSet sub-TableModels, specifically for APPEND for now.
      Specified by:
      tableChanged in interface TableModelListener
    • isFoundOrdered

      public boolean isFoundOrdered()
    • refresh

      protected void refresh(int mask)
    • getSelectedModelRows

      protected int[] getSelectedModelRows()