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/icons ChainsawIcons.java
Date Sat, 13 Dec 2003 06:46:19 GMT
psmith      2003/12/12 22:46:19

  Modified:    src/java/org/apache/log4j/chainsaw LoggerNameTreePanel.java
               src/java/org/apache/log4j/chainsaw/icons ChainsawIcons.java
  Log:
  "improved" the Logger name mouse-based ignoring.  Not perfect, but getting better.
  
  Revision  Changes    Path
  1.18      +72 -22    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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- LoggerNameTreePanel.java	12 Dec 2003 21:44:58 -0000	1.17
  +++ LoggerNameTreePanel.java	13 Dec 2003 06:46:19 -0000	1.18
  @@ -126,8 +126,8 @@
     private final class MouseKeyIconListener
       extends MouseMotionAdapter
       implements MouseMotionListener {
  -    Cursor focusOnCursor = Toolkit.getDefaultToolkit().createCustomCursor(ChainsawIcons.FOCUS_ON_ICON.getImage(),
new Point(0,0), "");
  -    Cursor ignoreCursor = Toolkit.getDefaultToolkit().createCustomCursor(ChainsawIcons.IGNORE_ICON.getImage(),
new Point(0,0), "");
  +    Cursor focusOnCursor = Toolkit.getDefaultToolkit().createCustomCursor(ChainsawIcons.FOCUS_ON_ICON.getImage(),
new Point(10,10), "");
  +    Cursor ignoreCursor = Toolkit.getDefaultToolkit().createCustomCursor(ChainsawIcons.IGNORE_ICON.getImage(),
new Point(10,10), "");
         /* (non-Javadoc)
        * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
        */
  @@ -141,8 +141,57 @@
           logTree.setCursor(Cursor.getDefaultCursor());
         }
       }
  -
   }
  +  private final class MouseFocusOnListener extends MouseAdapter {
  +    
  +    /* (non-Javadoc)
  +     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
  +     */
  +    public void mouseClicked(MouseEvent e) {
  +      if(e.getClickCount()>1 && (e.getModifiers() & InputEvent.CTRL_MASK)>0
&& (e.getModifiers() & InputEvent.SHIFT_MASK)>0) {
  +        ignoreLoggerAtPoint(e.getPoint());
  +        e.consume();
  +        fireChangeEvent();
  +      }else if(e.getClickCount()>1 &&(e.getModifiers() & InputEvent.CTRL_MASK)>0)
{
  +        focusAnLoggerAtPoint(e.getPoint());
  +        e.consume();
  +        fireChangeEvent();
  +      }    
  +    }
  +
  +    /**
  +     * @param point
  +     */
  +    private void focusAnLoggerAtPoint(Point point) {
  +      String logger = getLoggerAtPoint(point);
  +      if(logger!=null) {
  +        toggleFocusOnState();
  +      }
  +    }
  +
  +    /**
  +     * @param point
  +     * @return
  +     */
  +    private String getLoggerAtPoint(Point point) {
  +      TreePath path = logTree.getPathForLocation(point.x, point.y);
  +      if(path!=null) {
  +        return getLoggerName(path);
  +      }
  +      return null;
  +    }
  +
  +    /**
  +     * @param point
  +     */
  +    private void ignoreLoggerAtPoint(Point point) {
  +      String logger = getLoggerAtPoint(point);
  +      if(logger!=null) {
  +        toggleHiddenLogger(logger);
  +      }
  +      
  +    }
  +  }
     private static final int WARN_DEPTH = 4;
     private final JTree logTree;
     private final JScrollPane scrollTree;
  @@ -592,26 +641,27 @@
           }
         });
   
  -    /**
  -     * Now add a MouseListener that fires the expansion
  -     * action if CTRL + DBL CLICK is done.
  -     */
  -    logTree.addMouseListener(
  -      new MouseAdapter() {
  -        public void mouseClicked(MouseEvent e) {
  -          if (
  -            (e.getClickCount() > 1)
  -              && ((e.getModifiers() & InputEvent.CTRL_MASK) > 0)
  -              && ((e.getModifiers() & InputEvent.BUTTON1_MASK) > 0)) {
  -            expandCurrentlySelectedNode();
  -            e.consume();
  -          } else if (e.getClickCount() > 1) {
  -            super.mouseClicked(e);
  -            LogLog.debug("Ignoring dbl click event " + e);
  -          }
  -        }
  -      });
  +//    /**
  +//     * Now add a MouseListener that fires the expansion
  +//     * action if CTRL + DBL CLICK is done.
  +//     */
  +//    logTree.addMouseListener(
  +//      new MouseAdapter() {
  +//        public void mouseClicked(MouseEvent e) {
  +//          if (
  +//            (e.getClickCount() > 1)
  +//              && ((e.getModifiers() & InputEvent.CTRL_MASK) > 0)
  +//              && ((e.getModifiers() & InputEvent.BUTTON1_MASK) > 0)) {
  +//            expandCurrentlySelectedNode();
  +//            e.consume();
  +//          } else if (e.getClickCount() > 1) {
  +//            super.mouseClicked(e);
  +//            LogLog.debug("Ignoring dbl click event " + e);
  +//          }
  +//        }
  +//      });
   
  +    logTree.addMouseListener(new MouseFocusOnListener());
       /**
        * We listen for when the FocusOn action changes, and then  translate
        * that to a RuleChange
  
  
  
  1.9       +4 -2      jakarta-log4j/src/java/org/apache/log4j/chainsaw/icons/ChainsawIcons.java
  
  Index: ChainsawIcons.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/icons/ChainsawIcons.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ChainsawIcons.java	12 Dec 2003 21:40:36 -0000	1.8
  +++ ChainsawIcons.java	13 Dec 2003 06:46:19 -0000	1.9
  @@ -174,8 +174,10 @@
       ChainsawIcons.class.getClassLoader().getResource(
         BASE_ICON_PATH + "ZoomOut16.gif");
   
  -  public static final ImageIcon FOCUS_ON_ICON = new ImageIcon(WINDOW_ICON);
  -  public static final ImageIcon IGNORE_ICON = new ImageIcon(ICON_COLLAPSE);  
  +  public static final ImageIcon FOCUS_ON_ICON = new ImageIcon(ChainsawIcons.class.getClassLoader().getResource(
  +      BASE_ICON_PATH + "ZoomIn24.gif"));
  +  public static final ImageIcon IGNORE_ICON = new ImageIcon(ChainsawIcons.class.getClassLoader().getResource(
  +      BASE_ICON_PATH + "ZoomOut24.gif"));  
     
     private ChainsawIcons() {
     }
  
  
  

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