class MyTableModel extends 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 String[] |
COL_NAMES
names of the columns in the table
|
private static 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 SortedSet |
mAllEvents
set of all logged events - not filtered
|
private String |
mCategoryFilter
filter for the category
|
private EventDetails[] |
mFilteredEvents
events that are visible after filtering
|
private Object |
mLock
the lock to control access
|
private String |
mMessageFilter
filter for the message
|
private String |
mNDCFilter
filter for the NDC
|
private boolean |
mPaused
indicates whether event collection is paused to the UI
|
private List |
mPendingEvents
list of events that are buffered for processing
|
private Priority |
mPriorityFilter
filter for the priority
|
private String |
mThreadFilter
filter for the thread
|
private static Comparator |
MY_COMP
use the compare logging events
|
listenerList
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.
|
Class |
getColumnClass(int aCol) |
int |
getColumnCount() |
String |
getColumnName(int aCol) |
EventDetails |
getEventDetails(int aRow)
Get the throwable information at a specified row in the filtered events.
|
int |
getRowCount() |
Object |
getValueAt(int aRow,
int aCol) |
boolean |
isPaused() |
private boolean |
matchFilter(EventDetails aEvent)
Returns whether an event matches the filters.
|
void |
setCategoryFilter(String aStr)
Set the filter for the category field.
|
void |
setMessageFilter(String aStr)
Set the filter for the message field.
|
void |
setNDCFilter(String aStr)
Set the filter for the NDC field.
|
void |
setPriorityFilter(Priority aPriority)
Sets the priority to filter events on.
|
void |
setThreadFilter(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 Comparator MY_COMP
private static final EventDetails[] EMPTY_LIST
private static final DateFormat DATE_FORMATTER
private final SortedSet mAllEvents
private EventDetails[] mFilteredEvents
private final List mPendingEvents
private boolean mPaused
private String mThreadFilter
private String mMessageFilter
private String mNDCFilter
private String mCategoryFilter
private Priority mPriorityFilter
MyTableModel()
MyTableModel
instance.public int getRowCount()
TableModel
public int getColumnCount()
TableModel
public String getColumnName(int aCol)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
TableModel
public Class getColumnClass(int aCol)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
TableModel
public Object getValueAt(int aRow, int aCol)
TableModel
public void setPriorityFilter(Priority aPriority)
aPriority
- the priority to filter onpublic void setThreadFilter(String aStr)
aStr
- the string to matchpublic void setMessageFilter(String aStr)
aStr
- the string to matchpublic void setNDCFilter(String aStr)
aStr
- the string to matchpublic void setCategoryFilter(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 matchWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses