Log4JMonitor v1.1

org.alltimeflashdreamer.log4jmonitor
Class MyTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--org.alltimeflashdreamer.log4jmonitor.MyTableModel
All Implemented Interfaces:
Serializable, TableModel

class MyTableModel
extends AbstractTableModel

Title: MyTableModel
Description: Represents a list of LoggingEvent objects that are sorted on logging time. Methods are provided to filter the events that are visible.
This code has been copied from the authors below.

See Also:
Serialized Form

Field Summary
(package private) static String[] COL_NAMES
          names of the columns in the table
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
(package private) MyTableModel()
          Creates a new MyTableModel instance.
 
Method Summary
 void addEvent(LoggingEvent event)
          Add a LoggingEvent to the list.
 void clear()
          Clear the list of all events.
 Class getColumnClass(int iColumnIndex)
          Returns the class of the specified column.
 int getColumnCount()
          Returns the (current) amount of columns, each containing one attribute of the LoggingEvents.
 String getColumnName(int iColumnIndex)
          Returns the name of the specified column.
Note: No exception handling is implemented for invalid column indexes.
 LoggingEvent getLoggingEvent(int iRowIndex)
          Get the throwable information at a specified row in the filtered events.
Note: No exception handling is implemented for invalid row indexes.
 int getRowCount()
          Returns the (current) amount of rows, each containing on LoggingEvent.
 Object getValueAt(int iRowIndex, int iColumnIndex)
          Returns the object within the table having the given coordinates.
Note: No exception handling is implemented for invalid row indexes; invalid column indexes are treated as the index of the error message column.
 boolean isPaused()
           
 void setLevelFilter(Level level)
          Sets the level to filter events on.
 void setLoggerFilter(String str)
          Set the filter for the logger field.
 void setMessageFilter(String str)
          Set the filter for the message field.
 void setThreadFilter(String str)
          Set the filter for the thread field.
 void toggle()
          Toggle collecting state (switch from "collecting" to "pausing" and vice versa).
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COL_NAMES

static final String[] COL_NAMES
names of the columns in the table
Constructor Detail

MyTableModel

MyTableModel()
Creates a new MyTableModel instance.
Method Detail

getRowCount

public int getRowCount()
Returns the (current) amount of rows, each containing on LoggingEvent.
Overrides:
getRowCount in class AbstractTableModel
Returns:
current row count?
See Also:
TableModel

getColumnCount

public int getColumnCount()
Returns the (current) amount of columns, each containing one attribute of the LoggingEvents.
Overrides:
getColumnCount in class AbstractTableModel
Returns:
current column count?
See Also:
TableModel

getColumnName

public String getColumnName(int iColumnIndex)
Returns the name of the specified column.
Note: No exception handling is implemented for invalid column indexes.
Overrides:
getColumnName in class AbstractTableModel
Parameters:
iColumnIndex - the index of the column, starting with 0
Returns:
the name of the specified column
See Also:
TableModel

getColumnClass

public Class getColumnClass(int iColumnIndex)
Returns the class of the specified column. This class is always "Object" except for the column with index 2 ("Trace" column).
Note: No exception handling is implemented for invalid column indexes.
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
iColumnIndex - the index of the column, starting with 0
Returns:
the class of the specified column
See Also:
TableModel

getValueAt

public Object getValueAt(int iRowIndex,
                         int iColumnIndex)
Returns the object within the table having the given coordinates.
Note: No exception handling is implemented for invalid row indexes; invalid column indexes are treated as the index of the error message column.
Overrides:
getValueAt in class AbstractTableModel
Parameters:
iRowIndex - the index of the row, starting with 0
iColumnIndex - the index of the column, starting with 0
Returns:
the object stored at the given coordinates
See Also:
TableModel

setLevelFilter

public void setLevelFilter(Level level)
Sets the level to filter events on. Only events of an equal or higher level are now displayed.
Parameters:
level - the level to filter on
See Also:
Level

setThreadFilter

public void setThreadFilter(String str)
Set the filter for the thread field.
Parameters:
str - the string to match

setMessageFilter

public void setMessageFilter(String str)
Set the filter for the message field.
Parameters:
str - the string to match

setLoggerFilter

public void setLoggerFilter(String str)
Set the filter for the logger field.
Parameters:
str - the string to match

addEvent

public void addEvent(LoggingEvent event)
Add a LoggingEvent to the list.
Parameters:
event - a LoggingEvent value

clear

public void clear()
Clear the list of all events.

toggle

public void toggle()
Toggle collecting state (switch from "collecting" to "pausing" and vice versa).

isPaused

public boolean isPaused()
Returns:
whether currently paused collecting events

getLoggingEvent

public LoggingEvent getLoggingEvent(int iRowIndex)
Get the throwable information at a specified row in the filtered events.
Note: No exception handling is implemented for invalid row indexes.
Parameters:
iRowIndex - Description of the Parameter
Returns:
the throwable information

Copyright (c) 1999/2000 by apache.org, 2001/02 by Sven Mosimann, Adrian Seiler and Florian Steinsiepe