Package adams.gui.visualization.image
Class LocatedObjectsTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.visualization.image.LocatedObjectsTableModel
-
- All Implemented Interfaces:
LoggingLevelHandler,LoggingSupporter,SpreadSheetSupporter,Serializable,TableModel
public final class LocatedObjectsTableModel extends AbstractBaseTableModel
Table model for located objects.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLocatedObjectsTableModel.MetaDataDisplayHow to display the meta-data.
-
Field Summary
Fields Modifier and Type Field Description static StringCOLUMN_HEIGHTstatic StringCOLUMN_INDEXstatic StringCOLUMN_METADATAstatic StringCOLUMN_PREFIX_METAstatic StringCOLUMN_WIDTHstatic StringCOLUMN_Xstatic StringCOLUMN_Yprotected LocatedObjectsTableModel.MetaDataDisplaym_MetaDataDisplayhow the meta-data is being displayed.protected List<String>m_MetaDataKeysall the meta-data keys.protected LocatedObjectsm_Objectsthe underlying objects.-
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 LocatedObjectsTableModel(LocatedObjectsTableModel.MetaDataDisplay metaDataDisplay)Initializes the table model.LocatedObjectsTableModel(LocatedObjectsTableModel.MetaDataDisplay metaDataDisplay, LocatedObjects objects)Initializes the table model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>getColumnClass(int columnIndex)ReturnsObject.classregardless ofcolumnIndex.intgetColumnCount()Returns the number of columns in the model.StringgetColumnName(int column)Returns the name for the column.LocatedObjectsTableModel.MetaDataDisplaygetMetaDataDisplay()Returns how the meta-data is being displayed.LocatedObjectsgetObjects()Returns the underlying located objects.intgetRowCount()Returns the number of rows in the model.ObjectgetValueAt(int rowIndex, int columnIndex)Returns the value for the cell atcolumnIndexandrowIndex.intindexOf(LocatedObject obj)Returns the index of the object in the underlying list.protected voidinitModel(LocatedObjects objects)Initializes the model.voidsetMetaDataDisplay(LocatedObjectsTableModel.MetaDataDisplay value)Sets how the meta-data is being displayed.voidsetObjects(LocatedObjects value)Sets the objects to display.-
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
-
COLUMN_INDEX
public static final String COLUMN_INDEX
- See Also:
- Constant Field Values
-
COLUMN_X
public static final String COLUMN_X
- See Also:
- Constant Field Values
-
COLUMN_Y
public static final String COLUMN_Y
- See Also:
- Constant Field Values
-
COLUMN_WIDTH
public static final String COLUMN_WIDTH
- See Also:
- Constant Field Values
-
COLUMN_HEIGHT
public static final String COLUMN_HEIGHT
- See Also:
- Constant Field Values
-
COLUMN_METADATA
public static final String COLUMN_METADATA
- See Also:
- Constant Field Values
-
COLUMN_PREFIX_META
public static final String COLUMN_PREFIX_META
- See Also:
- Constant Field Values
-
m_Objects
protected LocatedObjects m_Objects
the underlying objects.
-
m_MetaDataDisplay
protected LocatedObjectsTableModel.MetaDataDisplay m_MetaDataDisplay
how the meta-data is being displayed.
-
-
Constructor Detail
-
LocatedObjectsTableModel
public LocatedObjectsTableModel(LocatedObjectsTableModel.MetaDataDisplay metaDataDisplay)
Initializes the table model.- Parameters:
metaDataDisplay- how to display the meta-data
-
LocatedObjectsTableModel
public LocatedObjectsTableModel(LocatedObjectsTableModel.MetaDataDisplay metaDataDisplay, LocatedObjects objects)
Initializes the table model.- Parameters:
metaDataDisplay- how to display the meta-dataobjects- the underlying objects, can be null
-
-
Method Detail
-
initModel
protected void initModel(LocatedObjects objects)
Initializes the model.- Parameters:
objects- the objects to initialize with
-
getRowCount
public int getRowCount()
Returns the number of rows in the model. AJTableuses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.- Returns:
- the number of rows in the model
- See Also:
getColumnCount()
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the model. AJTableuses this method to determine how many columns it should create and display by default.- Returns:
- the number of columns in the model
- See Also:
getRowCount()
-
getColumnName
public String getColumnName(int column)
Returns the name for the column.- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel- Parameters:
column- the column to get the name for- Returns:
- the name
-
getColumnClass
public Class<?> getColumnClass(int columnIndex)
ReturnsObject.classregardless ofcolumnIndex.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- Parameters:
columnIndex- the column being queried- Returns:
- the Object.class
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
Returns the value for the cell atcolumnIndexandrowIndex.- 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
-
setMetaDataDisplay
public void setMetaDataDisplay(LocatedObjectsTableModel.MetaDataDisplay value)
Sets how the meta-data is being displayed.- Parameters:
value- the type of display
-
getMetaDataDisplay
public LocatedObjectsTableModel.MetaDataDisplay getMetaDataDisplay()
Returns how the meta-data is being displayed.- Returns:
- the type of display
-
setObjects
public void setObjects(LocatedObjects value)
Sets the objects to display.- Parameters:
value- the objects
-
getObjects
public LocatedObjects getObjects()
Returns the underlying located objects.- Returns:
- the objects
-
indexOf
public int indexOf(LocatedObject obj)
Returns the index of the object in the underlying list.- Parameters:
obj- the object to located- Returns:
- the index, -1 if failed to locate
-
-