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 Tue, 23 Sep 2003 23:11:32 GMT
psmith      2003/09/23 16:11:32

  Modified:    src/java/org/apache/log4j/chainsaw LoggerNameTreePanel.java
  Log:
  Fixed a couple of bugs in the Logger name tree panel.
  
  * Hidden loggers were not being displayed correctly in the tree
  * You shouldn't be able to hide a logger when you are currently
  focusing on a logger
  
  Revision  Changes    Path
  1.13      +29 -10    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LoggerNameTreePanel.java	17 Sep 2003 01:15:13 -0000	1.12
  +++ LoggerNameTreePanel.java	23 Sep 2003 23:11:32 -0000	1.13
  @@ -335,6 +335,7 @@
   
     private void toggleFocusOnState() {
       setFocusOnSelected(!isFocusOnSelected());
  +    hideAction.setEnabled(!isFocusOnSelected());
     }
   
     /**
  @@ -458,10 +459,12 @@
               (path != null) && (node != null) && (node.getParent() != null)
               && !hiddenSet.contains(logger));
             hideAction.setEnabled(
  -            (path != null) && (node != null) && (node.getParent() != null));
  +            (path != null) && (node != null) && (node.getParent() != null)
&& !isFocusOnSelected());
   
             if (!focusOnAction.isEnabled()) {
               setFocusOnSelected(false);
  +          }else{
  +              
             }
   
             expandAction.setEnabled(path != null);
  @@ -499,6 +502,18 @@
             fireChangeEvent();
           }
         });
  +      
  +      hideAction.addPropertyChangeListener(new PropertyChangeListener(){
  +
  +		public void propertyChange(PropertyChangeEvent evt) {
  +            if (logTree.getSelectionPath() != null) {
  +              logTreeModel.nodeChanged(
  +                (TreeNode) logTree.getSelectionPath().getLastPathComponent());
  +            }
  +
  +            fireChangeEvent();
  +			
  +		}});
   
       /**
        * Now add a MouseListener that fires the expansion
  @@ -815,22 +830,26 @@
   
         Font originalFont = component.getFont();
   
  +     int style = Font.PLAIN;
         if (sel && focusOnLoggerButton.isSelected()) {
  -        component.setFont(originalFont.deriveFont(Font.BOLD));
  -      } else {
  -        component.setFont(originalFont.deriveFont(Font.PLAIN));
  -      }
  +          style = style | Font.BOLD;
  +      } 
   
  -      originalFont = component.getFont();
   
  -      String logger =
  -        ((DefaultMutableTreeNode) value).getUserObject().toString();
  +      
  +      String logger = getLoggerName(new TreePath(((DefaultMutableTreeNode) value).getPath()));
   
         if (hiddenSet.contains(logger)) {
  -        component.setEnabled(false);
  +//        component.setEnabled(false);
  +//        component.setIcon(leaf?null:getDefaultOpenIcon());
  +        style = style | Font.ITALIC;
  +//        LogLog.debug("TreeRenderer: '" + logger + "' is in hiddenSet, italicizing");
         } else {
  -        component.setEnabled(true);
  +//          LogLog.debug("TreeRenderer: '" + logger + "' is NOT in hiddenSet, leaving plain");
  +//        component.setEnabled(true);
         }
  +      component.setFont(originalFont.deriveFont(style));
  +      
   
         return component;
       }
  
  
  

---------------------------------------------------------------------
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