Package adams.gui.tools
Class LogEntryViewerTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.tools.LogEntryViewerTableModel
-
- All Implemented Interfaces:
LoggingLevelHandler
,LoggingSupporter
,SpreadSheetSupporter
,CustomSearchTableModel
,Serializable
,TableModel
public class LogEntryViewerTableModel extends AbstractBaseTableModel implements CustomSearchTableModel
The table model for displaying LogEntry objects.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<LogEntry>
m_Data
the underlying data.-
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 LogEntryViewerTableModel()
Initializes the model with no data.LogEntryViewerTableModel(List<LogEntry> data)
Initializes the model with the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(LogEntry entry)
Adds the log entry to the model (appended at the end).void
add(LogEntry entry, boolean sort)
Adds the log entry to the model.void
addAll(Collection<LogEntry> entries)
Adds the log entries to the model (appended at the end).void
addAll(Collection<LogEntry> entries, boolean sort)
Adds the log entries to the model.void
clear()
Removes all entries.Class
getColumnClass(int column)
Returns the class for the column.int
getColumnCount()
Returns the number of columns in the table.String
getColumnName(int column)
Returns the name of the column.List<LogEntry>
getData()
Returns the underlying data.LogEntry
getLogEntryAt(int row)
Returns the LogEntry at the given position.int
getRowCount()
Returns the number of rows.Object
getValueAt(int row, int column)
Returns the value at the given position.boolean
isSearchMatch(SearchParameters params, int row)
Tests whether the search matches the specified row.-
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
-
-
-
-
Method Detail
-
getRowCount
public int getRowCount()
Returns the number of rows.- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the number of rows
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.Host IP DB-ID Generation Type Statuts Source
- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- the number of columns, always 7
-
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 retrieve the name for- Returns:
- the name of the column
-
getLogEntryAt
public LogEntry getLogEntryAt(int row)
Returns the LogEntry at the given position.- Parameters:
row
- the row in the table- Returns:
- the entry
-
getValueAt
public Object getValueAt(int row, int column)
Returns the value at the given position.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
row
- the row in the tablecolumn
- the column in the table- Returns:
- the value
-
getColumnClass
public Class getColumnClass(int column)
Returns the class for the column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
column
- the column to retrieve the class for- Returns:
- the class
-
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
-
clear
public void clear()
Removes all entries.
-
add
public void add(LogEntry entry)
Adds the log entry to the model (appended at the end).- Parameters:
entry
- the entry to add
-
add
public void add(LogEntry entry, boolean sort)
Adds the log entry to the model. Entry can be inserted at the end or in sorted fashion.- Parameters:
entry
- the entry to addsort
- whether to sort the data
-
addAll
public void addAll(Collection<LogEntry> entries)
Adds the log entries to the model (appended at the end).- Parameters:
entries
- the entries to add
-
addAll
public void addAll(Collection<LogEntry> entries, boolean sort)
Adds the log entries to the model. Entries can be inserted at the end or in sorted fashion.- Parameters:
entries
- the entries to addsort
- whether to sort the data
-
-