logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject cvs commit: logging-log4j/src/java/org/apache/log4j/chainsaw/color ColorPanel.java
Date Mon, 02 Feb 2004 06:12:43 GMT
sdeboy      2004/02/01 22:12:43

  Modified:    src/java/org/apache/log4j/rule ExpressionRule.java
                        RuleFactory.java
               src/java/org/apache/log4j/chainsaw LogPanel.java LogUI.java
               .        build.xml
               src/java/org/apache/log4j/chainsaw/color ColorPanel.java
  Log:
  - replaced 'refine focus' textfield with combobox - press enter to add -valid- expressions
to the list
  - note: refine focus expressions are not yet saved
  - updated build script to build javadoc for chainsaw packages
  - updated logui javadoc
  
  Revision  Changes    Path
  1.5       +2 -1      logging-log4j/src/java/org/apache/log4j/rule/ExpressionRule.java
  
  Index: ExpressionRule.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rule/ExpressionRule.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExpressionRule.java	16 Jan 2004 23:49:03 -0000	1.4
  +++ ExpressionRule.java	2 Feb 2004 06:12:43 -0000	1.5
  @@ -145,7 +145,8 @@
           }
         }
   
  -      if ((stack.size() == 0) || (!(stack.peek() instanceof Rule))) {
  +      //stack should contain a single rule if the expression is valid
  +      if ((stack.size() != 1) || (!(stack.peek() instanceof Rule))) {
           throw new IllegalArgumentException("invalid expression: " + expression);
         } else {
           return (Rule) stack.pop();
  
  
  
  1.2       +1 -1      logging-log4j/src/java/org/apache/log4j/rule/RuleFactory.java
  
  Index: RuleFactory.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/rule/RuleFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RuleFactory.java	14 Dec 2003 20:35:08 -0000	1.1
  +++ RuleFactory.java	2 Feb 2004 06:12:43 -0000	1.2
  @@ -147,6 +147,6 @@
       if (GREATER_THAN_EQUALS_RULE.equals(symbol)) {
         return InequalityRule.getRule(GREATER_THAN_EQUALS_RULE, stack);
       }
  -    return null;
  +    throw new IllegalArgumentException("Invalid rule: " + symbol);
     }
   }
  
  
  
  1.53      +106 -79   logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
  
  Index: LogPanel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- LogPanel.java	25 Jan 2004 11:06:59 -0000	1.52
  +++ LogPanel.java	2 Feb 2004 06:12:43 -0000	1.53
  @@ -49,28 +49,6 @@
   
   package org.apache.log4j.chainsaw;
   
  -import org.apache.log4j.Layout;
  -import org.apache.log4j.PatternLayout;
  -import org.apache.log4j.chainsaw.color.ColorPanel;
  -import org.apache.log4j.chainsaw.color.RuleColorizer;
  -import org.apache.log4j.chainsaw.filter.FilterModel;
  -import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  -import org.apache.log4j.chainsaw.icons.LineIconFactory;
  -import org.apache.log4j.chainsaw.layout.DefaultLayoutFactory;
  -import org.apache.log4j.chainsaw.layout.EventDetailLayout;
  -import org.apache.log4j.chainsaw.layout.LayoutEditorPane;
  -import org.apache.log4j.chainsaw.messages.MessageCenter;
  -import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  -import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  -import org.apache.log4j.chainsaw.prefs.SettingsListener;
  -import org.apache.log4j.chainsaw.prefs.SettingsManager;
  -import org.apache.log4j.helpers.ISO8601DateFormat;
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.rule.ExpressionRule;
  -import org.apache.log4j.rule.ExpressionRuleContext;
  -import org.apache.log4j.spi.LoggingEvent;
  -import org.apache.log4j.spi.LoggingEventFieldResolver;
  -
   import java.awt.BorderLayout;
   import java.awt.Component;
   import java.awt.Container;
  @@ -92,10 +70,8 @@
   import java.awt.event.MouseMotionAdapter;
   import java.awt.event.WindowAdapter;
   import java.awt.event.WindowEvent;
  -
   import java.beans.PropertyChangeEvent;
   import java.beans.PropertyChangeListener;
  -
   import java.io.BufferedInputStream;
   import java.io.BufferedOutputStream;
   import java.io.EOFException;
  @@ -107,10 +83,8 @@
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
   import java.io.Serializable;
  -
   import java.text.NumberFormat;
   import java.text.SimpleDateFormat;
  -
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.HashMap;
  @@ -120,6 +94,7 @@
   import java.util.Map;
   import java.util.Set;
   import java.util.StringTokenizer;
  +import java.util.Vector;
   
   import javax.swing.AbstractAction;
   import javax.swing.Action;
  @@ -129,6 +104,7 @@
   import javax.swing.ButtonGroup;
   import javax.swing.ImageIcon;
   import javax.swing.JCheckBoxMenuItem;
  +import javax.swing.JComboBox;
   import javax.swing.JComponent;
   import javax.swing.JDialog;
   import javax.swing.JEditorPane;
  @@ -161,6 +137,28 @@
   import javax.swing.table.TableColumn;
   import javax.swing.table.TableColumnModel;
   
  +import org.apache.log4j.Layout;
  +import org.apache.log4j.PatternLayout;
  +import org.apache.log4j.chainsaw.color.ColorPanel;
  +import org.apache.log4j.chainsaw.color.RuleColorizer;
  +import org.apache.log4j.chainsaw.filter.FilterModel;
  +import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  +import org.apache.log4j.chainsaw.icons.LineIconFactory;
  +import org.apache.log4j.chainsaw.layout.DefaultLayoutFactory;
  +import org.apache.log4j.chainsaw.layout.EventDetailLayout;
  +import org.apache.log4j.chainsaw.layout.LayoutEditorPane;
  +import org.apache.log4j.chainsaw.messages.MessageCenter;
  +import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  +import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  +import org.apache.log4j.chainsaw.prefs.SettingsListener;
  +import org.apache.log4j.chainsaw.prefs.SettingsManager;
  +import org.apache.log4j.helpers.ISO8601DateFormat;
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.rule.ExpressionRule;
  +import org.apache.log4j.rule.ExpressionRuleContext;
  +import org.apache.log4j.spi.LoggingEvent;
  +import org.apache.log4j.spi.LoggingEventFieldResolver;
  +
   /**
    * A LogPanel provides a view to a collection of LoggingEvents.<br>
    * <br>
  @@ -170,56 +168,47 @@
    * individual LogPanels which  match each event's resolved expression.<br>
    * <br>
    * The LogPanel's capabilities can be broken up into four areas:<br>
  - * - toolbar<br>
  - * - logger tree<br>
  - * - table<br>
  - * - detail panel<br>
  - * <br>
  - * The toolbar provides 'find' and 'refine focus' features<br>
  - * <br>
  - * The logger tree displays a tree of the logger hierarchy which can be used
  - * to filter the display<br>
  - * <br>
  - * The table displays the events which pass the filtering rules<br>
  - * <br>
  - * The detail panel displays information about the currently selected event<br>
  - * <br>
  + * <ul><li> toolbar - provides 'find' and 'refine focus' features
  + * <li> logger tree - displays a tree of the logger hierarchy, which can be used
  + * to filter the display
  + * <li> table - displays the events which pass the filtering rules
  + * <li>detail panel - displays information about the currently selected event
  + * </ul>
    * Here is a complete list of LogPanel's capabilities:<br>
  - * <br>
  - * - display selected LoggingEvent row number and total LoggingEvent count<br>
  - * - pause or unpause reception of LoggingEvents<br>
  - * - configure, load and save column settings (displayed columns, order, width)<br>
  - * - configure, load and save color rules<br>
  - * - filter displayed LoggingEvents based on the logger tree settings<br>
  - * - filter displayed LoggingEvents based on a 'refine focus' expression
  - * (evaluates only those LoggingEvents which pass the logger tree filter<br>
  - * - colorize LoggingEvents based on expressions <br>
  - * - hide, show and configure the detail pane and tooltip<br>
  - * - configure the formatting of the logger, level and timestamp fields<br>
  - * - dock or undock<br>
  - * - table displays first line of exception, but when cell is clicked, a
  - * popup opens to display the full stack trace<br>
  - * - find<br>
  - * - scroll to bottom<br>
  - * - sort<br>
  - * - provide a context menu which can be used to build color or display expressions<br>
  - * - hide or show the logger tree<br>
  - * - toggle the container storing the LoggingEvents to use either a
  + * <ul><li>display selected LoggingEvent row number and total LoggingEvent
count
  + * <li>pause or unpause reception of LoggingEvents
  + * <li>configure, load and save column settings (displayed columns, order, width)
  + * <li>configure, load and save color rules
  + * filter displayed LoggingEvents based on the logger tree settings
  + * <li>filter displayed LoggingEvents based on a 'refine focus' expression
  + * (evaluates only those LoggingEvents which pass the logger tree filter
  + * <li>colorize LoggingEvents based on expressions
  + * <li>hide, show and configure the detail pane and tooltip
  + * <li>configure the formatting of the logger, level and timestamp fields
  + * <li>dock or undock
  + * <li>table displays first line of exception, but when cell is clicked, a
  + * popup opens to display the full stack trace
  + * <li>find
  + * <li>scroll to bottom
  + * <li>sort
  + * <li>provide a context menu which can be used to build color or display expressions
  + * <li>hide or show the logger tree
  + * <li>toggle the container storing the LoggingEvents to use either a
    * CyclicBuffer (defaults to max size of 5000,  but configurable  through
  - * CHAINSAW_CAPACITY system property) or ArrayList (no max size)<br>
  - * - use the mouse context menu to 'best-fit' columns, define display
  + * CHAINSAW_CAPACITY system property) or ArrayList (no max size)
  + * <li>use the mouse context menu to 'best-fit' columns, define display
    * expression filters based on mouse location and access other capabilities
  + *</ul>
  + *
  + *@see org.apache.log4j.chainsaw.color.ColorPanel
  + *@see org.apache.log4j.rule.ExpressionRule
  + *@see org.apache.log4j.spi.LoggingEventFieldResolver
    *
  - * @author Scott Deboy (sdeboy at apache.org)
  - * @author Paul Smith (psmith at apache.org)
  + *@author Scott Deboy (sdeboy at apache.org)
  + *@author Paul Smith (psmith at apache.org)
    *
  - * @see org.apache.log4j.spi.LoggingEventFieldResolver
  - * @see org.apache.log4j.chainsaw.color.ColorPanel
  - * @see org.apache.log4j.rule.ExpressionRule
  - * @see org.apache.log4j.chainsaw.LoggerNameTreePanel
    */
  -public class LogPanel extends DockablePanel implements SettingsListener,
  -  EventBatchListener {
  +public class LogPanel extends DockablePanel implements EventBatchListener, SettingsListener
{
     private final String identifier;
     private final ChainsawStatusBar statusBar;
     private final JFrame preferencesFrame = new JFrame();
  @@ -877,14 +866,49 @@
         new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 0));
       upperLeftPanel.add(filterLabel);
   
  -    final JTextField filterText = new JTextField();
  -    filterText.addKeyListener(
  -      new ExpressionRuleContext(filterModel, filterText));
  -
  -    filterText.getDocument().addDocumentListener(
  -      new DelayedFilterTextDocumentListener(filterText));
  -
  -    upperPanel.add(filterText, BorderLayout.CENTER);
  +    //hold a reference to the combobox model so that we can check to prevent duplicates
  +    final Vector v = new Vector();
  +    final JComboBox filterCombo = new JComboBox(v);
  +    final JTextField filterText;
  +
  +    if (filterCombo.getEditor().getEditorComponent() instanceof JTextField) {
  +        String comboToolTipText = "Enter an expression, press enter to add to list";
  +        filterText = (JTextField)filterCombo.getEditor().getEditorComponent();
  +        filterText.setToolTipText(comboToolTipText);
  +        filterText.addKeyListener(
  +          new ExpressionRuleContext(filterModel, filterText));
  +        filterText.getDocument().addDocumentListener(
  +          new DelayedFilterTextDocumentListener(filterText));
  +        filterCombo.setEditable(true);
  +        filterCombo.addActionListener(new AbstractAction() {
  +        public void actionPerformed(ActionEvent e) {
  +        if (e.getActionCommand().equals("comboBoxEdited")) {
  +            try {
  +                System.out.println("Examining rule: " + filterCombo.getSelectedItem().toString());
  +                //verify the expression is valid
  +                ExpressionRule.getRule(filterCombo.getSelectedItem().toString());
  +                System.out.println("rule was valid");
  +            } catch (IllegalArgumentException iae) {
  +                System.out.println("rule was not valid");
  +                //don't add expressions that aren't valid
  +                return;
  +            } 
  +            //should be 'valid expression' check
  +            if (!(v.contains(filterCombo.getSelectedItem()))) {
  +                filterCombo.addItem(filterCombo.getSelectedItem());
  +            }
  +        }
  +        }});
  +        upperPanel.add(filterCombo, BorderLayout.CENTER);
  +    } else {
  +        filterText = new JTextField();
  +        filterText.setToolTipText("Enter an expression");
  +        filterText.addKeyListener(
  +          new ExpressionRuleContext(filterModel, filterText));
  +        filterText.getDocument().addDocumentListener(
  +          new DelayedFilterTextDocumentListener(filterText));
  +        upperPanel.add(filterText, BorderLayout.CENTER);
  +    }
       upperPanel.add(upperLeftPanel, BorderLayout.WEST);
   
       JPanel upperRightPanel =
  @@ -2148,10 +2172,12 @@
       private long lastTimeStamp = System.currentTimeMillis();
       private final Thread delayThread;
       private final long CHECK_PERIOD = 1000;
  +    private final String defaultToolTip;
   
       private DelayedFilterTextDocumentListener(JTextField filterText) {
         super();
         this.filterText = filterText;
  +      this.defaultToolTip = filterText.getToolTipText();
   
         this.delayThread =
           new Thread(
  @@ -2227,11 +2253,12 @@
       private void setFilter() {
         if (filterText.getText().equals("")) {
           ruleMediator.setRefinementRule(null);
  +        filterText.setToolTipText(defaultToolTip);
         } else {
           try {
             ruleMediator.setRefinementRule(
               ExpressionRule.getRule(filterText.getText()));
  -          filterText.setToolTipText("Enter expression");
  +          filterText.setToolTipText(defaultToolTip);
           } catch (IllegalArgumentException iae) {
             filterText.setToolTipText(iae.getMessage());
           }
  
  
  
  1.76      +0 -15     logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- LogUI.java	25 Jan 2004 11:06:59 -0000	1.75
  +++ LogUI.java	2 Feb 2004 06:12:43 -0000	1.76
  @@ -140,27 +140,12 @@
    * generated because Logging Events are streamed via a Receiver, or other
    * mechanism.
    *
  - * If a system property 'chainsaw.usecyclicbuffer' is set to 'true', each panel
  - * will use a cyclic buffer for displaying events and once events reach the
  - * buffer limit, the oldest events are removed from the table.
  - *
  - * If the property is not provided, there is no limit on the table's buffer
  - * size.
  - *
  - * If 'chainsaw.usecyclicbuffer' is set to 'true' and a system property
  - * 'chainsaw.cyclicbuffersize' is set to some integer value, that value will be
  - * used as the buffer size - if the buffersize is not provided, a default size
  - * of 500 is used.
  - *
    * @author Scott Deboy <sdeboy@apache.org>
    * @author Paul Smith  <psmith@apache.org>
    *
    */
   public class LogUI extends JFrame implements ChainsawViewer, SettingsListener {
     private static final String CONFIG_FILE_TO_USE = "config.file";
  -  static final String USE_CYCLIC_BUFFER_PROP_NAME = "chainsaw.usecyclicbuffer";
  -  static final String CYCLIC_BUFFER_SIZE_PROP_NAME =
  -    "chainsaw.cyclicbuffersize";
     private static final String MAIN_WINDOW_HEIGHT = "main.window.height";
     private static final String MAIN_WINDOW_WIDTH = "main.window.width";
     private static final String MAIN_WINDOW_Y = "main.window.y";
  
  
  
  1.92      +12 -0     logging-log4j/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/build.xml,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- build.xml	23 Jan 2004 17:38:50 -0000	1.91
  +++ build.xml	2 Feb 2004 06:12:43 -0000	1.92
  @@ -597,6 +597,18 @@
          org.apache.log4j.spi,
          org.apache.log4j.varia,
          org.apache.log4j.chainsaw,
  +       org.apache.log4j.chainsaw.color,
  +       org.apache.log4j.chainsaw.favourites,
  +       org.apache.log4j.chainsaw.filter,
  +       org.apache.log4j.chainsaw.help,
  +       org.apache.log4j.chainsaw.helper,
  +       org.apache.log4j.chainsaw.icons,
  +       org.apache.log4j.chainsaw.layout,
  +       org.apache.log4j.chainsaw.messages,
  +       org.apache.log4j.chainsaw.plugins,
  +       org.apache.log4j.chainsaw.prefs,
  +       org.apache.log4j.chainsaw.receivers,
  +       org.apache.log4j.rule,
          org.apache.log4j.xml,
          org.apache.log4j.xml.examples,
          org.apache.joran,
  
  
  
  1.13      +2 -2      logging-log4j/src/java/org/apache/log4j/chainsaw/color/ColorPanel.java
  
  Index: ColorPanel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/color/ColorPanel.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ColorPanel.java	1 Jan 2004 00:36:10 -0000	1.12
  +++ ColorPanel.java	2 Feb 2004 06:12:43 -0000	1.13
  @@ -283,7 +283,7 @@
     }
   
     private void configureTable() {
  -    table.setToolTipText("Click to edit");
  +    table.setToolTipText("Double click to edit");
       table.setRowHeight(20);
       table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
       table.setColumnSelectionAllowed(false);
  @@ -369,7 +369,7 @@
   
       if (result.toString().equals("")) {
         ((ExpressionTableCellRenderer) table.getColumnModel().getColumn(0).getCellRenderer())
  -      .setToolTipText("Click to edit");
  +      .setToolTipText("Double click to edit");
         statusBar.setText("");
       } else {
         statusBar.setText("Errors - see expression tooltip");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message