|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.qfs.lib.log.TreeFilter | +--de.qfs.apps.qflog.logview.LogFilterTreeModel
A LogFilterTreeModel manages a tree hierarchy corresponding to the
packages, classes and methods that are originators of log messages, managed
by a LogTableView
.
The LogFilterTreeModel can act as a filter for those messages by assigning levels to the nodes of the tree and removing all messages that correspong to a subnode and have a level higher than the assigned one.
This class implements the Configurable
interface to
get persistence for the levels assigned to the tree nodes. The saved state
has one entry per node on which a level was set.
Inner Class Summary | |
static class |
LogFilterTreeModel.UnitTest
Test cases for the LogLevelTreeModel class. |
Inner classes inherited from class de.qfs.lib.log.TreeFilter |
de.qfs.lib.log.TreeFilter.UnitTest |
Field Summary | |
protected FilterNode |
root
The root of the tree. |
Fields inherited from class de.qfs.lib.log.TreeFilter |
cache,
defaultLevel,
levels,
msep |
Constructor Summary | |
LogFilterTreeModel()
Create a new LogFilterTreeModel. |
Method Summary | |
void |
addFilterPackage(FilterNode node)
Add a package, class or method to filter on. |
void |
addTableModelFilterListener(de.qfs.lib.gui.TableModelFilterListener listener)
Add a TableModelFilterListener to the LogFilterTreeModel. |
void |
addTreeModelListener(javax.swing.event.TreeModelListener listener)
Add a TreeModelListener to the LogFilterTreeModel. |
void |
cleanup()
Try to remove everything that might prevent garbage collection. |
void |
clearFilterPackages()
Remove all Packages to filter on. |
boolean |
filter(de.qfs.lib.log.LogEntry entry)
Filter a LogEntry. |
boolean |
filter(javax.swing.table.TableModel model,
int row)
Filter rows of a TableModel. |
void |
finalize()
Finalize the LogFilterTreeModel. |
FilterNode |
findNode(java.lang.String clazz,
java.lang.String method)
Find the node representing a class and method. |
void |
fireNodesChanged(java.lang.Object[] path)
Tell the TreeModelListeners that a node was modified. |
void |
fireNodesInserted(java.lang.Object[] path,
int index)
Tell the TreeModelListeners that a node was inserted. |
void |
fireNodeStructureChanged(java.lang.Object[] path)
Tell the TreeModelListeners that the structure changed. |
java.lang.Object |
getChild(java.lang.Object parent,
int index)
Get a child of a node from the tree. |
int |
getChildCount(java.lang.Object parent)
Get number of children of a node. |
java.lang.String |
getConfigurableName()
Get the Configurable's name. |
java.util.Properties |
getConfigurableState()
Get the Configurable's state. |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
Get the index of node's child. |
java.lang.Integer |
getLevel(java.lang.Object node)
Get the level of a node. |
java.lang.Object[] |
getPath(java.lang.String clazz,
java.lang.String method)
Get the path for a node representing a package, class or method. |
java.lang.Object |
getRoot()
Get the root node of the tree. |
java.lang.String |
getRootName()
Get the name for the root node. |
boolean |
isLeaf(java.lang.Object node)
Check whether a node is a leaf. |
boolean |
isPackageFilteringEnabled()
Query whether package filtering is currently enabled. |
protected void |
methodAdded(java.lang.String clazz,
java.lang.String method)
A method has been added to the TreeFilter. |
void |
notify(de.qfs.lib.gui.TreeNotification notification)
Notify the model about changes. |
void |
registrationChanged(de.qfs.lib.config.Configuration config,
java.lang.String name,
boolean registered,
boolean valuesKept)
This callback is used to notify the Configurable whenever it is registered with or unregistered from the Configuration, so it can decide whether to notify the Configuration when its state changes. |
void |
removeFilterPackage(FilterNode node)
Remove a package, class or method to filter on. |
void |
removeLevel(javax.swing.tree.TreePath path,
boolean recurse)
Clear the level for one node. |
void |
removeTableModelFilterListener(de.qfs.lib.gui.TableModelFilterListener listener)
Remove a TableModelFilterListener from the LogFilterTreeModel. |
void |
removeTreeModelListener(javax.swing.event.TreeModelListener listener)
Remove a TreeModelListener from the LogFilterTreeModel. |
void |
setConfigurableName(java.lang.String configurableName)
Set the Configurable's name. |
void |
setConfigurableState(java.util.Properties state)
Set the Configurable's state. |
void |
setDefault(int level)
Set the default level for the filter. |
void |
setLevel(java.lang.String clazz,
java.lang.String method,
int level,
boolean recurse)
Set the level for one node. |
void |
setLevel(javax.swing.tree.TreePath path,
int level)
Set the level for one node. |
void |
setLoggingEnabled(boolean enable)
Enable or disable logging output caused directly or indirectly by LogFilterTreeModel methods. |
void |
setRootName(java.lang.String name)
Set the name for the root node. |
void |
togglePackageFiltering()
Toggle filtering by packages. |
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
Update a node. |
Methods inherited from class de.qfs.lib.log.TreeFilter |
clearCache,
filter,
filter,
getDefault,
getLevel,
getParentLevel,
removeChildren,
removeLevel |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected FilterNode root
Constructor Detail |
public LogFilterTreeModel()
Method Detail |
public void cleanup()
public void finalize()
public final java.lang.String getRootName()
public final void setRootName(java.lang.String name)
name
- The root node's new name.public final void setLoggingEnabled(boolean enable)
de.qfs.lib.log.Log.excludeThread
.
This is necessary, if the LogFilterTreeModel is used inside the
application whose logs it is supposed to filter. The default value is false.
enable
- True to enable logging, false to disable it.public java.lang.Object[] getPath(java.lang.String clazz, java.lang.String method)
clazz
- The package/class part.method
- The method, may be null.public void setDefault(int level)
level
- The level to set.public void setLevel(java.lang.String clazz, java.lang.String method, int level, boolean recurse)
clazz
- The class to filter.method
- The method to filter.level
- The level to set.recurse
- Whether to update child nodes.public void setLevel(javax.swing.tree.TreePath path, int level)
path
- The path of the node.level
- The level to set.public void removeLevel(javax.swing.tree.TreePath path, boolean recurse)
path
- The path of the node.recurse
- Whether to clear child nodes as well.protected void methodAdded(java.lang.String clazz, java.lang.String method)
clazz
- The added Class.method
- The added Method.public java.lang.String getConfigurableName()
public void setConfigurableName(java.lang.String configurableName)
configurableName
- The name to set.public java.util.Properties getConfigurableState()
public void setConfigurableState(java.util.Properties state)
state
- The state to set.public void registrationChanged(de.qfs.lib.config.Configuration config, java.lang.String name, boolean registered, boolean valuesKept)
config
- The affected Configuration.name
- The registration name of the Configurable which may
be different from the Configurable's name.registered
- True if the Configurable was just registered,
false if it was unregistered.valuesKept
- Whether the Configurable's values were kept, if
it was just unregistered.public void addTreeModelListener(javax.swing.event.TreeModelListener listener)
listener
- The listener to add.public void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
listener
- The listener to remove.public java.lang.Object getChild(java.lang.Object parent, int index)
parent
- The parent node.index
- The index of the child in the parent.public int getChildCount(java.lang.Object parent)
parent
- The parent node.public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
parent
- The parent node.child
- The child node.public java.lang.Object getRoot()
public boolean isLeaf(java.lang.Object node)
node
- The node to check.public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
path
- The path of the changed node.newValue
- The new value of the node.public void notify(de.qfs.lib.gui.TreeNotification notification)
notification
- Details of the change.public void fireNodesInserted(java.lang.Object[] path, int index)
path
- The path of the parent node.index
- The index of the new child.public void fireNodesChanged(java.lang.Object[] path)
path
- The path of the modified node.public void fireNodeStructureChanged(java.lang.Object[] path)
path
- The path to the root of the structure change.public java.lang.Integer getLevel(java.lang.Object node)
node
- The node to query.public boolean filter(javax.swing.table.TableModel model, int row)
model
- The TableModel.row
- The row to filter.public void addTableModelFilterListener(de.qfs.lib.gui.TableModelFilterListener listener)
listener
- The TableModelFilterListener to add.public void removeTableModelFilterListener(de.qfs.lib.gui.TableModelFilterListener listener)
listener
- The TableModelFilterListener to remove.public boolean filter(de.qfs.lib.log.LogEntry entry)
entry
- The LogEntry to filter.public void togglePackageFiltering()
public void addFilterPackage(FilterNode node)
cl
- The class or package to filter on.method
- The method to filter on.public void removeFilterPackage(FilterNode node)
cl
- The class or package to remove.method
- The method to remove.public void clearFilterPackages()
public boolean isPackageFilteringEnabled()
public FilterNode findNode(java.lang.String clazz, java.lang.String method)
clazz
- The name of the class.method
- The name of the method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |