Class SelectSpectrumPanel.TableModel

  • All Implemented Interfaces:
    adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.data.spreadsheet.SpreadSheetSupporter, adams.gui.core.ClearableModel, adams.gui.core.CustomSearchTableModel, Serializable, TableModel
    Enclosing class:
    SelectSpectrumPanel

    public static class SelectSpectrumPanel.TableModel
    extends adams.gui.selection.AbstractTableBasedSelectionPanel.AbstractSelectionTableModel<Integer>
    implements adams.gui.core.ClearableModel, adams.gui.core.CustomSearchTableModel
    A simple table model for displaying the database IDs and Names.
    Version:
    $Revision: 1556 $
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_IDs

        protected Integer[] m_IDs
        the IDs to display.
      • m_SampleID

        protected String[] m_SampleID
        the NAMEs to display.
      • m_Format

        protected String[] m_Format
        the FORMATs to display.
    • Constructor Detail

      • TableModel

        public TableModel()
        default constructor.
      • TableModel

        public TableModel​(List<String> values)
        the constructor.
        Parameters:
        values - the IDs/Names/Instruments to display
      • TableModel

        public TableModel​(String[] values)
        the constructor.
        Parameters:
        values - the IDs/Names/Instruments to display
    • Method Detail

      • getRowCount

        public int getRowCount()
        Returns the actual number of entries in the table.
        Specified by:
        getRowCount in interface TableModel
        Returns:
        the number of entries
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the table, i.e., 3.
        Specified by:
        getColumnCount in interface TableModel
        Returns:
        the number of columns, always 3
      • getColumnClass

        public Class getColumnClass​(int columnIndex)
        Returns the class type of the column.
        Specified by:
        getColumnClass in interface TableModel
        Overrides:
        getColumnClass in class AbstractTableModel
        Parameters:
        columnIndex - the column to get the class for
        Returns:
        the class for the column
      • getValueAt

        public Object getValueAt​(int row,
                                 int column)
        Returns the ID at the given position.
        Specified by:
        getValueAt in interface TableModel
        Parameters:
        row - the row
        column - the column
        Returns:
        the ID
      • getItemAt

        public Integer getItemAt​(int row)
        Returns the ID at the specified position.
        Specified by:
        getItemAt in class adams.gui.selection.AbstractTableBasedSelectionPanel.AbstractSelectionTableModel<Integer>
        Parameters:
        row - the (actual, not visible) position of the ID
        Returns:
        the ID at the position, null if not valid index
      • indexOf

        public int indexOf​(Integer id)
        Returns the index of the given (visible) ID, -1 if not found.
        Specified by:
        indexOf in class adams.gui.selection.AbstractTableBasedSelectionPanel.AbstractSelectionTableModel<Integer>
        Parameters:
        id - the ID to look for
        Returns:
        the index, -1 if not found
      • isSearchMatch

        public boolean isSearchMatch​(adams.gui.core.SearchParameters params,
                                     int row)
        Tests whether the search matches the specified row.
        Specified by:
        isSearchMatch in interface adams.gui.core.CustomSearchTableModel
        Parameters:
        params - the search parameters
        row - the row of the underlying, unsorted model
        Returns:
        true if the search matches this row
      • clear

        public void clear()
        Clears the internal model.
        Specified by:
        clear in interface adams.gui.core.ClearableModel