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_Formatthe FORMATs to display.protected Integer[]m_IDsthe IDs to display.protected String[]m_SampleIDthe 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 voidclear()Clears the internal model.ClassgetColumnClass(int columnIndex)Returns the class type of the column.intgetColumnCount()Returns the number of columns in the table, i.e., 3.StringgetColumnName(int column)Returns the name of the column.IntegergetItemAt(int row)Returns the ID at the specified position.intgetRowCount()Returns the actual number of entries in the table.ObjectgetValueAt(int row, int column)Returns the ID at the given position.intindexOf(Integer id)Returns the index of the given (visible) ID, -1 if not found.booleanisSearchMatch(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:
getRowCountin interfaceTableModel- Returns:
- the number of entries
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table, i.e., 3.- Specified by:
getColumnCountin interfaceTableModel- Returns:
- the number of columns, always 3
-
getColumnName
public String getColumnName(int column)
Returns the name of the column.- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein 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:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin 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:
getValueAtin 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:
getItemAtin 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:
indexOfin 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:
isSearchMatchin 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:
clearin interfaceadams.gui.core.ClearableModel
-
-