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 ChainsawToolBarAndMenus.java
Date Mon, 05 May 2003 11:37:50 GMT
psmith      2003/05/05 04:37:50

  Modified:    src/java/org/apache/log4j/chainsaw
                        ChainsawToolBarAndMenus.java
  Log:
  adjusted Show Details action.  Working lots nicer, but still not 100%.
  
  Revision  Changes    Path
  1.6       +366 -329  jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
  
  Index: ChainsawToolBarAndMenus.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChainsawToolBarAndMenus.java	5 May 2003 07:59:58 -0000	1.5
  +++ ChainsawToolBarAndMenus.java	5 May 2003 11:37:49 -0000	1.6
  @@ -39,334 +39,371 @@
    */
   class ChainsawToolBarAndMenus implements ChangeListener {
   
  -  ChainsawToolBarAndMenus(final LogUI logui) {
  -    this.logui = logui;
  -    toolbar = new JToolBar(JToolBar.HORIZONTAL);
  -    menuBar = new JMenuBar();
  -    fileMenu = new FileMenu(logui);
  -
  -    lockToolbarAction = createLockableToolbarAction();
  -    toggleToolbarAction = createToggleToolbarAction();
  -    pauseAction = createPauseAction();
  -    clearAction = createClearAction();
  -    toggleDetailPaneAction = createToggleDetailPaneAction();
  -
  -    createMenuBar();
  -    createToolbar();
  -  }
  -
  -  JToolBar getToolbar() {
  -    return toolbar;
  -  }
  -
  -  JMenuBar getMenubar() {
  -    return menuBar;
  -  }
  -
  -//  Action getToggleDetailPaneAction() {
  -//    return toggleDetailPaneAction;
  -//  }
  -  
  -  public void stateChanged(ChangeEvent e) {
  -    scanState();
  -  }
  -
  -  private void scanState() {
  -    /**
  -     * We get the currently selected LogPanel, and if null, deactivate some
  -     * actions
  -     */
  -    LogUI.LogPanel logPanel = logui.getCurrentLogPanel();
  -
  -    if (logPanel == null) {
  -      pauseAction.setEnabled(false);
  -      clearAction.setEnabled(false);
  -      fileMenu.getFileSaveAction().setEnabled(false);
  -    } else {
  -      //       System.out.println("LogPanel is now " + logPanel.getIdentifier());
  -      fileMenu.getFileSaveAction().setEnabled(true);
  -      pauseAction.setEnabled(true);
  -      clearAction.setEnabled(true);
  -      if (logui.pausedList.contains(logPanel.getIdentifier())) {
  -        pauseButton.getModel().setSelected(true);
  -      } else {
  -        pauseButton.getModel().setSelected(false);
  -      }
  -
  -    }
  -
  -  }
  -
  -  private Action createToggleToolbarAction() {
  -    /**
  -     * -== Begin of Show/Hide toolbar action
  -     */
  -    final Action toggleToolbarAction = new AbstractAction("Show Toolbar") {
  -      private boolean hide = false;
  -      public void actionPerformed(ActionEvent e) {
  -        hide = !hide;
  -        Runnable runnable = null;
  -        if (hide) {
  -          runnable = new Runnable() {
  -            public void run() {
  -              logui.getContentPane().remove(toolbar);
  -              logui.getRootPane().repaint();
  -              logui.getRootPane().revalidate();
  -            }
  -          };
  -        } else {
  -          runnable = new Runnable() {
  -            public void run() {
  -              logui.getContentPane().add(toolbar, BorderLayout.NORTH);
  -              logui.getRootPane().repaint();
  -              logui.getRootPane().revalidate();
  -            }
  -          };
  -        }
  -        SwingUtilities.invokeLater(runnable);
  -      }
  -    };
  -    toggleToolbarAction.putValue(
  -      Action.ACCELERATOR_KEY,
  -      KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.ALT_MASK));
  -
  -    return toggleToolbarAction;
  -  }
  -
  -  private Action createLockableToolbarAction() {
  -    final Action lockToolbarAction = new AbstractAction("Lock Toolbar") {
  -      private boolean lock = true;
  -      public void actionPerformed(ActionEvent e) {
  -        lock = !lock;
  -        final boolean isLocked = lock;
  -        Runnable runnable = null;
  -        runnable = new Runnable() {
  -          public void run() {
  -            toolbar.setFloatable(!isLocked);
  -            toolbar.repaint();
  -          }
  -        };
  -        SwingUtilities.invokeLater(runnable);
  -      }
  -    };
  -    return lockToolbarAction;
  -  }
  -
  -  private Action createPauseAction() {
  -    final Action pauseAction = new AbstractAction("Pause") {
  -
  -      public void actionPerformed(ActionEvent evt) {
  -
  -        LogUI.LogPanel logPanel = logui.getCurrentLogPanel();
  -        if (logPanel == null)
  -          return;
  -        String ident = logPanel.getIdentifier();
  -        System.out.println("trying to pause '" + ident + "'");
  -        if (!logui.pausedList.contains(ident)) {
  -          logui.pausedList.add(ident);
  -        } else {
  -          logui.pausedList.remove(ident);
  -        }
  -      }
  -    };
  -    pauseAction.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P));
  -    pauseAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("F12"));
  -    pauseAction.putValue(
  -      Action.SHORT_DESCRIPTION,
  -      "Halts the display, while still allowing events to stream in the background");
  -    pauseAction.putValue(Action.SMALL_ICON, new ImageIcon(ChainsawIcons.PAUSE));
  -
  -    return pauseAction;
  -
  -  }
  -
  -  private Action createToggleDetailPaneAction() {
  -    Action action =
  -      new AbstractAction("Toggle Detail Pane") {
  -      boolean enabled = true;
  -      public void actionPerformed(ActionEvent evt) {
  -        LogUI.LogPanel logPanel = logui.getCurrentLogPanel();
  -        if(logPanel == null ) return;
  -        logPanel.toggleDetailPanel();
  -      }
  -    };
  -    action.putValue("enabled", Boolean.TRUE);
  -    action.putValue(
  -      Action.ACCELERATOR_KEY,
  -      KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK));
  -    action.putValue(
  -      Action.SHORT_DESCRIPTION,
  -      "Hides/Shows the Detail Pane");  
  -    return action;
  -  }
  -  
  -  private Action createClearAction() {
  -    final Action action = new AbstractAction("Clear") {
  -
  -      public void actionPerformed(ActionEvent e) {
  -        LogUI.LogPanel logPanel = logui.getCurrentLogPanel();
  -        if (logPanel == null)
  -          return;
  -        String ident = logPanel.getIdentifier();
  -        logPanel.clearModel();
  -      }
  -
  -    };
  -    action.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P));
  -    action.putValue(
  -      Action.ACCELERATOR_KEY,
  -      KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, InputEvent.CTRL_MASK));
  -    action.putValue(
  -      Action.SHORT_DESCRIPTION,
  -      "Removes all the events from the current view");
  -    action.putValue(Action.SMALL_ICON, new ImageIcon(ChainsawIcons.DELETE));
  -
  -    return action;
  -  }
  -
  -  private void createToolbar() {
  -
  -    Insets buttonMargins = new Insets(1, 1, 1, 1);
  -
  -    FileMenu fileMenu = (FileMenu) menuBar.getMenu(0);
  -
  -    JButton fileOpenButton = new JButton(fileMenu.getFileOpenAction());
  -    fileOpenButton.setMargin(buttonMargins);
  -
  -    JButton fileSaveButton = new JButton(fileMenu.getFileSaveAction());
  -    fileSaveButton.setMargin(buttonMargins);
  -
  -    fileOpenButton.setText("");
  -    fileSaveButton.setText("");
  -
  -    toolbar.add(fileOpenButton);
  -    toolbar.add(fileSaveButton);
  -    toolbar.addSeparator();
  -
  -    pauseButton.setAction(pauseAction);
  -    pauseButton.setText("");
  -
  -    //		pauseButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F12"),pauseAction.getValue(Action.NAME)
);
  -    pauseButton.getActionMap().put(
  -      pauseAction.getValue(Action.NAME),
  -      pauseAction);
  -
  -    clearButton.setAction(clearAction);
  -    clearButton.setText("");
  -    
  -    resizeToolbarButton(clearButton);
  -    resizeToolbarButton(pauseButton);
  -
  -    toolbar.add(pauseButton);
  -    toolbar.add(clearButton);
  -
  -    toolbar.setMargin(buttonMargins);
  -    toolbar.setFloatable(false);
  -  }
  -
  -  private void resizeToolbarButton(JComponent button) {
  -    Dimension d = new Dimension(24, 24);
  -    button.setPreferredSize(d);
  -    button.setMaximumSize(d);
  -  }
  -
  -  private void createMenuBar() {
  -    JMenu viewMenu = new JMenu("View");
  -    JMenu activeTabMenu = new JMenu("Current tab");
  -
  -    JMenuItem menuItemUseRightMouse =
  -      new JMenuItem("Other options available via panel's right mouse button popup menu");
  -    menuItemUseRightMouse.setEnabled(false);
  -    activeTabMenu.add(menuItemUseRightMouse);
  -
  -    viewMenu.setMnemonic('V');
  -
  -    JCheckBoxMenuItem lockToolbarCheck =
  -      new JCheckBoxMenuItem(lockToolbarAction);
  -    lockToolbarCheck.setSelected(true);
  -
  -    JCheckBoxMenuItem showToolbarCheck =
  -      new JCheckBoxMenuItem(toggleToolbarAction);
  -    showToolbarCheck.setSelected(true);
  -
  -    JCheckBoxMenuItem pause = new JCheckBoxMenuItem(pauseAction);
  -
  -    viewMenu.add(showToolbarCheck);
  -    viewMenu.add(lockToolbarCheck);
  -    viewMenu.addSeparator();
  -    viewMenu.add(pause);
  -    
  -    viewMenu.add(new JMenuItem(clearAction));
  -    viewMenu.add(new JMenuItem(toggleDetailPaneAction));
  -
  -    menuBar.add(fileMenu);
  -    menuBar.add(viewMenu);
  -    menuBar.add(activeTabMenu);
  -  }
  -
  -  JToolBar createDockwindowToolbar(final JFrame dockablePanel) {
  -    final JToolBar toolbar = new JToolBar();
  -    toolbar.setFloatable(false);
  -    final String ident = dockablePanel.getTitle();
  -    final Action dockPauseAction = new AbstractAction("Pause") {
  -
  -      public void actionPerformed(ActionEvent evt) {
  -
  -        System.out.println("trying to pause '" + ident + "'");
  -        if (!logui.pausedList.contains(ident)) {
  -          logui.pausedList.add(ident);
  -        } else {
  -          logui.pausedList.remove(ident);
  -        }
  -      }
  -    };
  -    dockPauseAction.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P));
  -    dockPauseAction.putValue(
  -      Action.ACCELERATOR_KEY,
  -      KeyStroke.getKeyStroke("F12"));
  -    dockPauseAction.putValue(
  -      Action.SHORT_DESCRIPTION,
  -      "Halts the display, while still allowing events to stream in the background");
  -    dockPauseAction.putValue(
  -      Action.SMALL_ICON,
  -      new ImageIcon(ChainsawIcons.PAUSE));
  -
  -    final JToggleButton dockPauseButton = new JToggleButton(dockPauseAction);
  -    dockPauseButton.setText("");
  -    if (logui.pausedList.contains(ident)) {
  -      dockPauseButton.getModel().setSelected(true);
  -    } else {
  -      dockPauseButton.getModel().setSelected(false);
  -    }
  -
  -    dockPauseButton.setText("");
  -
  -    resizeToolbarButton(dockPauseButton);
  -    toolbar.add(dockPauseButton);
  -
  -    final JToggleButton dockClearButton = new JToggleButton(clearAction);
  -    dockClearButton.setText("");
  -    resizeToolbarButton(dockClearButton);
  -    toolbar.add(dockClearButton);
  -
  -    return toolbar;
  -  }
  -
  -  private LogUI logui;
  -  private final JToolBar toolbar;
  -  private final JMenuBar menuBar;
  -
  -  private final Action lockToolbarAction;
  -  private final Action toggleToolbarAction;
  -
  -  private final Action pauseAction;
  -  private final Action clearAction;
  -  private final Action toggleDetailPaneAction;
  -
  -  private final FileMenu fileMenu;
  -
  -  private final JToggleButton pauseButton = new JToggleButton();
  -  private final JToggleButton detailPaneButton = new JToggleButton();
  -  private final JButton clearButton = new JButton();
  +	ChainsawToolBarAndMenus(final LogUI logui) {
  +		this.logui = logui;
  +		toolbar = new JToolBar(JToolBar.HORIZONTAL);
  +		menuBar = new JMenuBar();
  +		fileMenu = new FileMenu(logui);
  +
  +		lockToolbarAction = createLockableToolbarAction();
  +		toggleToolbarAction = createToggleToolbarAction();
  +		pauseAction = createPauseAction();
  +		clearAction = createClearAction();
  +		toggleDetailPaneAction = createToggleDetailPaneAction();
  +
  +		createMenuBar();
  +		createToolbar();
  +	}
  +
  +	JToolBar getToolbar() {
  +		return toolbar;
  +	}
  +
  +	JMenuBar getMenubar() {
  +		return menuBar;
  +	}
  +
  +	public void stateChanged(ChangeEvent e) {
  +		scanState();
  +	}
  +
  +	private void scanState() {
  +		/**
  +		 * We get the currently selected LogPanel, and if null, deactivate some
  +		 * actions
  +		 */
  +		LogUI.LogPanel logPanel = logui.getCurrentLogPanel();
  +
  +		if (logPanel == null) {
  +			pauseAction.setEnabled(false);
  +			clearAction.setEnabled(false);
  +			fileMenu.getFileSaveAction().setEnabled(false);
  +			toggleDetailPaneAction.setEnabled(false);
  +		} else {
  +			//       System.out.println("LogPanel is now " + logPanel.getIdentifier());
  +			fileMenu.getFileSaveAction().setEnabled(true);
  +			pauseAction.setEnabled(true);
  +			clearAction.setEnabled(true);
  +			toggleDetailPaneAction.setEnabled(true);
  +			if (logui.pausedList.contains(logPanel.getIdentifier())) {
  +				pauseButton.getModel().setSelected(true);
  +			} else {
  +				pauseButton.getModel().setSelected(false);
  +			}
  +			if (logPanel.isDetailPaneVisible()) {
  +				detailPaneButton.getModel().setSelected(true);
  +			} else {
  +				detailPaneButton.getModel().setSelected(false);
  +
  +			}
  +
  +		}
  +
  +	}
  +
  +	private Action createToggleToolbarAction() {
  +		/**
  +		 * -== Begin of Show/Hide toolbar action
  +		 */
  +		final Action toggleToolbarAction = new AbstractAction("Show Toolbar") {
  +			private boolean hide = false;
  +			public void actionPerformed(ActionEvent e) {
  +				hide = !hide;
  +				Runnable runnable = null;
  +				if (hide) {
  +					runnable = new Runnable() {
  +						public void run() {
  +							logui.getContentPane().remove(toolbar);
  +							logui.getRootPane().repaint();
  +							logui.getRootPane().revalidate();
  +						}
  +					};
  +				} else {
  +					runnable = new Runnable() {
  +						public void run() {
  +							logui.getContentPane().add(
  +								toolbar,
  +								BorderLayout.NORTH);
  +							logui.getRootPane().repaint();
  +							logui.getRootPane().revalidate();
  +						}
  +					};
  +				}
  +				SwingUtilities.invokeLater(runnable);
  +			}
  +		};
  +		toggleToolbarAction.putValue(
  +			Action.ACCELERATOR_KEY,
  +			KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.ALT_MASK));
  +
  +		return toggleToolbarAction;
  +	}
  +
  +	private Action createLockableToolbarAction() {
  +		final Action lockToolbarAction = new AbstractAction("Lock Toolbar") {
  +			private boolean lock = true;
  +			public void actionPerformed(ActionEvent e) {
  +				lock = !lock;
  +				final boolean isLocked = lock;
  +				Runnable runnable = null;
  +				runnable = new Runnable() {
  +					public void run() {
  +						toolbar.setFloatable(!isLocked);
  +						toolbar.repaint();
  +					}
  +				};
  +				SwingUtilities.invokeLater(runnable);
  +			}
  +		};
  +		return lockToolbarAction;
  +	}
  +
  +	private Action createPauseAction() {
  +		final Action pauseAction = new AbstractAction("Pause") {
  +
  +			public void actionPerformed(ActionEvent evt) {
  +
  +				LogUI.LogPanel logPanel = logui.getCurrentLogPanel();
  +				if (logPanel == null)
  +					return;
  +				String ident = logPanel.getIdentifier();
  +				System.out.println("trying to pause '" + ident + "'");
  +				if (!logui.pausedList.contains(ident)) {
  +					logui.pausedList.add(ident);
  +				} else {
  +					logui.pausedList.remove(ident);
  +				}
  +			}
  +		};
  +		pauseAction.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P));
  +		pauseAction.putValue(
  +			Action.ACCELERATOR_KEY,
  +			KeyStroke.getKeyStroke("F12"));
  +		pauseAction.putValue(
  +			Action.SHORT_DESCRIPTION,
  +			"Halts the display, while still allowing events to stream in the background");
  +		pauseAction.putValue(
  +			Action.SMALL_ICON,
  +			new ImageIcon(ChainsawIcons.PAUSE));
  +
  +		return pauseAction;
  +
  +	}
  +
  +	private Action createToggleDetailPaneAction() {
  +		Action action = new AbstractAction("Toggle Detail Pane") {
  +			boolean enabled = true;
  +			public void actionPerformed(ActionEvent evt) {
  +				LogUI.LogPanel logPanel = logui.getCurrentLogPanel();
  +				if (logPanel == null)
  +					return;
  +				logPanel.toggleDetailPanel();
  +				scanState();
  +			}
  +		};
  +		action.putValue("enabled", Boolean.TRUE);
  +		action.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_D));
  +		action.putValue(
  +			Action.ACCELERATOR_KEY,
  +			KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK));
  +		action.putValue(
  +			Action.SHORT_DESCRIPTION,
  +			"Hides/Shows the Detail Pane");
  +		action.putValue(Action.SMALL_ICON, new ImageIcon(ChainsawIcons.INFO));
  +		return action;
  +	}
  +
  +	private Action createClearAction() {
  +		final Action action = new AbstractAction("Clear") {
  +
  +			public void actionPerformed(ActionEvent e) {
  +				LogUI.LogPanel logPanel = logui.getCurrentLogPanel();
  +				if (logPanel == null)
  +					return;
  +				logPanel.clearModel();
  +			}
  +
  +		};
  +		action.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P));
  +		action.putValue(
  +			Action.ACCELERATOR_KEY,
  +			KeyStroke.getKeyStroke(
  +				KeyEvent.VK_BACK_SPACE,
  +				InputEvent.CTRL_MASK));
  +		action.putValue(
  +			Action.SHORT_DESCRIPTION,
  +			"Removes all the events from the current view");
  +		action.putValue(Action.SMALL_ICON, new ImageIcon(ChainsawIcons.DELETE));
  +
  +		return action;
  +	}
  +
  +	private void createToolbar() {
  +
  +		Insets buttonMargins = new Insets(1, 1, 1, 1);
  +
  +		FileMenu fileMenu = (FileMenu) menuBar.getMenu(0);
  +
  +		JButton fileOpenButton = new JButton(fileMenu.getFileOpenAction());
  +		fileOpenButton.setMargin(buttonMargins);
  +
  +		JButton fileSaveButton = new JButton(fileMenu.getFileSaveAction());
  +		fileSaveButton.setMargin(buttonMargins);
  +
  +		fileOpenButton.setText("");
  +		fileSaveButton.setText("");
  +
  +		toolbar.add(fileOpenButton);
  +		toolbar.add(fileSaveButton);
  +		toolbar.addSeparator();
  +
  +		pauseButton.setAction(pauseAction);
  +		pauseButton.setText("");
  +
  +		//		pauseButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F12"),pauseAction.getValue(Action.NAME)
);
  +		pauseButton.getActionMap().put(
  +			pauseAction.getValue(Action.NAME),
  +			pauseAction);
  +
  +		clearButton.setAction(clearAction);
  +		clearButton.setText("");
  +
  +		detailPaneButton.setAction(toggleDetailPaneAction);
  +		detailPaneButton.setText("");
  +		detailPaneButton.getActionMap().put(
  +			toggleDetailPaneAction.getValue(Action.NAME),
  +			toggleDetailPaneAction);
  +		detailPaneButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
  +			KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK),
  +			toggleDetailPaneAction.getValue(Action.NAME));
  +
  +		resizeToolbarButton(clearButton);
  +		resizeToolbarButton(pauseButton);
  +		resizeToolbarButton(detailPaneButton);
  +
  +		toolbar.add(pauseButton);
  +		toolbar.add(clearButton);
  +		toolbar.add(detailPaneButton);
  +
  +		toolbar.setMargin(buttonMargins);
  +		toolbar.setFloatable(false);
  +	}
  +
  +	private void resizeToolbarButton(JComponent button) {
  +		Dimension d = new Dimension(24, 24);
  +		button.setPreferredSize(d);
  +		button.setMaximumSize(d);
  +	}
  +
  +	private void createMenuBar() {
  +		JMenu viewMenu = new JMenu("View");
  +		JMenu activeTabMenu = new JMenu("Current tab");
  +
  +		JMenuItem menuItemUseRightMouse =
  +			new JMenuItem("Other options available via panel's right mouse button popup menu");
  +		menuItemUseRightMouse.setEnabled(false);
  +		activeTabMenu.add(menuItemUseRightMouse);
  +
  +		viewMenu.setMnemonic('V');
  +
  +		JCheckBoxMenuItem lockToolbarCheck =
  +			new JCheckBoxMenuItem(lockToolbarAction);
  +		lockToolbarCheck.setSelected(true);
  +
  +		JMenu toolbarMenu = new JMenu("Toolbar");
  +		
  +		JCheckBoxMenuItem showToolbarCheck =
  +			new JCheckBoxMenuItem(toggleToolbarAction);
  +		showToolbarCheck.setSelected(true);
  +		
  +		toolbarMenu.add(showToolbarCheck);
  +		toolbarMenu.add(lockToolbarCheck);
  +		
  +		JCheckBoxMenuItem pause = new JCheckBoxMenuItem(pauseAction);
  +
  +		
  +		
  +		
  +		viewMenu.add(pause);
  +		viewMenu.add(new JMenuItem(clearAction));
  +		JCheckBoxMenuItem toggleDetailMenuItem = new JCheckBoxMenuItem(toggleDetailPaneAction);
  +		toggleDetailMenuItem.setSelected(true);
  +		
  +		viewMenu.add(toggleDetailMenuItem);
  +		viewMenu.addSeparator();
  +		viewMenu.add(toolbarMenu);
  +
  +		menuBar.add(fileMenu);
  +		menuBar.add(viewMenu);
  +		menuBar.add(activeTabMenu);
  +	}
  +
  +	JToolBar createDockwindowToolbar(final JFrame dockablePanel) {
  +		final JToolBar toolbar = new JToolBar();
  +		toolbar.setFloatable(false);
  +		final String ident = dockablePanel.getTitle();
  +		final Action dockPauseAction = new AbstractAction("Pause") {
  +
  +			public void actionPerformed(ActionEvent evt) {
  +
  +				System.out.println("trying to pause '" + ident + "'");
  +				if (!logui.pausedList.contains(ident)) {
  +					logui.pausedList.add(ident);
  +				} else {
  +					logui.pausedList.remove(ident);
  +				}
  +			}
  +		};
  +		dockPauseAction.putValue(
  +			Action.MNEMONIC_KEY,
  +			new Integer(KeyEvent.VK_P));
  +		dockPauseAction.putValue(
  +			Action.ACCELERATOR_KEY,
  +			KeyStroke.getKeyStroke("F12"));
  +		dockPauseAction.putValue(
  +			Action.SHORT_DESCRIPTION,
  +			"Halts the display, while still allowing events to stream in the background");
  +		dockPauseAction.putValue(
  +			Action.SMALL_ICON,
  +			new ImageIcon(ChainsawIcons.PAUSE));
  +
  +		final JToggleButton dockPauseButton =
  +			new JToggleButton(dockPauseAction);
  +		dockPauseButton.setText("");
  +		if (logui.pausedList.contains(ident)) {
  +			dockPauseButton.getModel().setSelected(true);
  +		} else {
  +			dockPauseButton.getModel().setSelected(false);
  +		}
  +
  +		dockPauseButton.setText("");
  +
  +		resizeToolbarButton(dockPauseButton);
  +		toolbar.add(dockPauseButton);
  +
  +		final JToggleButton dockClearButton = new JToggleButton(clearAction);
  +		dockClearButton.setText("");
  +		resizeToolbarButton(dockClearButton);
  +		toolbar.add(dockClearButton);
  +
  +		return toolbar;
  +	}
  +
  +	private LogUI logui;
  +	private final JToolBar toolbar;
  +	private final JMenuBar menuBar;
  +
  +	private final Action lockToolbarAction;
  +	private final Action toggleToolbarAction;
  +
  +	private final Action pauseAction;
  +	private final Action clearAction;
  +	private final Action toggleDetailPaneAction;
  +
  +	private final FileMenu fileMenu;
  +
  +	private final JToggleButton pauseButton = new JToggleButton();
  +	private final JToggleButton detailPaneButton = new JToggleButton();
  +	private final JButton clearButton = new JButton();
   
   }
  
  
  

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