Package adams.gui.visualization.debug
Class StoragePanel.TableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.visualization.debug.StoragePanel.TableModel
-
- All Implemented Interfaces:
LoggingLevelHandler,LoggingSupporter,SpreadSheetSupporter,Serializable,TableModel
- Enclosing class:
- StoragePanel
public static class StoragePanel.TableModel extends AbstractBaseTableModel
Table model for displaying a storage container.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String[][]m_Datathe converted storage.protected booleanm_HasCacheDatawhether cache data is available.protected Storagem_Storagethe underlying storage.-
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 TableModel()Initializes the table model with no data.TableModel(Storage storage)Initializes the table model the supplied storage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetClassString(Object obj)Generates the class string to display.ClassgetColumnClass(int columnIndex)Returns the class of the column.intgetColumnCount()Returns the number of columns in the model.StringgetColumnName(int column)Returns the name of the column.ObjectgetObject(String cache, String key)Returns the object associated with the specified key.intgetRowCount()Returns the number of rows.ObjectgetValueAt(int rowIndex, int columnIndex)Returns the value at the specified position.booleanhasCacheData()Returns whether cache data is present.protected booleanhasCaches(Storage storage)Checks whether any cache data is to be displayed.protected voidinitialize()Initializes the model.booleanisDifferent(Storage other)Checks whether the storage contains different data.voidsetValueAt(Object aValue, int rowIndex, int columnIndex)Sets the value at the specified position.protected String[][]takeSnapshot(Storage storage)Takes a snapshot of the storage and turns it into a string array.-
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
-
-
-
-
Constructor Detail
-
TableModel
public TableModel()
Initializes the table model with no data.
-
TableModel
public TableModel(Storage storage)
Initializes the table model the supplied storage.- Parameters:
storage- the storage to display
-
-
Method Detail
-
getClassString
protected String getClassString(Object obj)
Generates the class string to display.- Parameters:
obj- the object to create the string for- Returns:
- the generated class string
-
initialize
protected void initialize()
Initializes the model.
-
hasCaches
protected boolean hasCaches(Storage storage)
Checks whether any cache data is to be displayed.- Parameters:
storage- the storage to inspect- Returns:
- true if cache data present
-
takeSnapshot
protected String[][] takeSnapshot(Storage storage)
Takes a snapshot of the storage and turns it into a string array.- Parameters:
storage- the storage to use- Returns:
- the snapshot
-
hasCacheData
public boolean hasCacheData()
Returns whether cache data is present.- Returns:
- true if cache data present (3 columns instead of 2)
-
getObject
public Object getObject(String cache, String key)
Returns the object associated with the specified key.- Parameters:
cache- the cache to access, use null or empty string if regular storagekey- the key for the object to retrieve- Returns:
- the associated object, null if not found
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the model.- Returns:
- always 3
-
getRowCount
public int getRowCount()
Returns the number of rows.- Returns:
- the number of rows
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
Returns the value at the specified position.- Parameters:
rowIndex- the row of the cellcolumnIndex- the column of the cell- Returns:
- the value
-
setValueAt
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
Sets the value at the specified position.- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel- Parameters:
aValue- the value to setrowIndex- the row of the cellcolumnIndex- the column of the cell
-
getColumnClass
public Class getColumnClass(int columnIndex)
Returns the class of the column.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- Parameters:
columnIndex- the index of the column- Returns:
- always String.class
-
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
-
isDifferent
public boolean isDifferent(Storage other)
Checks whether the storage contains different data.- Parameters:
other- the other storage to compare with- Returns:
- true if different
-
-