1 16 package org.apache.log4j.lf5.viewer.categoryexplorer; 17 18 import org.apache.log4j.lf5.LogRecord; 19 import org.apache.log4j.lf5.LogRecordFilter; 20 21 import java.util.Enumeration ; 22 23 28 29 31 public class CategoryExplorerLogRecordFilter implements LogRecordFilter { 32 36 40 protected CategoryExplorerModel _model; 41 42 46 50 public CategoryExplorerLogRecordFilter(CategoryExplorerModel model) { 51 _model = model; 52 } 53 54 58 64 public boolean passes(LogRecord record) { 65 CategoryPath path = new CategoryPath(record.getCategory()); 66 return _model.isCategoryPathActive(path); 67 } 68 69 72 public void reset() { 73 resetAllNodes(); 74 } 75 76 80 protected void resetAllNodes() { 81 Enumeration nodes = _model.getRootCategoryNode().depthFirstEnumeration(); 82 CategoryNode current; 83 while (nodes.hasMoreElements()) { 84 current = (CategoryNode) nodes.nextElement(); 85 current.resetNumberOfContainedRecords(); 86 _model.nodeChanged(current); 87 } 88 } 89 93 } 97 98 | Popular Tags |