logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r1345492 [15/18] - in /logging/log4j/branches/log4j12modules: ./ contribs/ contribs/CekiGulcu/ contribs/EirikLygre/ contribs/JamesHouse/ contribs/Jamie Tsao/ contribs/JimMoore/ contribs/KevinSteppe/ contribs/KitchingSimon/ contribs/LeosLite...
Date Sat, 02 Jun 2012 11:41:11 GMT
Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer;
+
+/**
+ * Thrown to indicate that the client has attempted to convert a string
+ * to one the LogLevel types, but the string does not have the appropriate
+ * format.
+ *
+ * @author Michael J. Sikorsky
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class LogTableColumnFormatException extends Exception {
+  private static final long serialVersionUID = 6529165785030431653L;
+
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public LogTableColumnFormatException(String message) {
+    super(message);
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer;
+
+import javax.swing.table.DefaultTableModel;
+
+/**
+ * LogTableModel
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class LogTableModel extends DefaultTableModel {
+  private static final long serialVersionUID = 3593300685868700894L;
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public LogTableModel(Object[] colNames, int numRows) {
+    super(colNames, numRows);
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public boolean isCellEditable(int row, int column) {
+    return (false);
+  }
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer;
+
+import java.awt.Color;
+import java.awt.Component;
+
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+
+import org.apache.log4j.lf5.LogLevel;
+import org.apache.log4j.lf5.LogRecord;
+
+/**
+ * LogTableRowRenderer
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ * @author Brad Marlborough
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class LogTableRowRenderer extends DefaultTableCellRenderer {
+  private static final long serialVersionUID = -3951639953706443213L;
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected boolean _highlightFatal = true;
+  protected Color _color = new Color(230, 230, 230);
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public Component getTableCellRendererComponent(JTable table,
+      Object value,
+      boolean isSelected,
+      boolean hasFocus,
+      int row,
+      int col) {
+
+    if ((row % 2) == 0) {
+      setBackground(_color);
+    } else {
+      setBackground(Color.white);
+    }
+
+    FilteredLogTableModel model = (FilteredLogTableModel) table.getModel();
+    LogRecord record = model.getFilteredRecord(row);
+
+    setForeground(getLogLevelColor(record.getLevel()));
+
+    return (super.getTableCellRendererComponent(table,
+        value,
+        isSelected,
+        hasFocus,
+        row, col));
+  }
+
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+  protected Color getLogLevelColor(LogLevel level) {
+    return (Color) LogLevel.getLogLevelColorMap().get(level);
+  }
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer;
+
+import java.awt.Adjustable;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+
+/**
+ * An AdjustmentListener which ensures that an Adjustable (e.g. a Scrollbar)
+ * will "track" when the Adjustable expands.
+ * For example, when a vertical scroll bar is at its bottom anchor,
+ * the scrollbar will remain at the bottom.  When the vertical scroll bar
+ * is at any other location, then no tracking will happen.
+ * An instance of this class should only listen to one Adjustable as
+ * it retains state information about the Adjustable it listens to.
+ *
+ * @author Richard Wan
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class TrackingAdjustmentListener implements AdjustmentListener {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  protected int _lastMaximum = -1;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public void adjustmentValueChanged(AdjustmentEvent e) {
+    Adjustable bar = e.getAdjustable();
+    int currentMaximum = bar.getMaximum();
+    if (bar.getMaximum() == _lastMaximum) {
+      return; // nothing to do, the adjustable has not expanded
+    }
+    int bottom = bar.getValue() + bar.getVisibleAmount();
+
+    if (bottom + bar.getUnitIncrement() >= _lastMaximum) {
+      bar.setValue(bar.getMaximum()); // use the most recent maximum
+    }
+    _lastMaximum = currentMaximum;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces
+  //--------------------------------------------------------------------------
+}
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import java.awt.Component;
+import java.awt.event.MouseEvent;
+import java.util.EventObject;
+
+import javax.swing.JTable;
+import javax.swing.JTree;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.EventListenerList;
+import javax.swing.table.TableCellEditor;
+import javax.swing.tree.TreeCellEditor;
+
+/**
+ * CategoryAbstractCellEditor.  Base class to handle the some common
+ * details of cell editing.
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryAbstractCellEditor implements TableCellEditor, TreeCellEditor {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected EventListenerList _listenerList = new EventListenerList();
+  protected Object _value;
+  protected ChangeEvent _changeEvent = null;
+  protected int _clickCountToStart = 1;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public Object getCellEditorValue() {
+    return _value;
+  }
+
+  public void setCellEditorValue(Object value) {
+    _value = value;
+  }
+
+  public void setClickCountToStart(int count) {
+    _clickCountToStart = count;
+  }
+
+  public int getClickCountToStart() {
+    return _clickCountToStart;
+  }
+
+  public boolean isCellEditable(EventObject anEvent) {
+    if (anEvent instanceof MouseEvent) {
+      if (((MouseEvent) anEvent).getClickCount() < _clickCountToStart) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  public boolean shouldSelectCell(EventObject anEvent) {
+    if (this.isCellEditable(anEvent)) {
+      if (anEvent == null ||
+          ((MouseEvent) anEvent).getClickCount() >= _clickCountToStart) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  public boolean stopCellEditing() {
+    fireEditingStopped();
+    return true;
+  }
+
+  public void cancelCellEditing() {
+    fireEditingCanceled();
+  }
+
+  public void addCellEditorListener(CellEditorListener l) {
+    _listenerList.add(CellEditorListener.class, l);
+  }
+
+  public void removeCellEditorListener(CellEditorListener l) {
+    _listenerList.remove(CellEditorListener.class, l);
+  }
+
+  public Component getTreeCellEditorComponent(
+      JTree tree, Object value,
+      boolean isSelected,
+      boolean expanded,
+      boolean leaf, int row) {
+    return null;
+  }
+
+  public Component getTableCellEditorComponent(
+      JTable table, Object value,
+      boolean isSelected,
+      int row, int column) {
+    return null;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+  protected void fireEditingStopped() {
+    Object[] listeners = _listenerList.getListenerList();
+
+    for (int i = listeners.length - 2; i >= 0; i -= 2) {
+      if (listeners[i] == CellEditorListener.class) {
+        if (_changeEvent == null) {
+          _changeEvent = new ChangeEvent(this);
+        }
+
+        ((CellEditorListener) listeners[i + 1]).editingStopped(_changeEvent);
+      }
+    }
+  }
+
+  protected void fireEditingCanceled() {
+    Object[] listeners = _listenerList.getListenerList();
+
+    for (int i = listeners.length - 2; i >= 0; i -= 2) {
+      if (listeners[i] == CellEditorListener.class) {
+        if (_changeEvent == null) {
+          _changeEvent = new ChangeEvent(this);
+        }
+
+        ((CellEditorListener) listeners[i + 1]).editingCanceled(_changeEvent);
+      }
+    }
+  }
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+/**
+ * CategoryElement represents a single element or part of a Category.
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryElement {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected String _categoryTitle;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public CategoryElement() {
+    super();
+  }
+
+  public CategoryElement(String title) {
+    _categoryTitle = title;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public String getTitle() {
+    return (_categoryTitle);
+  }
+
+  public void setTitle(String title) {
+    _categoryTitle = title;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import org.apache.log4j.lf5.LogRecord;
+import org.apache.log4j.lf5.LogRecordFilter;
+
+import java.util.Enumeration;
+
+/**
+ * An implementation of LogRecordFilter based on a CategoryExplorerModel
+ *
+ * @author Richard Wan
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryExplorerLogRecordFilter implements LogRecordFilter {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  protected CategoryExplorerModel _model;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public CategoryExplorerLogRecordFilter(CategoryExplorerModel model) {
+    _model = model;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  /**
+   * @return true if the CategoryExplorer model specified at construction
+   * is accepting the category of the specified LogRecord.  Has a side-effect
+   * of adding the CategoryPath of the LogRecord to the explorer model
+   * if the CategoryPath is new.
+   */
+  public boolean passes(LogRecord record) {
+    CategoryPath path = new CategoryPath(record.getCategory());
+    return _model.isCategoryPathActive(path);
+  }
+
+  /**
+   * Resets the counters for the contained CategoryNodes to zero.
+   */
+  public void reset() {
+    resetAllNodes();
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  protected void resetAllNodes() {
+    Enumeration nodes = _model.getRootCategoryNode().depthFirstEnumeration();
+    CategoryNode current;
+    while (nodes.hasMoreElements()) {
+      current = (CategoryNode) nodes.nextElement();
+      current.resetNumberOfContainedRecords();
+      _model.nodeChanged(current);
+    }
+  }
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces
+  //--------------------------------------------------------------------------
+}
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,347 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import java.awt.AWTEventMulticaster;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Enumeration;
+
+import javax.swing.SwingUtilities;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+
+import org.apache.log4j.lf5.LogRecord;
+
+/**
+ * CategoryExplorerModel
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ * @author Brent Sprecher
+ * @author Richard Hurst
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryExplorerModel extends DefaultTreeModel {
+  private static final long serialVersionUID = -3413887384316015901L;
+
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  protected boolean _renderFatal = true;
+  protected ActionListener _listener = null;
+  protected ActionEvent _event = new ActionEvent(this,
+      ActionEvent.ACTION_PERFORMED,
+      "Nodes Selection changed");
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public CategoryExplorerModel(CategoryNode node) {
+    super(node);
+  }
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public void addLogRecord(LogRecord lr) {
+    CategoryPath path = new CategoryPath(lr.getCategory());
+    addCategory(path); // create category path if it is new
+    CategoryNode node = getCategoryNode(path);
+    node.addRecord(); // update category node
+    if (_renderFatal && lr.isFatal()) {
+      TreeNode[] nodes = getPathToRoot(node);
+      int len = nodes.length;
+      CategoryNode parent;
+
+      // i = 0 gives root node
+      // skip node and root, loop through "parents" in between
+      for (int i = 1; i < len - 1; i++) {
+        parent = (CategoryNode) nodes[i];
+        parent.setHasFatalChildren(true);
+        nodeChanged(parent);
+      }
+      node.setHasFatalRecords(true);
+      nodeChanged(node);
+    }
+  }
+
+  public CategoryNode getRootCategoryNode() {
+    return (CategoryNode) getRoot();
+  }
+
+  public CategoryNode getCategoryNode(String category) {
+    CategoryPath path = new CategoryPath(category);
+    return (getCategoryNode(path));
+  }
+
+  /**
+   * returns null if no CategoryNode exists.
+   */
+  public CategoryNode getCategoryNode(CategoryPath path) {
+    CategoryNode root = (CategoryNode) getRoot();
+    CategoryNode parent = root; // Start condition.
+
+    for (int i = 0; i < path.size(); i++) {
+      CategoryElement element = path.categoryElementAt(i);
+
+      // If the two nodes have matching titles they are considered equal.
+      Enumeration children = parent.children();
+
+      boolean categoryAlreadyExists = false;
+      while (children.hasMoreElements()) {
+        CategoryNode node = (CategoryNode) children.nextElement();
+        String title = node.getTitle().toLowerCase();
+
+        String pathLC = element.getTitle().toLowerCase();
+        if (title.equals(pathLC)) {
+          categoryAlreadyExists = true;
+          // This is now the new parent node.
+          parent = node;
+          break; // out of the while, and back to the for().
+        }
+      }
+
+      if (categoryAlreadyExists == false) {
+        return null; // Didn't find the Node.
+      }
+    }
+
+    return (parent);
+  }
+
+  /**
+   * @return true if all the nodes in the specified CategoryPath are
+   * selected.
+   */
+  public boolean isCategoryPathActive(CategoryPath path) {
+    CategoryNode root = (CategoryNode) getRoot();
+    CategoryNode parent = root; // Start condition.
+    boolean active = false;
+
+    for (int i = 0; i < path.size(); i++) {
+      CategoryElement element = path.categoryElementAt(i);
+
+      // If the two nodes have matching titles they are considered equal.
+      Enumeration children = parent.children();
+
+      boolean categoryAlreadyExists = false;
+      active = false;
+
+      while (children.hasMoreElements()) {
+        CategoryNode node = (CategoryNode) children.nextElement();
+        String title = node.getTitle().toLowerCase();
+
+        String pathLC = element.getTitle().toLowerCase();
+        if (title.equals(pathLC)) {
+          categoryAlreadyExists = true;
+          // This is now the new parent node.
+          parent = node;
+
+          if (parent.isSelected()) {
+            active = true;
+          }
+
+          break; // out of the while, and back to the for().
+        }
+      }
+
+      if (active == false || categoryAlreadyExists == false) {
+        return false;
+      }
+    }
+
+    return (active);
+  }
+
+
+  /**
+   * <p>Method altered by Richard Hurst such that it returns the CategoryNode
+   * corresponding to the CategoryPath</p>
+   *
+   * @param path category path.
+   * @return CategoryNode
+   */
+  public CategoryNode addCategory(CategoryPath path) {
+    CategoryNode root = (CategoryNode) getRoot();
+    CategoryNode parent = root; // Start condition.
+
+    for (int i = 0; i < path.size(); i++) {
+      CategoryElement element = path.categoryElementAt(i);
+
+      // If the two nodes have matching titles they are considered equal.
+      Enumeration children = parent.children();
+
+      boolean categoryAlreadyExists = false;
+      while (children.hasMoreElements()) {
+        CategoryNode node = (CategoryNode) children.nextElement();
+        String title = node.getTitle().toLowerCase();
+
+        String pathLC = element.getTitle().toLowerCase();
+        if (title.equals(pathLC)) {
+          categoryAlreadyExists = true;
+          // This is now the new parent node.
+          parent = node;
+          break;
+        }
+      }
+
+      if (categoryAlreadyExists == false) {
+        // We need to add the node.
+        CategoryNode newNode = new CategoryNode(element.getTitle());
+
+        //This method of adding a new node cause parent roots to be
+        // collapsed.
+        //parent.add( newNode );
+        //reload(parent);
+
+        // This doesn't force the nodes to collapse.
+        insertNodeInto(newNode, parent, parent.getChildCount());
+        refresh(newNode);
+
+        // The newly added node is now the parent.
+        parent = newNode;
+
+      }
+    }
+
+    return parent;
+  }
+
+  public void update(CategoryNode node, boolean selected) {
+    if (node.isSelected() == selected) {
+      return; // nothing was changed, nothing to do
+    }
+    // select parents or deselect children
+    if (selected) {
+      setParentSelection(node, true);
+    } else {
+      setDescendantSelection(node, false);
+    }
+  }
+
+  public void setDescendantSelection(CategoryNode node, boolean selected) {
+    Enumeration descendants = node.depthFirstEnumeration();
+    CategoryNode current;
+    while (descendants.hasMoreElements()) {
+      current = (CategoryNode) descendants.nextElement();
+      // does the current node need to be changed?
+      if (current.isSelected() != selected) {
+        current.setSelected(selected);
+        nodeChanged(current);
+      }
+    }
+    notifyActionListeners();
+  }
+
+  public void setParentSelection(CategoryNode node, boolean selected) {
+    TreeNode[] nodes = getPathToRoot(node);
+    int len = nodes.length;
+    CategoryNode parent;
+
+    // i = 0 gives root node, i=len-1 gives this node
+    // skip the root node
+    for (int i = 1; i < len; i++) {
+      parent = (CategoryNode) nodes[i];
+      if (parent.isSelected() != selected) {
+        parent.setSelected(selected);
+        nodeChanged(parent);
+      }
+    }
+    notifyActionListeners();
+  }
+
+
+  public synchronized void addActionListener(ActionListener l) {
+    _listener = AWTEventMulticaster.add(_listener, l);
+  }
+
+  public synchronized void removeActionListener(ActionListener l) {
+    _listener = AWTEventMulticaster.remove(_listener, l);
+  }
+
+  public void resetAllNodeCounts() {
+    Enumeration nodes = getRootCategoryNode().depthFirstEnumeration();
+    CategoryNode current;
+    while (nodes.hasMoreElements()) {
+      current = (CategoryNode) nodes.nextElement();
+      current.resetNumberOfContainedRecords();
+      nodeChanged(current);
+    }
+  }
+
+  /**
+   * <p>Returns the CategoryPath to the specified CategoryNode</p>
+   *
+   * @param node The target CategoryNode
+   * @return CategoryPath
+   */
+  public TreePath getTreePathToRoot(CategoryNode node) {
+    if (node == null) {
+      return null;
+    }
+    return (new TreePath(getPathToRoot(node)));
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+  protected void notifyActionListeners() {
+    if (_listener != null) {
+      _listener.actionPerformed(_event);
+    }
+  }
+
+  /**
+   * Fires a nodechanged event on the SwingThread.
+   */
+  protected void refresh(final CategoryNode node) {
+    SwingUtilities.invokeLater(new Runnable() {
+      public void run() {
+        nodeChanged(node); // remind the tree to render the new node
+      }
+    });
+  }
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import java.awt.event.MouseEvent;
+
+import javax.swing.JTree;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.tree.TreePath;
+
+/**
+ * CategoryExplorerTree
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ * @author Brent Sprecher
+ * @author Brad Marlborough
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryExplorerTree extends JTree {
+  private static final long serialVersionUID = 8066257446951323576L;
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected CategoryExplorerModel _model;
+  protected boolean _rootAlreadyExpanded = false;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  /**
+   * Construct a CategoryExplorerTree with a specific model.
+   */
+  public CategoryExplorerTree(CategoryExplorerModel model) {
+    super(model);
+
+    _model = model;
+    init();
+  }
+
+  /**
+   * Construct a CategoryExplorerTree and create a default CategoryExplorerModel.
+   */
+  public CategoryExplorerTree() {
+    super();
+
+    CategoryNode rootNode = new CategoryNode("Categories");
+
+    _model = new CategoryExplorerModel(rootNode);
+
+    setModel(_model);
+
+    init();
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public CategoryExplorerModel getExplorerModel() {
+    return (_model);
+  }
+
+  public String getToolTipText(MouseEvent e) {
+
+    try {
+      return super.getToolTipText(e);
+    } catch (Exception ex) {
+      return "";
+    }
+
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  protected void init() {
+    // Put visible lines on the JTree.
+    putClientProperty("JTree.lineStyle", "Angled");
+
+    // Configure the Tree with the appropriate Renderers and Editors.
+
+    CategoryNodeRenderer renderer = new CategoryNodeRenderer();
+    setEditable(true);
+    setCellRenderer(renderer);
+
+    CategoryNodeEditor editor = new CategoryNodeEditor(_model);
+
+    setCellEditor(new CategoryImmediateEditor(this,
+        new CategoryNodeRenderer(),
+        editor));
+    setShowsRootHandles(true);
+
+    setToolTipText("");
+
+    ensureRootExpansion();
+
+  }
+
+  protected void expandRootNode() {
+    if (_rootAlreadyExpanded) {
+      return;
+    }
+    _rootAlreadyExpanded = true;
+    TreePath path = new TreePath(_model.getRootCategoryNode().getPath());
+    expandPath(path);
+  }
+
+  protected void ensureRootExpansion() {
+    _model.addTreeModelListener(new TreeModelAdapter() {
+      public void treeNodesInserted(TreeModelEvent e) {
+        expandRootNode();
+      }
+    });
+  }
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.util.EventObject;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellEditor;
+import javax.swing.tree.TreePath;
+
+/**
+ * CategoryImmediateEditor
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryImmediateEditor extends DefaultTreeCellEditor {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  private CategoryNodeRenderer renderer;
+  protected Icon editingIcon = null;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+  public CategoryImmediateEditor(JTree tree,
+      CategoryNodeRenderer renderer,
+      CategoryNodeEditor editor) {
+    super(tree, renderer, editor);
+    this.renderer = renderer;
+    renderer.setIcon(null);
+    renderer.setLeafIcon(null);
+    renderer.setOpenIcon(null);
+    renderer.setClosedIcon(null);
+
+    super.editingIcon = null;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+  public boolean shouldSelectCell(EventObject e) {
+    boolean rv = false;  // only mouse events
+
+    if (e instanceof MouseEvent) {
+      MouseEvent me = (MouseEvent) e;
+      TreePath path = tree.getPathForLocation(me.getX(),
+          me.getY());
+      CategoryNode node = (CategoryNode)
+          path.getLastPathComponent();
+
+      rv = node.isLeaf() /*|| !inCheckBoxHitRegion(me)*/;
+    }
+    return rv;
+  }
+
+  public boolean inCheckBoxHitRegion(MouseEvent e) {
+    TreePath path = tree.getPathForLocation(e.getX(),
+        e.getY());
+    if (path == null) {
+      return false;
+    }
+    CategoryNode node = (CategoryNode) path.getLastPathComponent();
+    boolean rv = false;
+
+    if (true) {
+      // offset and lastRow DefaultTreeCellEditor
+      // protected members
+
+      Rectangle bounds = tree.getRowBounds(lastRow);
+      Dimension checkBoxOffset =
+          renderer.getCheckBoxOffset();
+
+      bounds.translate(offset + checkBoxOffset.width,
+          checkBoxOffset.height);
+
+      rv = bounds.contains(e.getPoint());
+    }
+    return true;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  protected boolean canEditImmediately(EventObject e) {
+    boolean rv = false;
+
+    if (e instanceof MouseEvent) {
+      MouseEvent me = (MouseEvent) e;
+      rv = inCheckBoxHitRegion(me);
+    }
+
+    return rv;
+  }
+
+  protected void determineOffset(JTree tree, Object value,
+      boolean isSelected, boolean expanded,
+      boolean leaf, int row) {
+    // Very important: means that the tree won't jump around.
+    offset = 0;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNode.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNode.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNode.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNode.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import java.util.Enumeration;
+
+/**
+ * CategoryNode
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryNode extends DefaultMutableTreeNode {
+  private static final long serialVersionUID = 5958994817693177319L;
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected boolean _selected = true;
+  protected int _numberOfContainedRecords = 0;
+  protected int _numberOfRecordsFromChildren = 0;
+  protected boolean _hasFatalChildren = false;
+  protected boolean _hasFatalRecords = false;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  /**
+   *
+   */
+  public CategoryNode(String title) {
+    setUserObject(title);
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+  public String getTitle() {
+    return (String) getUserObject();
+  }
+
+  public void setSelected(boolean s) {
+    if (s != _selected) {
+      _selected = s;
+    }
+  }
+
+  public boolean isSelected() {
+    return _selected;
+  }
+
+  /**
+   * @deprecated
+   */
+  public void setAllDescendantsSelected() {
+    Enumeration children = children();
+    while (children.hasMoreElements()) {
+      CategoryNode node = (CategoryNode) children.nextElement();
+      node.setSelected(true);
+      node.setAllDescendantsSelected();
+    }
+  }
+
+  /**
+   * @deprecated
+   */
+  public void setAllDescendantsDeSelected() {
+    Enumeration children = children();
+    while (children.hasMoreElements()) {
+      CategoryNode node = (CategoryNode) children.nextElement();
+      node.setSelected(false);
+      node.setAllDescendantsDeSelected();
+    }
+  }
+
+  public String toString() {
+    return (getTitle());
+  }
+
+  public boolean equals(Object obj) {
+    if (obj instanceof CategoryNode) {
+      CategoryNode node = (CategoryNode) obj;
+      String tit1 = getTitle().toLowerCase();
+      String tit2 = node.getTitle().toLowerCase();
+
+      if (tit1.equals(tit2)) {
+        return (true);
+      }
+    }
+    return (false);
+  }
+
+  public int hashCode() {
+    return (getTitle().hashCode());
+  }
+
+  public void addRecord() {
+    _numberOfContainedRecords++;
+    addRecordToParent();
+  }
+
+  public int getNumberOfContainedRecords() {
+    return _numberOfContainedRecords;
+  }
+
+  public void resetNumberOfContainedRecords() {
+    _numberOfContainedRecords = 0;
+    _numberOfRecordsFromChildren = 0;
+    _hasFatalRecords = false;
+    _hasFatalChildren = false;
+  }
+
+  public boolean hasFatalRecords() {
+    return _hasFatalRecords;
+  }
+
+  public boolean hasFatalChildren() {
+    return _hasFatalChildren;
+  }
+
+  public void setHasFatalRecords(boolean flag) {
+    _hasFatalRecords = flag;
+  }
+
+  public void setHasFatalChildren(boolean flag) {
+    _hasFatalChildren = flag;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  protected int getTotalNumberOfRecords() {
+    return getNumberOfRecordsFromChildren() + getNumberOfContainedRecords();
+  }
+
+  /**
+   * Passes up the addition from child to parent
+   */
+  protected void addRecordFromChild() {
+    _numberOfRecordsFromChildren++;
+    addRecordToParent();
+  }
+
+  protected int getNumberOfRecordsFromChildren() {
+    return _numberOfRecordsFromChildren;
+  }
+
+  protected void addRecordToParent() {
+    TreeNode parent = getParent();
+    if (parent == null) {
+      return;
+    }
+    ((CategoryNode) parent).addRecordFromChild();
+  }
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditor.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditor.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditor.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditor.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,291 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import javax.swing.JCheckBox;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
+import javax.swing.JTree;
+import javax.swing.tree.TreePath;
+
+/**
+ * CategoryNodeEditor
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryNodeEditor extends CategoryAbstractCellEditor {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected CategoryNodeEditorRenderer _renderer;
+  protected CategoryNode _lastEditedNode;
+  protected JCheckBox _checkBox;
+  protected CategoryExplorerModel _categoryModel;
+  protected JTree _tree;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public CategoryNodeEditor(CategoryExplorerModel model) {
+    _renderer = new CategoryNodeEditorRenderer();
+    _checkBox = _renderer.getCheckBox();
+    _categoryModel = model;
+
+    _checkBox.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        _categoryModel.update(_lastEditedNode, _checkBox.isSelected());
+        stopCellEditing();
+      }
+    });
+
+    _renderer.addMouseListener(new MouseAdapter() {
+      public void mousePressed(MouseEvent e) {
+        if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0) {
+          showPopup(_lastEditedNode, e.getX(), e.getY());
+        }
+        stopCellEditing();
+      }
+    });
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public Component getTreeCellEditorComponent(JTree tree, Object value,
+      boolean selected, boolean expanded,
+      boolean leaf, int row) {
+    _lastEditedNode = (CategoryNode) value;
+    _tree = tree;
+
+    return _renderer.getTreeCellRendererComponent(tree,
+        value, selected, expanded,
+        leaf, row, true);
+    // hasFocus ignored
+  }
+
+  public Object getCellEditorValue() {
+    return _lastEditedNode.getUserObject();
+  }
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  protected JMenuItem createPropertiesMenuItem(final CategoryNode node) {
+    JMenuItem result = new JMenuItem("Properties");
+    result.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        showPropertiesDialog(node);
+      }
+    });
+    return result;
+  }
+
+  protected void showPropertiesDialog(CategoryNode node) {
+    JOptionPane.showMessageDialog(
+        _tree,
+        getDisplayedProperties(node),
+        "Category Properties: " + node.getTitle(),
+        JOptionPane.PLAIN_MESSAGE
+    );
+  }
+
+  protected Object getDisplayedProperties(CategoryNode node) {
+    ArrayList result = new ArrayList();
+    result.add("Category: " + node.getTitle());
+    if (node.hasFatalRecords()) {
+      result.add("Contains at least one fatal LogRecord.");
+    }
+    if (node.hasFatalChildren()) {
+      result.add("Contains descendants with a fatal LogRecord.");
+    }
+    result.add("LogRecords in this category alone: " +
+        node.getNumberOfContainedRecords());
+    result.add("LogRecords in descendant categories: " +
+        node.getNumberOfRecordsFromChildren());
+    result.add("LogRecords in this category including descendants: " +
+        node.getTotalNumberOfRecords());
+    return result.toArray();
+  }
+
+  protected void showPopup(CategoryNode node, int x, int y) {
+    JPopupMenu popup = new JPopupMenu();
+    popup.setSize(150, 400);
+    //
+    // Configure the Popup
+    //
+    if (node.getParent() == null) {
+      popup.add(createRemoveMenuItem());
+      popup.addSeparator();
+    }
+    popup.add(createSelectDescendantsMenuItem(node));
+    popup.add(createUnselectDescendantsMenuItem(node));
+    popup.addSeparator();
+    popup.add(createExpandMenuItem(node));
+    popup.add(createCollapseMenuItem(node));
+    popup.addSeparator();
+    popup.add(createPropertiesMenuItem(node));
+    popup.show(_renderer, x, y);
+  }
+
+  protected JMenuItem createSelectDescendantsMenuItem(final CategoryNode node) {
+    JMenuItem selectDescendants =
+        new JMenuItem("Select All Descendant Categories");
+    selectDescendants.addActionListener(
+        new ActionListener() {
+          public void actionPerformed(ActionEvent e) {
+            _categoryModel.setDescendantSelection(node, true);
+          }
+        }
+    );
+    return selectDescendants;
+  }
+
+  protected JMenuItem createUnselectDescendantsMenuItem(final CategoryNode node) {
+    JMenuItem unselectDescendants =
+        new JMenuItem("Deselect All Descendant Categories");
+    unselectDescendants.addActionListener(
+
+        new ActionListener() {
+          public void actionPerformed(ActionEvent e) {
+            _categoryModel.setDescendantSelection(node, false);
+          }
+        }
+
+    );
+    return unselectDescendants;
+  }
+
+  protected JMenuItem createExpandMenuItem(final CategoryNode node) {
+    JMenuItem result = new JMenuItem("Expand All Descendant Categories");
+    result.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        expandDescendants(node);
+      }
+    });
+    return result;
+  }
+
+  protected JMenuItem createCollapseMenuItem(final CategoryNode node) {
+    JMenuItem result = new JMenuItem("Collapse All Descendant Categories");
+    result.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        collapseDescendants(node);
+      }
+    });
+    return result;
+  }
+
+  /**
+   * This featured was moved from the LogBrokerMonitor class
+   * to the CategoryNodeExplorer so that the Category tree
+   * could be pruned from the Category Explorer popup menu.
+   * This menu option only appears when a user right clicks on
+   * the Category parent node.
+   *
+   * See removeUnusedNodes()
+   */
+  protected JMenuItem createRemoveMenuItem() {
+    JMenuItem result = new JMenuItem("Remove All Empty Categories");
+    result.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        while (removeUnusedNodes() > 0) ;
+      }
+    });
+    return result;
+  }
+
+  protected void expandDescendants(CategoryNode node) {
+    Enumeration descendants = node.depthFirstEnumeration();
+    CategoryNode current;
+    while (descendants.hasMoreElements()) {
+      current = (CategoryNode) descendants.nextElement();
+      expand(current);
+    }
+  }
+
+  protected void collapseDescendants(CategoryNode node) {
+    Enumeration descendants = node.depthFirstEnumeration();
+    CategoryNode current;
+    while (descendants.hasMoreElements()) {
+      current = (CategoryNode) descendants.nextElement();
+      collapse(current);
+    }
+  }
+
+  /**
+   * Removes any inactive nodes from the Category tree.
+   */
+  protected int removeUnusedNodes() {
+    int count = 0;
+    CategoryNode root = _categoryModel.getRootCategoryNode();
+    Enumeration enumeration = root.depthFirstEnumeration();
+    while (enumeration.hasMoreElements()) {
+      CategoryNode node = (CategoryNode) enumeration.nextElement();
+      if (node.isLeaf() && node.getNumberOfContainedRecords() == 0
+          && node.getParent() != null) {
+        _categoryModel.removeNodeFromParent(node);
+        count++;
+      }
+    }
+
+    return count;
+  }
+
+  protected void expand(CategoryNode node) {
+    _tree.expandPath(getTreePath(node));
+  }
+
+  protected TreePath getTreePath(CategoryNode node) {
+    return new TreePath(node.getPath());
+  }
+
+  protected void collapse(CategoryNode node) {
+    _tree.collapsePath(getTreePath(node));
+  }
+
+  //-----------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditorRenderer.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditorRenderer.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditorRenderer.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditorRenderer.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import java.awt.Component;
+
+import javax.swing.JCheckBox;
+import javax.swing.JTree;
+
+/**
+ * CategoryNodeEditorRenderer
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryNodeEditorRenderer extends CategoryNodeRenderer {
+  private static final long serialVersionUID = -6094804684259929574L;
+
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  public Component getTreeCellRendererComponent(
+      JTree tree, Object value,
+      boolean selected, boolean expanded,
+      boolean leaf, int row,
+      boolean hasFocus) {
+    Component c = super.getTreeCellRendererComponent(tree,
+        value, selected, expanded,
+        leaf, row, hasFocus);
+
+    return c;
+  }
+
+  public JCheckBox getCheckBox() {
+    return _checkBox;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditorRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeRenderer.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeRenderer.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeRenderer.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeRenderer.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import javax.swing.*;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import java.awt.*;
+import java.net.URL;
+
+/**
+ * CategoryNodeRenderer
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryNodeRenderer extends DefaultTreeCellRenderer {
+  private static final long serialVersionUID = -6046702673278595048L;
+
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  public static final Color FATAL_CHILDREN = new Color(189, 113, 0);
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected JCheckBox _checkBox = new JCheckBox();
+  protected JPanel _panel = new JPanel();
+  protected static ImageIcon _sat = null;
+//   protected JLabel              _label  = new JLabel();
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+  public CategoryNodeRenderer() {
+    _panel.setBackground(UIManager.getColor("Tree.textBackground"));
+
+    if (_sat == null) {
+      // Load the satellite image.
+      String resource =
+          "/org/apache/log4j/lf5/viewer/images/channelexplorer_satellite.gif";
+      URL satURL = getClass().getResource(resource);
+
+      _sat = new ImageIcon(satURL);
+    }
+
+    setOpaque(false);
+    _checkBox.setOpaque(false);
+    _panel.setOpaque(false);
+
+    // The flowlayout set to LEFT is very important so that the editor
+    // doesn't jump around.
+    _panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
+    _panel.add(_checkBox);
+    _panel.add(this);
+
+    setOpenIcon(_sat);
+    setClosedIcon(_sat);
+    setLeafIcon(_sat);
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+  public Component getTreeCellRendererComponent(
+      JTree tree, Object value,
+      boolean selected, boolean expanded,
+      boolean leaf, int row,
+      boolean hasFocus) {
+
+    CategoryNode node = (CategoryNode) value;
+    //FileNode node = (FileNode)value;
+    //String s = tree.convertValueToText(value, selected,
+    //						   expanded, leaf, row, hasFocus);
+
+    super.getTreeCellRendererComponent(
+        tree, value, selected, expanded,
+        leaf, row, hasFocus);
+
+    if (row == 0) {
+      // Root row -- no check box
+      _checkBox.setVisible(false);
+    } else {
+      _checkBox.setVisible(true);
+      _checkBox.setSelected(node.isSelected());
+    }
+    String toolTip = buildToolTip(node);
+    _panel.setToolTipText(toolTip);
+    if (node.hasFatalChildren()) {
+      this.setForeground(FATAL_CHILDREN);
+    }
+    if (node.hasFatalRecords()) {
+      this.setForeground(Color.red);
+    }
+
+    return _panel;
+  }
+
+  public Dimension getCheckBoxOffset() {
+    return new Dimension(0, 0);
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  protected String buildToolTip(CategoryNode node) {
+    StringBuffer result = new StringBuffer();
+    result.append(node.getTitle()).append(" contains a total of ");
+    result.append(node.getTotalNumberOfRecords());
+    result.append(" LogRecords.");
+    result.append(" Right-click for more info.");
+    return result.toString();
+  }
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryPath.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryPath.java?rev=1345492&view=auto
==============================================================================
--- logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryPath.java (added)
+++ logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryPath.java Sat Jun  2 11:40:31 2012
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5.viewer.categoryexplorer;
+
+import java.util.LinkedList;
+import java.util.StringTokenizer;
+
+/**
+ * CategoryPath is a collection of CategoryItems which represent a
+ * path of categories.
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class CategoryPath {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected LinkedList _categoryElements = new LinkedList();
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public CategoryPath() {
+    super();
+  }
+
+  /**
+   * Construct a CategoryPath.  If the category is null, it defaults to "Debug".
+   */
+  public CategoryPath(String category) {
+    String processedCategory = category;
+
+    if (processedCategory == null) {
+      processedCategory = "Debug";
+    }
+
+    processedCategory = processedCategory.replace('/', '.');
+    processedCategory = processedCategory.replace('\\', '.');
+
+    StringTokenizer st = new StringTokenizer(processedCategory, ".");
+    while (st.hasMoreTokens()) {
+      String element = st.nextToken();
+      addCategoryElement(new CategoryElement(element));
+    }
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  /**
+   * returns the number of CategoryElements.
+   */
+  public int size() {
+    int count = _categoryElements.size();
+
+    return (count);
+  }
+
+  public boolean isEmpty() {
+    boolean empty = false;
+
+    if (_categoryElements.size() == 0) {
+      empty = true;
+    }
+
+    return (empty);
+  }
+
+
+  /**
+   * Removes all categoryElements.
+   */
+  public void removeAllCategoryElements() {
+    _categoryElements.clear();
+  }
+
+  /**
+   * Adds the specified categoryElement to the end of the categoryElement set.
+   */
+  public void addCategoryElement(CategoryElement categoryElement) {
+    _categoryElements.addLast(categoryElement);
+  }
+
+  /**
+   * Returns the CategoryElement at the specified index.
+   */
+  public CategoryElement categoryElementAt(int index) {
+    return ((CategoryElement) _categoryElements.get(index));
+  }
+
+
+  public String toString() {
+    StringBuffer out = new StringBuffer(100);
+
+    out.append("\n");
+    out.append("===========================\n");
+    out.append("CategoryPath:                   \n");
+    out.append("---------------------------\n");
+
+    out.append("\nCategoryPath:\n\t");
+
+    if (this.size() > 0) {
+      for (int i = 0; i < this.size(); i++) {
+        out.append(this.categoryElementAt(i).toString());
+        out.append("\n\t");
+      }
+    } else {
+      out.append("<<NONE>>");
+    }
+
+    out.append("\n");
+    out.append("===========================\n");
+
+    return (out.toString());
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}

Propchange: logging/log4j/branches/log4j12modules/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryPath.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message