Package adams.gui.visualization.spectrum
Class SpectrumTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.visualization.spectrum.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 Summary
Fields Modifier and Type Field Description protected Spectrum
m_Data
the underlying spectrum.-
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 SpectrumTableModel()
Initializes the model with no spectrum.SpectrumTableModel(Spectrum data)
Initializes the model with the specified spectrum.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class
getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column.int
getColumnCount()
Returns the number of columns in the model.String
getColumnName(int column)
Returns the name of the column.Spectrum
getData()
Returns the underlying spectrum.int
getRowCount()
Returns the number of rows in the model.Object
getValueAt(int rowIndex, int columnIndex)
Returns the value for the cell atcolumnIndex
androwIndex
.-
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
-
-
-
-
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 interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- 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 theJTable
to set up a default renderer and editor for the column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- 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 atcolumnIndex
androwIndex
.- Parameters:
rowIndex
- the row whose value is to be queriedcolumnIndex
- 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
-
-