psmith      2004/05/24 15:25:30

  Modified:    src/java/org/apache/log4j/chainsaw/version
                        VersionManager.java
               src/java/org/apache/log4j/chainsaw/receivers
                        ReceiversTreeModel.java ReceiversPanel.java
               src/java/org/apache/log4j/chainsaw/icons ChainsawIcons.java
               src/java/org/apache/log4j/chainsaw/help release-notes.html
  Log:
  Fixed bug where any Receiver started during initialisation would
  double up visually when restarted.  Thanks to Stephen Pain for spotting
  this.
  
  Added a "restart" action to restart an individual receiver, which saves having
  to restart all receivers.
  
  Tweaked the order of the receiver toolbar actions, and removed 2
  less commonly used buttons, but leaving them within the receiver
  popup menu.
  
  Revision  Changes    Path
  1.4       +1 -1      
logging-log4j/src/java/org/apache/log4j/chainsaw/version/VersionManager.java
  
  Index: VersionManager.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/version/VersionManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- VersionManager.java       18 May 2004 00:39:55 -0000      1.3
  +++ VersionManager.java       24 May 2004 22:25:30 -0000      1.4
  @@ -10,7 +10,7 @@
   
       private static final VersionManager instance = new VersionManager();
       
  -    private static final String VERSION_INFO = "1.99.99 (18th May 2004 10:35 
GMT+10)";
  +    private static final String VERSION_INFO = "1.99.99 (25th May 2004 08:00 
GMT+10)";
       
       public static final VersionManager getInstance() {
           return instance;
  
  
  
  1.6       +20 -6     
logging-log4j/src/java/org/apache/log4j/chainsaw/receivers/ReceiversTreeModel.java
  
  Index: ReceiversTreeModel.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/receivers/ReceiversTreeModel.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ReceiversTreeModel.java   9 May 2004 18:37:57 -0000       1.5
  +++ ReceiversTreeModel.java   24 May 2004 22:25:30 -0000      1.6
  @@ -19,9 +19,8 @@
   import java.beans.PropertyChangeEvent;
   import java.beans.PropertyChangeListener;
   import java.util.Collection;
  -import java.util.HashMap;
  +import java.util.Enumeration;
   import java.util.Iterator;
  -import java.util.Map;
   
   import javax.swing.tree.DefaultMutableTreeNode;
   import javax.swing.tree.DefaultTreeModel;
  @@ -48,7 +47,6 @@
     final DefaultMutableTreeNode NoReceiversNode =
       new DefaultMutableTreeNode("No Receivers defined");
     final DefaultMutableTreeNode RootNode;
  -  private Map pluginNodeMap = new HashMap();
   
     ReceiversTreeModel() {
       super(new DefaultMutableTreeNode(ROOTNODE_LABEL));
  @@ -139,13 +137,30 @@
         
receiver.addPropertyChangeListener(creatPluginPropertyChangeListener(receiver, 
newNode));
         nodesWereInserted(
           getRootNode(), new int[] { getRootNode().getIndex(newNode) });
  -      pluginNodeMap.put(receiver, newNode);
       }
     }
   
        TreeNode resolvePluginNode(Plugin p){
  -             return (TreeNode) pluginNodeMap.get(p);
  +             /**
  +              * Lets walk the tree, top-down until we find the node with the plugin
  +              * attached.
  +              * 
  +              * Since the tree hierachy is quite flat, this is should not 
  +              * be a performance issue at all, but if it is,
  +              * then "I have no recollection of that Senator".
  +              */
  +             TreeNode treeNode = null;
  +             Enumeration e = getRootNode().breadthFirstEnumeration();
  +             while(e.hasMoreElements()){
  +                     DefaultMutableTreeNode node = (DefaultMutableTreeNode) 
e.nextElement();
  +                     if(node.getUserObject().equals(p)){
  +                             treeNode = node;
  +                             break;
  +                     }
  +             }
  +             return treeNode;
        }
  +     
     /* (non-Javadoc)
      * @see 
org.apache.log4j.plugins.PluginListener#pluginStopped(org.apache.log4j.plugins.PluginEvent)
      */
  @@ -159,7 +174,6 @@
               getRootNode().remove(node);
               nodesWereRemoved(
                   getRootNode(), new int[] { index }, new Object[] { node });
  -            pluginNodeMap.remove(receiver);
           }
   
         if (getRootNode().getChildCount() == 0) {
  
  
  
  1.16      +37 -20    
logging-log4j/src/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
  
  Index: ReceiversPanel.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ReceiversPanel.java       12 May 2004 15:39:04 -0000      1.15
  +++ ReceiversPanel.java       24 May 2004 22:25:30 -0000      1.16
  @@ -88,6 +88,7 @@
     final Action pauseReceiverButtonAction;
     final Action playReceiverButtonAction;
     final Action shutdownReceiverButtonAction;
  +  final Action restartReceiverButtonAction;
     private final Action showReceiverHelpAction;
     private final Action startAllAction;
     private final JPopupMenu popupMenu = new ReceiverPopupMenu();
  @@ -107,12 +108,6 @@
       pluginRegistry = LogManager.getLoggerRepository().getPluginRegistry();
       final ReceiversTreeModel model = new ReceiversTreeModel();
       
  -    /**
  -     * TODO Ccurrently the model will not have a correctly populated
  -     * internal plugin map, because some plugins will already have started, so
  -     * when you stop a plugin, it DOES stop, but the Tree seems to keep displaying
  -     * it because it can't find the TreeNode for it within it's internal map.
  -     */
       pluginRegistry.addPluginListener(model);
       receiversTree.setModel(model);
   
  @@ -251,6 +246,29 @@
         Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_S));
   
       shutdownReceiverButtonAction.setEnabled(false);
  +    restartReceiverButtonAction =
  +        new AbstractAction() {
  +            public void actionPerformed(ActionEvent e) {
  +              Receiver selectedReceiver = getCurrentlySelectedReceiver();
  +              if(selectedReceiver == null){
  +                     return;
  +              }
  +              selectedReceiver.shutdown();
  +              selectedReceiver.activateOptions();
  +            }
  +          };
  +
  +      restartReceiverButtonAction.putValue(
  +        Action.SHORT_DESCRIPTION,
  +        "Restarts the selected Receiver");
  +      restartReceiverButtonAction.putValue(Action.NAME, "Restart");
  +
  +      restartReceiverButtonAction.putValue(
  +        Action.SMALL_ICON, new ImageIcon(ChainsawIcons.ICON_RESTART));
  +      restartReceiverButtonAction.putValue(
  +        Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R));
  +
  +      restartReceiverButtonAction.setEnabled(false);
   
       showReceiverHelpAction =
         new AbstractAction("Help") {
  @@ -270,7 +288,7 @@
   
       startAllAction =
         new AbstractAction(
  -        "(Re)start All Receivers", new ImageIcon(ChainsawIcons.ICON_RESTART)) {
  +        "(Re)start All Receivers", new ImageIcon(ChainsawIcons.ICON_RESTART_ALL)) {
             public void actionPerformed(ActionEvent e) {
               if (
                 JOptionPane.showConfirmDialog(
  @@ -302,7 +320,7 @@
   
       startAllAction.putValue(
         Action.SHORT_DESCRIPTION,
  -      "Ensures that any Receiver that isn't active, is started.");
  +      "Ensures that any Receiver that isn't active, is started, and any started 
action is stopped, and then restarted");
   
       receiversTree.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
       receiversTree.setCellRenderer(new ReceiverTreeCellRenderer());
  @@ -531,9 +549,10 @@
       if (object instanceof Receiver) {
         newReceiverButtonAction.setEnabled(true);
         shutdownReceiverButtonAction.setEnabled(true);
  +      restartReceiverButtonAction.setEnabled(true);
       } else {
         shutdownReceiverButtonAction.setEnabled(false);
  -      newReceiverButtonAction.setEnabled(true);
  +      restartReceiverButtonAction.setEnabled(false);
       }
     }
   
  @@ -698,6 +717,7 @@
   
         add(playReceiverButtonAction);
         add(pauseReceiverButtonAction);
  +      add(restartReceiverButtonAction);
         add(shutdownReceiverButtonAction);
         addSeparator();
   
  @@ -763,34 +783,31 @@
       private ReceiverToolbar() {
         setFloatable(false);
   
  -      SmallButton playReceiverButton =
  -        new SmallButton(playReceiverButtonAction);
  -      playReceiverButton.setText(null);
  -
  -      SmallButton pauseReceiverButton =
  -        new SmallButton(pauseReceiverButtonAction);
  -      pauseReceiverButton.setText(null);
  -
  +      SmallButton restartReceiverButton = new 
SmallButton(restartReceiverButtonAction);
  +      restartReceiverButton.setText(null);
  +      
         SmallButton shutdownReceiverButton =
           new SmallButton(shutdownReceiverButtonAction);
         shutdownReceiverButton.setText(null);
   
         SmallButton restartAllButton = new SmallButton(startAllAction);
         restartAllButton.setText(null);
  +      
  +      
   
         newReceiverButton = new SmallButton(newReceiverButtonAction);
         newReceiverButton.setText(null);
         newReceiverButton.addMouseListener(new PopupListener(newReceiverPopup));
   
         add(newReceiverButton);
  +      add(restartAllButton);
  +
         addSeparator();
   
  -      add(playReceiverButton);
  -      add(pauseReceiverButton);
  +      add(restartReceiverButton);
         add(shutdownReceiverButton);
   
         addSeparator();
  -      add(restartAllButton);
   
         Action closeAction =
           new AbstractAction(null, LineIconFactory.createCloseIcon()) {
  
  
  
  1.12      +5 -0      
logging-log4j/src/java/org/apache/log4j/chainsaw/icons/ChainsawIcons.java
  
  Index: ChainsawIcons.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/icons/ChainsawIcons.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ChainsawIcons.java        19 May 2004 00:08:51 -0000      1.11
  +++ ChainsawIcons.java        24 May 2004 22:25:30 -0000      1.12
  @@ -126,6 +126,11 @@
     public static final URL ICON_RESTART =
       ChainsawIcons.class.getClassLoader().getResource(
         BASE_ICON_PATH + "Redo16.gif");
  +  public static final URL ICON_RESTART_ALL = 
  +    ChainsawIcons.class.getClassLoader().getResource(
  +           BASE_ICON_PATH + "Refresh16.gif");
  +
  +  
     public static final URL ICON_STOP_RECEIVER =
       ChainsawIcons.class.getClassLoader().getResource(
         BASE_ICON_PATH + "Stop16.gif");
  
  
  
  1.13      +9 -1      
logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html
  
  Index: release-notes.html
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- release-notes.html        23 May 2004 16:15:06 -0000      1.12
  +++ release-notes.html        24 May 2004 22:25:30 -0000      1.13
  @@ -8,7 +8,15 @@
   <h2>Release Notes</h2>
   
   
  -<h3>1.99.99 (18th May 2004 10:35 GMT+10)</h3>
  +<h2>1.99.99 (25th May 2004 08:00 GMT+10)</h2>
  +<ul>
  + <li>Fixed a bug in the Receivers tree panel where restarting a set of receivers 
would duplicate them visually.  The plugins where stopped and started, but duplicate 
tree nodes where being added.  Thanks to Stephen Pain for
  + pointing it out. (we 'knew' about it, but we had forgotten...)</li>
  + <li>Added a "Restart" action to restart an individual Receiver.</li>
  + </li>Tweaked the action buttons available within the Receive toolbar to the more 
commonly used ones, Play/Pause still available
  + from popup menu</li>
  +</ul>
  +
   <h2>23 May 2004</h2>
   <ul>
    <li>Ongoing work to improve xml decoder.  Can now display a progress bar when 
processing files.</li>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to