class MyTableModel
extends javax.swing.table.AbstractTableModel
EventDetails
objects that are sorted on
logging time. Methods are provided to filter the events that are visible.Modifier and Type | Class and Description |
---|---|
private class |
MyTableModel.Processor
Helper that actually processes incoming events.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String[] |
COL_NAMES
names of the columns in the table
|
private static java.text.DateFormat |
DATE_FORMATTER
used to format dates
|
private static EventDetails[] |
EMPTY_LIST
definition of an empty list
|
private static Logger |
LOG
used to log messages
|
private java.util.SortedSet |
mAllEvents
set of all logged events - not filtered
|
private java.lang.String |
mCategoryFilter
filter for the category
|
private EventDetails[] |
mFilteredEvents
events that are visible after filtering
|
private java.lang.Object |
mLock
the lock to control access
|
private java.lang.String |
mMessageFilter
filter for the message
|
private java.lang.String |
mNDCFilter
filter for the NDC
|
private boolean |
mPaused
indicates whether event collection is paused to the UI
|
private java.util.List |
mPendingEvents
list of events that are buffered for processing
|
private Priority |
mPriorityFilter
filter for the priority
|
private java.lang.String |
mThreadFilter
filter for the thread
|
private static java.util.Comparator |
MY_COMP
use the compare logging events
|
Constructor and Description |
---|
MyTableModel()
Creates a new
MyTableModel instance. |
Modifier and Type | Method and Description |
---|---|
void |
addEvent(EventDetails aEvent)
Add an event to the list.
|
void |
clear()
Clear the list of all events.
|
java.lang.Class |
getColumnClass(int aCol) |
int |
getColumnCount() |
java.lang.String |
getColumnName(int aCol) |
EventDetails |
getEventDetails(int aRow)
Get the throwable information at a specified row in the filtered events.
|
int |
getRowCount() |
java.lang.Object |
getValueAt(int aRow,
int aCol) |
boolean |
isPaused() |
private boolean |
matchFilter(EventDetails aEvent)
Returns whether an event matches the filters.
|
void |
setCategoryFilter(java.lang.String aStr)
Set the filter for the category field.
|
void |
setMessageFilter(java.lang.String aStr)
Set the filter for the message field.
|
void |
setNDCFilter(java.lang.String aStr)
Set the filter for the NDC field.
|
void |
setPriorityFilter(Priority aPriority)
Sets the priority to filter events on.
|
void |
setThreadFilter(java.lang.String aStr)
Set the filter for the thread field.
|
void |
toggle()
Toggle whether collecting events
|
private void |
updateFilteredEvents(boolean aInsertedToFront)
Update the filtered events data structure.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
private static final Logger LOG
private static final java.util.Comparator MY_COMP
private static final java.lang.String[] COL_NAMES
private static final EventDetails[] EMPTY_LIST
private static final java.text.DateFormat DATE_FORMATTER
private final java.lang.Object mLock
private final java.util.SortedSet mAllEvents
private EventDetails[] mFilteredEvents
private final java.util.List mPendingEvents
private boolean mPaused
private java.lang.String mThreadFilter
private java.lang.String mMessageFilter
private java.lang.String mNDCFilter
private java.lang.String mCategoryFilter
private Priority mPriorityFilter
public int getRowCount()
TableModel
public int getColumnCount()
TableModel
public java.lang.String getColumnName(int aCol)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
TableModel
public java.lang.Class getColumnClass(int aCol)
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
TableModel
public java.lang.Object getValueAt(int aRow, int aCol)
TableModel
public void setPriorityFilter(Priority aPriority)
aPriority
- the priority to filter onpublic void setThreadFilter(java.lang.String aStr)
aStr
- the string to matchpublic void setMessageFilter(java.lang.String aStr)
aStr
- the string to matchpublic void setNDCFilter(java.lang.String aStr)
aStr
- the string to matchpublic void setCategoryFilter(java.lang.String aStr)
aStr
- the string to matchpublic void addEvent(EventDetails aEvent)
aEvent
- a EventDetails
valuepublic void clear()
public void toggle()
public boolean isPaused()
public EventDetails getEventDetails(int aRow)
aRow
- the row index of the eventprivate void updateFilteredEvents(boolean aInsertedToFront)
aInsertedToFront
- indicates whether events were added to front of
the events. If true, then the current first event must still exist
in the list after the filter is applied.private boolean matchFilter(EventDetails aEvent)
aEvent
- the event to check for a match