logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r1345524 [14/17] - in /logging/log4j/branches/log4j12-bz53299: ./ contribs/ contribs/CekiGulcu/ contribs/EirikLygre/ contribs/JamesHouse/ contribs/Jamie Tsao/ contribs/JimMoore/ contribs/KevinSteppe/ contribs/KitchingSimon/ contribs/LeosLit...
Date Sat, 02 Jun 2012 15:36:26 GMT
Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5ErrorDialog.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5ErrorDialog.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5ErrorDialog.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5ErrorDialog.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,92 @@
+/*
+ * 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.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+/**
+ * LogFactor5ErrorDialog
+ *
+ * @author Richard Hurst
+ * @author Brad Marlborough
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class LogFactor5ErrorDialog extends LogFactor5Dialog {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+  public LogFactor5ErrorDialog(JFrame jframe, String message) {
+    super(jframe, "Error", true);
+
+    JButton ok = new JButton("Ok");
+    ok.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        hide();
+      }
+    });
+
+    JPanel bottom = new JPanel();
+    bottom.setLayout(new FlowLayout());
+    bottom.add(ok);
+
+    JPanel main = new JPanel();
+    main.setLayout(new GridBagLayout());
+    wrapStringOnPanel(message, main);
+
+    getContentPane().add(main, BorderLayout.CENTER);
+    getContentPane().add(bottom, BorderLayout.SOUTH);
+    show();
+
+  }
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces
+  //--------------------------------------------------------------------------
+}
\ No newline at end of file

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

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5InputDialog.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5InputDialog.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5InputDialog.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5InputDialog.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,145 @@
+/*
+ * 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.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+
+/**
+ * LogFactor5InputDialog
+ *
+ * Creates a popup input dialog box so that users can enter
+ * a URL to open a log file from.
+ *
+ * @author Richard Hurst
+ * @author Brad Marlborough
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class LogFactor5InputDialog extends LogFactor5Dialog {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+  public static final int SIZE = 30;
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+  private JTextField _textField;
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  /**
+   * Configures an input dialog box using a defualt size for the text field.
+   * param jframe the frame where the dialog will be loaded from.
+   * param title the title of the dialog box.
+   * param label the label to be put in the dialog box.
+   */
+  public LogFactor5InputDialog(JFrame jframe, String title, String label) {
+    this(jframe, title, label, SIZE);
+  }
+
+  /**
+   * Configures an input dialog box.
+   * param jframe the frame where the dialog will be loaded from.
+   * param title the title of the dialog box.
+   * param label the label to be put in the dialog box.
+   * param size the size of the text field.
+   */
+  public LogFactor5InputDialog(JFrame jframe, String title, String label,
+      int size) {
+    super(jframe, title, true);
+
+    JPanel bottom = new JPanel();
+    bottom.setLayout(new FlowLayout());
+
+    JPanel main = new JPanel();
+    main.setLayout(new FlowLayout());
+    main.add(new JLabel(label));
+    _textField = new JTextField(size);
+    main.add(_textField);
+
+    addKeyListener(new KeyAdapter() {
+      public void keyPressed(KeyEvent e) {
+        if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+          hide();
+        }
+      }
+    });
+
+    JButton ok = new JButton("Ok");
+    ok.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        hide();
+      }
+    });
+
+    JButton cancel = new JButton("Cancel");
+    cancel.addActionListener(new ActionListener() {
+      public void actionPerformed(ActionEvent e) {
+        hide();
+        // set the text field to blank just in case
+        // a file was selected before the Cancel
+        // button was pressed.
+        _textField.setText("");
+      }
+    });
+
+    bottom.add(ok);
+    bottom.add(cancel);
+    getContentPane().add(main, BorderLayout.CENTER);
+    getContentPane().add(bottom, BorderLayout.SOUTH);
+    pack();
+    centerWindow(this);
+    show();
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+  public String getText() {
+    String s = _textField.getText();
+
+    if (s != null && s.trim().length() == 0) {
+      return null;
+    }
+
+    return s;
+
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces
+  //--------------------------------------------------------------------------
+}
\ No newline at end of file

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

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5LoadingDialog.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5LoadingDialog.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5LoadingDialog.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogFactor5LoadingDialog.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,82 @@
+/*
+ * 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.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridBagLayout;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+/**
+ * LogFactor5LoadingDialog
+ *
+ * @author Richard Hurst
+ * @author Brad Marlborough
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class LogFactor5LoadingDialog extends LogFactor5Dialog {
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public LogFactor5LoadingDialog(JFrame jframe, String message) {
+    super(jframe, "LogFactor5", false);
+
+    JPanel bottom = new JPanel();
+    bottom.setLayout(new FlowLayout());
+
+    JPanel main = new JPanel();
+    main.setLayout(new GridBagLayout());
+    wrapStringOnPanel(message, main);
+
+    getContentPane().add(main, BorderLayout.CENTER);
+    getContentPane().add(bottom, BorderLayout.SOUTH);
+    show();
+
+  }
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces
+  //--------------------------------------------------------------------------
+}
\ No newline at end of file

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

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTable.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTable.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTable.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTable.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,277 @@
+/*
+ * 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.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+
+import org.apache.log4j.lf5.util.DateFormatManager;
+
+/**
+ * LogTable.
+ *
+ * @author Michael J. Sikorsky
+ * @author Robert Shaw
+ * @author Brad Marlborough
+ * @author Brent Sprecher
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class LogTable extends JTable {
+  private static final long serialVersionUID = 4867085140195148458L;
+  //--------------------------------------------------------------------------
+  //   Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected int _rowHeight = 30;
+  protected JTextArea _detailTextArea;
+
+  // For the columns:
+  protected int _numCols = 9;
+  protected TableColumn[] _tableColumns = new TableColumn[_numCols];
+  protected int[] _colWidths = {40, 40, 40, 70, 70, 360, 440, 200, 60};
+  protected LogTableColumn[] _colNames = LogTableColumn.getLogTableColumnArray();
+  protected int _colDate = 0;
+  protected int _colThread = 1;
+  protected int _colMessageNum = 2;
+  protected int _colLevel = 3;
+  protected int _colNDC = 4;
+  protected int _colCategory = 5;
+  protected int _colMessage = 6;
+  protected int _colLocation = 7;
+  protected int _colThrown = 8;
+
+  protected DateFormatManager _dateFormatManager = null;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+
+  public LogTable(JTextArea detailTextArea) {
+    super();
+
+    init();
+
+    _detailTextArea = detailTextArea;
+
+    setModel(new FilteredLogTableModel());
+
+    Enumeration columns = getColumnModel().getColumns();
+    int i = 0;
+    while (columns.hasMoreElements()) {
+      TableColumn col = (TableColumn) columns.nextElement();
+      col.setCellRenderer(new LogTableRowRenderer());
+      col.setPreferredWidth(_colWidths[i]);
+
+      _tableColumns[i] = col;
+      i++;
+    }
+
+    ListSelectionModel rowSM = getSelectionModel();
+    rowSM.addListSelectionListener(new LogTableListSelectionListener(this));
+
+    //setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  /**
+   * Get the DateFormatManager for formatting dates.
+   */
+  public DateFormatManager getDateFormatManager() {
+    return _dateFormatManager;
+  }
+
+  /**
+   * Set the date format manager for formatting dates.
+   */
+  public void setDateFormatManager(DateFormatManager dfm) {
+    _dateFormatManager = dfm;
+  }
+
+  public synchronized void clearLogRecords() {
+    //For JDK1.3
+    //((DefaultTableModel)getModel()).setRowCount(0);
+
+    // For JDK1.2.x
+    getFilteredLogTableModel().clear();
+  }
+
+  public FilteredLogTableModel getFilteredLogTableModel() {
+    return (FilteredLogTableModel) getModel();
+  }
+
+  // default view if a view is not set and saved
+  public void setDetailedView() {
+    //TODO: Defineable Views.
+    TableColumnModel model = getColumnModel();
+    // Remove all the columns:
+    for (int f = 0; f < _numCols; f++) {
+      model.removeColumn(_tableColumns[f]);
+    }
+    // Add them back in the correct order:
+    for (int i = 0; i < _numCols; i++) {
+      model.addColumn(_tableColumns[i]);
+    }
+    //SWING BUG:
+    sizeColumnsToFit(-1);
+  }
+
+  public void setView(List columns) {
+    TableColumnModel model = getColumnModel();
+
+    // Remove all the columns:
+    for (int f = 0; f < _numCols; f++) {
+      model.removeColumn(_tableColumns[f]);
+    }
+    Iterator selectedColumns = columns.iterator();
+    Vector columnNameAndNumber = getColumnNameAndNumber();
+    while (selectedColumns.hasNext()) {
+      // add the column to the view
+      model.addColumn(_tableColumns[columnNameAndNumber.indexOf(selectedColumns.next())]);
+    }
+
+    //SWING BUG:
+    sizeColumnsToFit(-1);
+  }
+
+  public void setFont(Font font) {
+    super.setFont(font);
+    Graphics g = this.getGraphics();
+    if (g != null) {
+      FontMetrics fm = g.getFontMetrics(font);
+      int height = fm.getHeight();
+      _rowHeight = height + height / 3;
+      setRowHeight(_rowHeight);
+    }
+
+
+  }
+
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  protected void init() {
+    setRowHeight(_rowHeight);
+    setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+  }
+
+  // assign a column number to a column name
+  protected Vector getColumnNameAndNumber() {
+    Vector columnNameAndNumber = new Vector();
+    for (int i = 0; i < _colNames.length; i++) {
+      columnNameAndNumber.add(i, _colNames[i]);
+    }
+    return columnNameAndNumber;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+  class LogTableListSelectionListener implements ListSelectionListener {
+    protected JTable _table;
+
+    public LogTableListSelectionListener(JTable table) {
+      _table = table;
+    }
+
+    public void valueChanged(ListSelectionEvent e) {
+      //Ignore extra messages.
+      if (e.getValueIsAdjusting()) {
+        return;
+      }
+
+      ListSelectionModel lsm = (ListSelectionModel) e.getSource();
+      if (lsm.isSelectionEmpty()) {
+        //no rows are selected
+      } else {
+        StringBuffer buf = new StringBuffer();
+        int selectedRow = lsm.getMinSelectionIndex();
+
+        for (int i = 0; i < _numCols - 1; i++) {
+          String value = "";
+          Object obj = _table.getModel().getValueAt(selectedRow, i);
+          if (obj != null) {
+            value = obj.toString();
+          }
+
+          buf.append(_colNames[i] + ":");
+          buf.append("\t");
+
+          if (i == _colThread || i == _colMessage || i == _colLevel) {
+            buf.append("\t"); // pad out the date.
+          }
+
+          if (i == _colDate || i == _colNDC) {
+            buf.append("\t\t"); // pad out the date.
+          }
+
+//               if( i == _colSequence)
+//               {
+//                  buf.append("\t\t\t"); // pad out the Sequnce.
+//               }
+
+          buf.append(value);
+          buf.append("\n");
+        }
+        buf.append(_colNames[_numCols - 1] + ":\n");
+        Object obj = _table.getModel().getValueAt(selectedRow, _numCols - 1);
+        if (obj != null) {
+          buf.append(obj.toString());
+        }
+
+        _detailTextArea.setText(buf.toString());
+      }
+    }
+  }
+}
+
+
+
+
+
+

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

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumn.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumn.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumn.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumn.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,166 @@
+/*
+ * 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.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * LogTableColumn
+ *
+ * @author Michael J. Sikorsky
+ * @author Brad Marlborough
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class LogTableColumn implements java.io.Serializable {
+  private static final long serialVersionUID = -4275827753626456547L;
+
+  // log4j table columns.
+  public final static LogTableColumn DATE = new LogTableColumn("Date");
+  public final static LogTableColumn THREAD = new LogTableColumn("Thread");
+  public final static LogTableColumn MESSAGE_NUM = new LogTableColumn("Message #");
+  public final static LogTableColumn LEVEL = new LogTableColumn("Level");
+  public final static LogTableColumn NDC = new LogTableColumn("NDC");
+  public final static LogTableColumn CATEGORY = new LogTableColumn("Category");
+  public final static LogTableColumn MESSAGE = new LogTableColumn("Message");
+  public final static LogTableColumn LOCATION = new LogTableColumn("Location");
+  public final static LogTableColumn THROWN = new LogTableColumn("Thrown");
+
+
+  //--------------------------------------------------------------------------
+  //   Protected Variables:
+  //--------------------------------------------------------------------------
+  protected String _label;
+
+  //--------------------------------------------------------------------------
+  //   Private Variables:
+  //--------------------------------------------------------------------------
+  private static LogTableColumn[] _log4JColumns;
+  private static Map _logTableColumnMap;
+
+  //--------------------------------------------------------------------------
+  //   Constructors:
+  //--------------------------------------------------------------------------
+  static {
+    _log4JColumns = new LogTableColumn[]{DATE, THREAD, MESSAGE_NUM, LEVEL, NDC, CATEGORY,
+                                         MESSAGE, LOCATION, THROWN};
+
+    _logTableColumnMap = new HashMap();
+
+    for (int i = 0; i < _log4JColumns.length; i++) {
+      _logTableColumnMap.put(_log4JColumns[i].getLabel(), _log4JColumns[i]);
+    }
+  }
+
+
+  public LogTableColumn(String label) {
+    _label = label;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Public Methods:
+  //--------------------------------------------------------------------------
+
+  /**
+   * Return the Label of the LogLevel.
+   */
+  public String getLabel() {
+    return _label;
+  }
+
+  /**
+   * Convert a column label into a LogTableColumn object.
+   *
+   * @param column The label of a level to be converted into a LogTableColumn.
+   * @return LogTableColumn The LogTableColumn with a label equal to column.
+   * @throws LogTableColumnFormatException Is thrown when the column can not be
+   *         converted into a LogTableColumn.
+   */
+  public static LogTableColumn valueOf(String column)
+      throws LogTableColumnFormatException {
+    LogTableColumn tableColumn = null;
+    if (column != null) {
+      column = column.trim();
+      tableColumn = (LogTableColumn) _logTableColumnMap.get(column);
+    }
+
+    if (tableColumn == null) {
+      StringBuffer buf = new StringBuffer();
+      buf.append("Error while trying to parse (" + column + ") into");
+      buf.append(" a LogTableColumn.");
+      throw new LogTableColumnFormatException(buf.toString());
+    }
+    return tableColumn;
+  }
+
+
+  public boolean equals(Object o) {
+    boolean equals = false;
+
+    if (o instanceof LogTableColumn) {
+      if (this.getLabel() ==
+          ((LogTableColumn) o).getLabel()) {
+        equals = true;
+      }
+    }
+
+    return equals;
+  }
+
+  public int hashCode() {
+    return _label.hashCode();
+  }
+
+  public String toString() {
+    return _label;
+  }
+
+  /**
+   * @return A <code>List</code> of <code>LogTableColumn/code> objects that map
+   * to log4j <code>Column</code> objects.
+   */
+  public static List getLogTableColumns() {
+    return Arrays.asList(_log4JColumns);
+  }
+
+  public static LogTableColumn[] getLogTableColumnArray() {
+    return _log4JColumns;
+  }
+
+  //--------------------------------------------------------------------------
+  //   Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  //   Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
+
+
+
+
+
+

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

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableColumnFormatException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/LogTableRowRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/TrackingAdjustmentListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryAbstractCellEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerLogRecordFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryExplorerTree.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java Sat Jun  2 15:35:46 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/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryImmediateEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message