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-sandbox/src/java/org/apache/log4j/chainsaw FileLoadAction.java LogUI.java
Date Wed, 30 Apr 2003 04:20:59 GMT
psmith      2003/04/29 21:20:59

  Modified:    src/java/org/apache/log4j/chainsaw LogUI.java
  Added:       src/java/org/apache/log4j/chainsaw FileLoadAction.java
  Log:
  The very beginnings of returning XML file loading into Chainsaw2, 
  encapsulated as an external Action class file. Still a fair bit to go yet.
  
  Revision  Changes    Path
  1.3       +33 -17    jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LogUI.java	29 Apr 2003 16:21:29 -0000	1.2
  +++ LogUI.java	30 Apr 2003 04:20:59 -0000	1.3
  @@ -124,6 +124,7 @@
    * mechanism.
    *
    * @author Scott Deboy <sdeboy@apache.org>
  + * @author Paul Smith <psmithapache.org>
    *
    */
   public class LogUI extends JFrame implements ChainsawViewer {
  @@ -183,25 +184,40 @@
       super("Log Viewer");
   
       JMenuBar menuBar = new JMenuBar();
  +    
  +    menuBar.add(buildFileMenu());
       JMenu activeTabMenu = new JMenu("Current tab");
       JMenuItem menuItemClose = new JMenuItem("Close Welcome tab");
  -    JMenuItem menuItemUseRightMouse=new JMenuItem("Other options available via panel's
right mouse button popup menu");
  -    menuItemUseRightMouse.setEnabled(false);
  -    menuItemClose.addActionListener(
  -      new AbstractAction() {
  -        public void actionPerformed(ActionEvent e) {
  -          JPanel somepanel = (JPanel) tabbedPane.getSelectedComponent();
  -
  -          if (!(somepanel instanceof LogPanel)) {
  -            tabbedPane.remove(somepanel);
  -          }
  -        }
  -      });
  -
  -    activeTabMenu.add(menuItemClose);
  -    activeTabMenu.add(menuItemUseRightMouse);
  -    menuBar.add(activeTabMenu);
  -    setJMenuBar(menuBar);
  +	JMenuItem menuItemUseRightMouse=new JMenuItem("Other options available via panel's right
mouse button popup menu");
  +	menuItemUseRightMouse.setEnabled(false);
  +	menuItemClose.addActionListener(
  +   new AbstractAction() {
  +    public void actionPerformed(ActionEvent e) {
  +      JPanel somepanel = (JPanel) tabbedPane.getSelectedComponent();
  +
  +      if (!(somepanel instanceof LogPanel)) {
  +        tabbedPane.remove(somepanel);
  +      }
  +    }
  +  });
  +
  +activeTabMenu.add(menuItemClose);
  +activeTabMenu.add(menuItemUseRightMouse);
  +menuBar.add(activeTabMenu);
  +setJMenuBar(menuBar);
  +  }
  +
  +  /**
  +   * Adds the File menu with it's contents
  +   * @return
  +   */
  +  private JMenu buildFileMenu() {
  +    JMenu fileMenu = new JMenu("File");
  +    fileMenu.setMnemonic('F');
  +    
  +    JMenuItem loadFile = new JMenuItem(new FileLoadAction());
  +    fileMenu.add(loadFile);   
  +    return fileMenu;
     }
   
     /**
  
  
  
  1.1                  jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/FileLoadAction.java
  
  Index: FileLoadAction.java
  ===================================================================
  /*
   * @author Paul Smith <psmith@apache.org>
   *
  */
  package org.apache.log4j.chainsaw;
  
  import java.awt.event.ActionEvent;
  import java.awt.event.KeyEvent;
  
  import javax.swing.AbstractAction;
  import javax.swing.Action;
  import javax.swing.Icon;
  
  /**
   * Allows the user to specify a particular file to open
   * and import the events into a new tab.
   * 
   * @author Paul Smith <psmith@apache.org>
   *
   */
  class FileLoadAction extends AbstractAction {
  
    /**
     * 
     */
    public FileLoadAction() {
      super("Load");
      putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_L));
      putValue(Action.SHORT_DESCRIPTION, "Loads an XML event file");
    }
  
    /* (non-Javadoc)
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    public void actionPerformed(ActionEvent e) {
      
      System.out.println("Load action");
  
    }
  
  }
  
  
  

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