Package adams.gui.selection
Class SelectSpectrumPanel.TableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.selection.AbstractTableBasedSelectionPanel.AbstractSelectionTableModel<Integer>
-
- adams.gui.selection.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 Summary
Fields Modifier and Type Field Description protected String[]
m_Format
the FORMATs to display.protected Integer[]
m_IDs
the IDs to display.protected String[]
m_SampleID
the NAMEs to display.-
Fields inherited from class adams.gui.core.AbstractBaseTableModel
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description TableModel()
default constructor.TableModel(String[] values)
the constructor.TableModel(List<String> values)
the constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the internal model.Class
getColumnClass(int columnIndex)
Returns the class type of the column.int
getColumnCount()
Returns the number of columns in the table, i.e., 3.String
getColumnName(int column)
Returns the name of the column.Integer
getItemAt(int row)
Returns the ID at the specified position.int
getRowCount()
Returns the actual number of entries in the table.Object
getValueAt(int row, int column)
Returns the ID at the given position.int
indexOf(Integer id)
Returns the index of the given (visible) ID, -1 if not found.boolean
isSearchMatch(adams.gui.core.SearchParameters params, int row)
Tests whether the search matches the specified row.-
Methods inherited from class adams.gui.core.AbstractBaseTableModel
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, setLoggingLevel, toSpreadSheet, toString
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
-
-
-
-
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 interfaceTableModel
- Returns:
- the number of entries
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table, i.e., 3.- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- the number of columns, always 3
-
getColumnName
public String getColumnName(int column)
Returns the name of the column.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the column to get the name for- Returns:
- the name of the column
-
getColumnClass
public Class getColumnClass(int columnIndex)
Returns the class type of the column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- 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 interfaceTableModel
- Parameters:
row
- the rowcolumn
- the column- Returns:
- the ID
-
getItemAt
public Integer getItemAt(int row)
Returns the ID at the specified position.- Specified by:
getItemAt
in classadams.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 classadams.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 interfaceadams.gui.core.CustomSearchTableModel
- Parameters:
params
- the search parametersrow
- 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 interfaceadams.gui.core.ClearableModel
-
-