Package adams.gui.selection
Class FieldCacheTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.selection.AbstractTableBasedSelectionPanel.AbstractSelectionTableModel<AbstractField>
-
- adams.gui.selection.FieldCacheTableModel
-
- All Implemented Interfaces:
LoggingLevelHandler
,LoggingSupporter
,SpreadSheetSupporter
,ComparableTableModel
,CustomSearchTableModel
,Serializable
,TableModel
public class FieldCacheTableModel extends AbstractTableBasedSelectionPanel.AbstractSelectionTableModel<AbstractField> implements ComparableTableModel
Table model for displaying the fields from a cache item.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_DatabaseURL
the database URL.protected DataType
m_DataType
the data type in use (if any).protected Hashtable<FieldType,List<AbstractField>>
m_Fields
the fields to display.protected FieldType
m_FieldType
the field type to use.-
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 FieldCacheTableModel(AbstractFieldCacheItem cache, FieldType fieldType, DataType dataType)
the constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class
getColumnClass(int columnIndex)
Returns the class type of the column.int
getColumnCount()
Returns the number of columns in the table, i.e., 1.String
getColumnName(int column)
Returns the name of the column.Class
getComparisonColumnClass(int columnIndex)
Returns the class type of the column that is used for comparisons.Object
getComparisonValueAt(int row, int column)
Returns the field at the given position.String
getDatabaseURL()
Returns the database URL this table model was created with.DataType
getDataType()
Returns the data type.FieldType
getFieldType()
Returns the field type.AbstractField
getItemAt(int row)
Returns the field at the specified position.int
getRowCount()
Returns the actual number of entries in the table.Object
getValueAt(int row, int column)
Returns the field at the given position.int
indexOf(AbstractField t)
Returns the index of the given (visible) field, -1 if not found.boolean
isSearchMatch(SearchParameters params, int row)
Tests whether the search matches the specified row.void
setDataType(DataType value)
Sets the data type.void
setFieldType(FieldType value)
Sets the field type.-
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
-
-
-
-
Field Detail
-
m_DatabaseURL
protected String m_DatabaseURL
the database URL.
-
m_Fields
protected Hashtable<FieldType,List<AbstractField>> m_Fields
the fields to display.
-
m_FieldType
protected FieldType m_FieldType
the field type to use.
-
m_DataType
protected DataType m_DataType
the data type in use (if any).
-
-
Constructor Detail
-
FieldCacheTableModel
public FieldCacheTableModel(AbstractFieldCacheItem cache, FieldType fieldType, DataType dataType)
the constructor.- Parameters:
cache
- the cachefieldType
- the fieldtypedataType
- the data type to display, use null for all
-
-
Method Detail
-
getDatabaseURL
public String getDatabaseURL()
Returns the database URL this table model was created with.- Returns:
- the database URL
-
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., 1.- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- the number of columns, always 1
-
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
-
getComparisonColumnClass
public Class getComparisonColumnClass(int columnIndex)
Returns the class type of the column that is used for comparisons.- Specified by:
getComparisonColumnClass
in interfaceComparableTableModel
- 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 field at the given position.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
row
- the rowcolumn
- the column (ignored, since only 1 column)- Returns:
- the field
-
getComparisonValueAt
public Object getComparisonValueAt(int row, int column)
Returns the field at the given position.- Specified by:
getComparisonValueAt
in interfaceComparableTableModel
- Parameters:
row
- the rowcolumn
- the column (ignored, since only 1 column)- Returns:
- the field
-
getItemAt
public AbstractField getItemAt(int row)
Returns the field at the specified position.- Specified by:
getItemAt
in classAbstractTableBasedSelectionPanel.AbstractSelectionTableModel<AbstractField>
- Parameters:
row
- the (actual, not visible) position of the field- Returns:
- the Field at the position, null if not valid index
-
indexOf
public int indexOf(AbstractField t)
Returns the index of the given (visible) field, -1 if not found.- Specified by:
indexOf
in classAbstractTableBasedSelectionPanel.AbstractSelectionTableModel<AbstractField>
- Parameters:
t
- the field to look for- Returns:
- the index, -1 if not found
-
isSearchMatch
public boolean isSearchMatch(SearchParameters params, int row)
Tests whether the search matches the specified row.- Specified by:
isSearchMatch
in interfaceCustomSearchTableModel
- Parameters:
params
- the search parametersrow
- the row of the underlying, unsorted model- Returns:
- true if the search matches this row
-
setFieldType
public void setFieldType(FieldType value)
Sets the field type.- Parameters:
value
- the new field type
-
getFieldType
public FieldType getFieldType()
Returns the field type.- Returns:
- the current field type
-
setDataType
public void setDataType(DataType value)
Sets the data type.- Parameters:
value
- the new data type
-
getDataType
public DataType getDataType()
Returns the data type.- Returns:
- the current data type
-
-