logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LoggerNameTreePanel.java
Date Wed, 17 Sep 2003 01:15:13 GMT
psmith      2003/09/16 18:15:13

  Modified:    src/java/org/apache/log4j/chainsaw LoggerNameTreePanel.java
  Log:
  allow an external entity to inform this panel what the
  current Logger focus should be.
  
  Revision  Changes    Path
  1.12      +29 -7     jakarta-log4j/src/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
  
  Index: LoggerNameTreePanel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- LoggerNameTreePanel.java	15 Sep 2003 22:20:58 -0000	1.11
  +++ LoggerNameTreePanel.java	17 Sep 2003 01:15:13 -0000	1.12
  @@ -51,6 +51,10 @@
    */
   package org.apache.log4j.chainsaw;
   
  +import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  +import org.apache.log4j.chainsaw.icons.LineIconFactory;
  +import org.apache.log4j.helpers.LogLog;
  +
   import java.awt.BorderLayout;
   import java.awt.Component;
   import java.awt.Dimension;
  @@ -59,8 +63,10 @@
   import java.awt.event.InputEvent;
   import java.awt.event.MouseAdapter;
   import java.awt.event.MouseEvent;
  +
   import java.beans.PropertyChangeEvent;
   import java.beans.PropertyChangeListener;
  +
   import java.util.ArrayList;
   import java.util.Collections;
   import java.util.Enumeration;
  @@ -99,10 +105,6 @@
   import javax.swing.tree.TreePath;
   import javax.swing.tree.TreeSelectionModel;
   
  -import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  -import org.apache.log4j.chainsaw.icons.LineIconFactory;
  -import org.apache.log4j.helpers.LogLog;
  -
   
   /**
    * A panel that encapsulates the Logger Name tree, with associated actions
  @@ -275,6 +277,7 @@
               focusOnAction.setEnabled(!hiddenSet.contains(logger));
               popupMenu.hideCheck.setSelected(hiddenSet.contains(logger));
             }
  +
             fireChangeEvent();
           }
         };
  @@ -452,7 +455,8 @@
             //          editLoggerAction.setEnabled(path != null);
             String logger = getCurrentlySelectedLoggerName();
             focusOnAction.setEnabled(
  -            (path != null) && (node != null) && (node.getParent() != null)
&& !hiddenSet.contains(logger));
  +            (path != null) && (node != null) && (node.getParent() != null)
  +            && !hiddenSet.contains(logger));
             hideAction.setEnabled(
               (path != null) && (node != null) && (node.getParent() != null));
   
  @@ -460,7 +464,6 @@
               setFocusOnSelected(false);
             }
   
  -
             expandAction.setEnabled(path != null);
   
             if (logger != null) {
  @@ -492,6 +495,7 @@
               logTreeModel.nodeChanged(
                 (TreeNode) logTree.getSelectionPath().getLastPathComponent());
             }
  +
             fireChangeEvent();
           }
         });
  @@ -522,7 +526,7 @@
   
       if ((logger == null) || (logger.length() == 0)) {
         focusOnAction.putValue(Action.NAME, "Focus On...");
  -	  hideAction.putValue(Action.NAME, "Ignore ...");
  +      hideAction.putValue(Action.NAME, "Ignore ...");
       } else {
         focusOnAction.putValue(Action.NAME, "Focus On '" + logger + "'");
         hideAction.putValue(Action.NAME, "Ignore '" + logger + "'");
  @@ -759,6 +763,24 @@
       toolbar.add(Box.createHorizontalGlue());
       toolbar.add(closeButton);
       toolbar.add(Box.createHorizontalStrut(5));
  +  }
  +
  +  /**
  +   * Ensures the Focus is set to a specific logger name
  +   * @param string
  +   */
  +  public void setFocusOn(String logger) {
  +    DefaultMutableTreeNode node = logTreeModel.lookupLogger(logger);
  +    if(node!=null){
  +		TreeNode[] nodes = node.getPath();
  +		TreePath treePath = new TreePath(nodes);
  +    	logTree.setSelectionPath(treePath);
  +    	if(!focusOnLoggerButton.isSelected()){
  +    		focusOnLoggerButton.doClick();
  +    	}
  +    }else{
  +    	LogLog.error("failed to lookup logger " + logger);
  +    }
     }
   
     /**
  
  
  

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


Mime
View raw message