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 class
LocatedObjectsTableModel.MetaDataDisplay
How to display the meta-data.
-
Field Summary
Fields Modifier and Type Field Description static String
COLUMN_HEIGHT
static String
COLUMN_INDEX
static String
COLUMN_METADATA
static String
COLUMN_PREFIX_META
static String
COLUMN_WIDTH
static String
COLUMN_X
static String
COLUMN_Y
protected LocatedObjectsTableModel.MetaDataDisplay
m_MetaDataDisplay
how the meta-data is being displayed.protected List<String>
m_MetaDataKeys
all the meta-data keys.protected LocatedObjects
m_Objects
the 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.class
regardless ofcolumnIndex
.int
getColumnCount()
Returns the number of columns in the model.String
getColumnName(int column)
Returns the name for the column.LocatedObjectsTableModel.MetaDataDisplay
getMetaDataDisplay()
Returns how the meta-data is being displayed.LocatedObjects
getObjects()
Returns the underlying located objects.int
getRowCount()
Returns the number of rows in the model.Object
getValueAt(int rowIndex, int columnIndex)
Returns the value for the cell atcolumnIndex
androwIndex
.int
indexOf(LocatedObject obj)
Returns the index of the object in the underlying list.protected void
initModel(LocatedObjects objects)
Initializes the model.void
setMetaDataDisplay(LocatedObjectsTableModel.MetaDataDisplay value)
Sets how the meta-data is being displayed.void
setObjects(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. AJTable
uses 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. AJTable
uses 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:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the column to get the name for- Returns:
- the name
-
getColumnClass
public Class<?> getColumnClass(int columnIndex)
ReturnsObject.class
regardless ofcolumnIndex
.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in 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 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
-
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
-
-