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 Stringm_DatabaseURLthe database URL.protected DataTypem_DataTypethe data type in use (if any).protected Hashtable<FieldType,List<AbstractField>>m_Fieldsthe fields to display.protected FieldTypem_FieldTypethe 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 ClassgetColumnClass(int columnIndex)Returns the class type of the column.intgetColumnCount()Returns the number of columns in the table, i.e., 1.StringgetColumnName(int column)Returns the name of the column.ClassgetComparisonColumnClass(int columnIndex)Returns the class type of the column that is used for comparisons.ObjectgetComparisonValueAt(int row, int column)Returns the field at the given position.StringgetDatabaseURL()Returns the database URL this table model was created with.DataTypegetDataType()Returns the data type.FieldTypegetFieldType()Returns the field type.AbstractFieldgetItemAt(int row)Returns the field at the specified position.intgetRowCount()Returns the actual number of entries in the table.ObjectgetValueAt(int row, int column)Returns the field at the given position.intindexOf(AbstractField t)Returns the index of the given (visible) field, -1 if not found.booleanisSearchMatch(SearchParameters params, int row)Tests whether the search matches the specified row.voidsetDataType(DataType value)Sets the data type.voidsetFieldType(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:
getRowCountin interfaceTableModel- Returns:
- the number of entries
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table, i.e., 1.- Specified by:
getColumnCountin interfaceTableModel- Returns:
- the number of columns, always 1
-
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
-
getComparisonColumnClass
public Class getComparisonColumnClass(int columnIndex)
Returns the class type of the column that is used for comparisons.- Specified by:
getComparisonColumnClassin 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:
getValueAtin 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:
getComparisonValueAtin 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:
getItemAtin 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:
indexOfin 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:
isSearchMatchin 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
-
-