Class SpectrumTableModel

  • All Implemented Interfaces:
    adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.data.spreadsheet.SpreadSheetSupporter, Serializable, TableModel

    public class SpectrumTableModel
    extends adams.gui.core.AbstractBaseTableModel
    Table model for displaying a spectrum in a table.
    Version:
    $Revision: 1286 $
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Data

        protected Spectrum m_Data
        the underlying spectrum.
    • Constructor Detail

      • SpectrumTableModel

        public SpectrumTableModel()
        Initializes the model with no spectrum.
      • SpectrumTableModel

        public SpectrumTableModel​(Spectrum data)
        Initializes the model with the specified spectrum.
        Parameters:
        data - the spectrum to display
    • Method Detail

      • getRowCount

        public int getRowCount()
        Returns the number of rows in the model.
        Returns:
        the number of rows in the model
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the model.
        Returns:
        the number of columns in the model
      • getColumnName

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

        public Class getColumnClass​(int columnIndex)
        Returns the most specific superclass for all the cell values in the column. This is used by the JTable to set up a default renderer and editor for the column.
        Specified by:
        getColumnClass in interface TableModel
        Overrides:
        getColumnClass in class AbstractTableModel
        Parameters:
        columnIndex - the index of the column
        Returns:
        the common ancestor class of the object values in the model.
      • getValueAt

        public Object getValueAt​(int rowIndex,
                                 int columnIndex)
        Returns the value for the cell at columnIndex and rowIndex.
        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
      • getData

        public Spectrum getData()
        Returns the underlying spectrum.
        Returns:
        the spectrum, null if none available