cz.cuni.amis.nb.pogamut.base.logging
Class LogTableModel

Package class diagram package LogTableModel
java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by cz.cuni.amis.nb.pogamut.base.logging.LogTableModel
All Implemented Interfaces:
LogRecordListener, Serializable, TableModel

public class LogTableModel
extends DefaultTableModel
implements LogRecordListener

Table model designed to cooperate with LogRecordsSource object through LogRecordListener interface.

Author:
ik, kero
See Also:
Serialized Form

Nested Class Summary
 class LogTableModel.LogLevelObject
           
 
Field Summary
protected static SimpleDateFormat dateFormat
          Time formater displaying milliseconds.
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
LogTableModel()
          Creates a new instance of LogTableModel
 
Method Summary
 void addDataSource(LogRecordsSource source)
          Adds new data source.
 Set<LogRecordsSource> getDataSources()
          Return all datasources this model wants to listens to.
 int getRowLimit()
          Return maximal number of rows of this table.
 boolean isCellEditable(int rowIndex, int columnIndex)
          No cells are editable.
 boolean isFreezed()
           
protected  Vector logRecToVector(LogRecord r)
          Translates log record to vector - this is required by default table model since it is based on old Java collections.
 void notifyNewLogRecord(LogRecord r)
          Adds new single log record.
 void removeAllDataSources()
           
 void removeDataSource(LogRecordsSource source)
           
 void setFreeze(boolean freezed)
          Freezes or unfreezes the log window.
 void setNewData(Collection<LogRecord> r)
          Delete all data in table model and populate the model with new data.
 void setRowLimit(int limit)
           
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableDataChanged, fireTableChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateFormat

protected static SimpleDateFormat dateFormat
Time formater displaying milliseconds.

Constructor Detail

LogTableModel

public LogTableModel()
Creates a new instance of LogTableModel

Method Detail

setFreeze

public void setFreeze(boolean freezed)
Freezes or unfreezes the log window. If the window is freezed then new log records are discarded.

Parameters:
freezed -

isFreezed

public boolean isFreezed()

getDataSources

public Set<LogRecordsSource> getDataSources()
Return all datasources this model wants to listens to.


isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
No cells are editable.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class DefaultTableModel

addDataSource

public void addDataSource(LogRecordsSource source)
Adds new data source.


removeDataSource

public void removeDataSource(LogRecordsSource source)

removeAllDataSources

public void removeAllDataSources()

logRecToVector

protected Vector logRecToVector(LogRecord r)
Translates log record to vector - this is required by default table model since it is based on old Java collections.


notifyNewLogRecord

public void notifyNewLogRecord(LogRecord r)
Adds new single log record.

Specified by:
notifyNewLogRecord in interface LogRecordListener
Parameters:
r - new record.

setRowLimit

public void setRowLimit(int limit)

getRowLimit

public int getRowLimit()
Return maximal number of rows of this table.


setNewData

public void setNewData(Collection<LogRecord> r)
Delete all data in table model and populate the model with new data.

Specified by:
setNewData in interface LogRecordListener
Parameters:
r - Collection of new records.


Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.