psmith      2003/09/10 16:03:07

  Modified:    src/java/org/apache/log4j/chainsaw
                        ChainsawToolBarAndMenus.java LogPanel.java
                        ChainsawCyclicBufferTableModel.java
  Log:
  Refactored LogPanel and Menu & Toolbar class so they are decoupled.
  
  LogPanel is now responsible for it's own undocked Toolbar
  actions.
  
  The find option now at least doens't cause a ClassCastException,
  but it's still operating a little oddly.  Will replace this mechanism
  with a series of Finder-style objects.
  
  Revision  Changes    Path
  1.11      +18 -202   
jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java
  
  Index: ChainsawToolBarAndMenus.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawToolBarAndMenus.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ChainsawToolBarAndMenus.java      10 Sep 2003 03:18:33 -0000      1.10
  +++ ChainsawToolBarAndMenus.java      10 Sep 2003 23:03:07 -0000      1.11
  @@ -70,8 +70,6 @@
   import java.awt.event.ActionListener;
   import java.awt.event.InputEvent;
   import java.awt.event.KeyEvent;
  -import java.beans.PropertyChangeEvent;
  -import java.beans.PropertyChangeListener;
   
   import java.util.ArrayList;
   import java.util.Collection;
  @@ -89,7 +87,6 @@
   import javax.swing.JButton;
   import javax.swing.JCheckBoxMenuItem;
   import javax.swing.JComponent;
  -import javax.swing.JFrame;
   import javax.swing.JLabel;
   import javax.swing.JMenu;
   import javax.swing.JMenuBar;
  @@ -134,16 +131,14 @@
     private final Collection lookAndFeelMenus = new ArrayList();
     private final JCheckBoxMenuItem toggleShowReceiversCheck =
       new JCheckBoxMenuItem();
  -     
  -     private final JCheckBoxMenuItem toggleDetailMenuItem =
  -       new JCheckBoxMenuItem();
  -
  +  private final JCheckBoxMenuItem toggleDetailMenuItem =
  +    new JCheckBoxMenuItem();
     private final FileMenu fileMenu;
     private final JCheckBoxMenuItem toggleStatusBarCheck =
       new JCheckBoxMenuItem();
     private final JMenu viewMenu = new JMenu("View");
     private final JMenuBar menuBar;
  -   private final JCheckBoxMenuItem menuItemClose = new JCheckBoxMenuItem();
  +  private final JCheckBoxMenuItem menuItemClose = new JCheckBoxMenuItem();
     private final JRadioButtonMenuItem levelDisplayIcon =
       new JRadioButtonMenuItem("Icon");
     private final JRadioButtonMenuItem levelDisplayText =
  @@ -336,168 +331,6 @@
       return toolbar;
     }
   
  -  JToolBar createDockwindowToolbar(
  -    final JFrame dockablePanel, final LogPanel logPanel) {
  -    final JToolBar toolbar = new JToolBar();
  -    toolbar.setFloatable(false);
  -
  -    final String ident = dockablePanel.getTitle();
  -    final Action dockPauseAction =
  -      new AbstractAction("Pause") {
  -        public void actionPerformed(ActionEvent evt) {
  -          logPanel.setPaused(!logPanel.isPaused());
  -        }
  -      };
  -
  -    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 SmallToggleButton dockPauseButton =
  -      new SmallToggleButton(dockPauseAction);
  -    dockPauseButton.setText("");
  -
  -    dockPauseButton.getModel().setSelected(logPanel.isPaused());
  -
  -    logPanel.addPropertyChangeListener("paused", new PropertyChangeListener() {
  -
  -             public void propertyChange(PropertyChangeEvent evt) {
  -            dockPauseButton.getModel().setSelected(logPanel.isPaused());
  -             }});
  -    toolbar.add(dockPauseButton);
  -
  -    Action dockShowPrefsAction =
  -      new AbstractAction("") {
  -        public void actionPerformed(ActionEvent arg0) {
  -          logPanel.showPreferences();
  -        }
  -      };
  -
  -    dockShowPrefsAction.putValue(
  -      Action.SHORT_DESCRIPTION,
  -      showPreferencesAction.getValue(Action.SHORT_DESCRIPTION));
  -    dockShowPrefsAction.putValue(
  -      Action.SMALL_ICON, showPreferencesAction.getValue(Action.SMALL_ICON));
  -
  -    Action dockToggleLogTreeAction =
  -      new AbstractAction() {
  -        public void actionPerformed(ActionEvent e) {
  -          logPanel.toggleLogTreePanel();
  -        }
  -      };
  -
  -    dockToggleLogTreeAction.putValue(
  -      Action.SMALL_ICON, toggleLogTreeAction.getValue(Action.SMALL_ICON));
  -
  -    dockToggleLogTreeAction.putValue(
  -      Action.NAME, toggleLogTreeAction.getValue(Action.NAME));
  -
  -    dockToggleLogTreeAction.putValue(
  -      Action.SHORT_DESCRIPTION,
  -      toggleLogTreeAction.getValue(Action.SHORT_DESCRIPTION));
  -    dockToggleLogTreeAction.putValue(
  -      Action.SMALL_ICON, toggleLogTreeAction.getValue(Action.SMALL_ICON));
  -
  -    toolbar.add(new SmallButton(dockShowPrefsAction));
  -
  -    SmallToggleButton toggleLogTreeButton =
  -      new SmallToggleButton(dockToggleLogTreeAction);
  -    toggleLogTreeButton.setSelected(logPanel.isLogTreePanelVisible());
  -    toolbar.add(toggleLogTreeButton);
  -    toolbar.addSeparator();
  -
  -    final Action undockedClearAction =
  -      new AbstractAction("Clear") {
  -        public void actionPerformed(ActionEvent arg0) {
  -          logPanel.clearModel();
  -        }
  -      };
  -
  -    undockedClearAction.putValue(
  -      Action.SMALL_ICON, new ImageIcon(ChainsawIcons.DELETE));
  -    undockedClearAction.putValue(
  -      Action.SHORT_DESCRIPTION, "Removes all the events from the current view");
  -
  -    final SmallButton dockClearButton = new SmallButton(undockedClearAction);
  -    dockClearButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
  -      KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, InputEvent.CTRL_MASK),
  -      undockedClearAction.getValue(Action.NAME));
  -    dockClearButton.getActionMap().put(
  -      undockedClearAction.getValue(Action.NAME), undockedClearAction);
  -
  -    dockClearButton.setText("");
  -    toolbar.add(dockClearButton);
  -    toolbar.addSeparator();
  -
  -    final JTextField findField = createFindField();
  -    findField.getDocument().addDocumentListener(
  -      new DocumentListener() {
  -        public void insertUpdate(DocumentEvent e) {
  -          findInUndocked(false);
  -        }
  -
  -        public void removeUpdate(DocumentEvent e) {
  -          findInUndocked(false);
  -        }
  -
  -        public void changedUpdate(DocumentEvent e) {
  -          findInUndocked(false);
  -        }
  -
  -        private void findInUndocked(boolean next) {
  -          localFind(next, logPanel, findField);
  -        }
  -      });
  -
  -    final Action undockedFindAction =
  -      new AbstractAction() {
  -        public void actionPerformed(ActionEvent e) {
  -          localFind(true, logPanel, findField);
  -        }
  -      };
  -
  -    undockedFindAction.putValue(Action.NAME, "Find");
  -    undockedFindAction.putValue(
  -      Action.SHORT_DESCRIPTION, "Finds the next occurrence within this view");
  -    undockedFindAction.putValue(
  -      Action.SMALL_ICON, new ImageIcon(ChainsawIcons.FIND));
  -
  -    SmallButton undockedFindNextButton = new SmallButton(undockedFindAction);
  -
  -    undockedFindNextButton.setAction(undockedFindAction);
  -    undockedFindNextButton.setText("");
  -    undockedFindNextButton.getActionMap().put(
  -      undockedFindAction.getValue(Action.NAME), undockedFindAction);
  -    undockedFindNextButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
  -      KeyStroke.getKeyStroke("F3"), undockedFindAction.getValue(Action.NAME));
  -
  -    toolbar.add(undockedFindNextButton);
  -    toolbar.add(findField);
  -
  -    toolbar.addSeparator();
  -
  -    Action redockAction =
  -      new AbstractAction("", ChainsawIcons.ICON_DOCK) {
  -        public void actionPerformed(ActionEvent arg0) {
  -          logPanel.dock();
  -        }
  -      };
  -
  -    redockAction.putValue(
  -      Action.SHORT_DESCRIPTION,
  -      "Docks this window back with the main Chainsaw window");
  -
  -    SmallButton redockButton = new SmallButton(redockAction);
  -    toolbar.add(redockButton);
  -
  -    return toolbar;
  -  }
  -
     private Action createClearAction() {
       final Action action =
         new AbstractAction("Clear") {
  @@ -527,13 +360,13 @@
       final Action action =
         new AbstractAction() {
           public void actionPerformed(ActionEvent e) {
  -            closeAction.putValue(Action.NAME, "Welcome tab");
  -            logui.removeWelcomePanel();
  -            if(menuItemClose.isSelected()){
  -                logui.addWelcomePanel();
  -            } else {
  -                
  -            }
  +          closeAction.putValue(Action.NAME, "Welcome tab");
  +          logui.removeWelcomePanel();
  +
  +          if (menuItemClose.isSelected()) {
  +            logui.addWelcomePanel();
  +          } else {
  +          }
           }
         };
   
  @@ -564,7 +397,7 @@
         });
     }
   
  -  private JTextField createFindField() {
  +  static JTextField createFindField() {
       JTextField tf = new JTextField();
       Dimension fixedSize = new Dimension(132, 24);
       tf.setPreferredSize(fixedSize);
  @@ -618,7 +451,7 @@
       showToolbarCheck.setSelected(true);
   
       menuItemClose.setAction(closeAction);
  -    
  +
       JCheckBoxMenuItem pause = new JCheckBoxMenuItem(pauseAction);
       JMenuItem menuPrefs = new JMenuItem(showPreferencesAction);
       menuPrefs.setText(
  @@ -650,7 +483,7 @@
         Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_B));
       toggleStatusBarCheck.setAction(toggleStatusBarAction);
       toggleStatusBarCheck.setSelected(true);
  -    
  +
       activeTabMenu.add(pause);
       activeTabMenu.add(toggleDetailMenuItem);
       activeTabMenu.add(toggleLogTreeMenuItem);
  @@ -1086,29 +919,11 @@
       LogPanel logPanel = logui.getCurrentLogPanel();
   
       if (logPanel != null) {
  -      localFind(next, logPanel, findTextField);
  -    }
  -  }
  -
  -  private void localFind(
  -    boolean next, final LogPanel logPanel,
  -    final JTextField theFindTextField) {
  -    if (!theFindTextField.getText().equals("")) {
  -      if (
  -        (lastFind.length() == 0)
  -          || (lastFind.length() > theFindTextField.getText().length())) {
  -        logPanel.findFromTop(theFindTextField.getText());
  +      if (next) {
  +        logPanel.find(findTextField.getText());
         } else {
  -        if (next) {
  -          logPanel.findNext(theFindTextField.getText());
  -        } else {
  -          logPanel.find(theFindTextField.getText());
  -        }
  +        logPanel.find(findTextField.getText());
         }
  -
  -      lastFind = theFindTextField.getText();
  -    } else {
  -      theFindTextField.requestFocus();
       }
     }
   
  @@ -1130,6 +945,7 @@
       logTreePaneButton.setSelected(logui.isLogTreePanelVisible());
       showReceiversButton.setSelected(logui.isReceiverPanelVisible());
       menuItemClose.setSelected(logui.getTabbedPane().containsWelcomePanel());
  +
       /**
        * We get the currently selected LogPanel, and if null, deactivate some
        * actions
  @@ -1150,7 +966,7 @@
   
         pauseButton.getModel().setSelected(logPanel.isPaused());
         logui.getStatusBar().setPaused(logPanel.isPaused());
  -       toggleDetailMenuItem.setSelected(logPanel.isDetailPaneVisible());
  +      toggleDetailMenuItem.setSelected(logPanel.isDetailPaneVisible());
         detailPaneButton.getModel().setSelected(logPanel.isDetailPaneVisible());
       }
   
  
  
  
  1.3       +180 -14   jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
  
  Index: LogPanel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LogPanel.java     10 Sep 2003 03:18:33 -0000      1.2
  +++ LogPanel.java     10 Sep 2003 23:03:07 -0000      1.3
  @@ -80,6 +80,7 @@
   import java.awt.event.ActionListener;
   import java.awt.event.ComponentEvent;
   import java.awt.event.ComponentListener;
  +import java.awt.event.InputEvent;
   import java.awt.event.KeyEvent;
   import java.awt.event.KeyListener;
   import java.awt.event.MouseEvent;
  @@ -139,6 +140,7 @@
   import javax.swing.JTable;
   import javax.swing.JTextField;
   import javax.swing.JToolBar;
  +import javax.swing.KeyStroke;
   import javax.swing.ListSelectionModel;
   import javax.swing.SwingUtilities;
   import javax.swing.event.ChangeEvent;
  @@ -173,7 +175,7 @@
     final DetailPaneUpdater detailPaneUpdater;
     final JPanel upperPanel;
     final JPanel eventsAndStatusPanel;
  -  final JFrame f;
  +  final JFrame undockedFrame;
     final DockablePanel externalPanel;
     final Action dockingAction;
     final JSortTable table;
  @@ -199,6 +201,7 @@
     private final LoggerNameTreePanel logTreePanel;
     private boolean tooltipsEnabled;
     private final ChainsawStatusBar statusBar;
  +  private final JToolBar undockedToolbar;
   
     public LogPanel(
       final ChainsawStatusBar statusBar, final String ident, String eventType) {
  @@ -750,20 +753,18 @@
   
       final JMenuItem menuItemToggleDock = new JMenuItem("Undock/dock");
   
  -    f = new JFrame(ident);
  -    f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  +    undockedFrame = new JFrame(ident);
  +    undockedFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
   
       if (ChainsawIcons.UNDOCKED_ICON != null) {
  -      f.setIconImage(new ImageIcon(ChainsawIcons.UNDOCKED_ICON).getImage());
  +      undockedFrame.setIconImage(
  +        new ImageIcon(ChainsawIcons.UNDOCKED_ICON).getImage());
       }
   
       externalPanel = new DockablePanel();
       externalPanel.setLayout(new BorderLayout());
  -    f.getContentPane().add(externalPanel);
  +    undockedFrame.getContentPane().add(externalPanel);
   
  -    //       TODO undocked toolbar is broken      
  -    //      f.getContentPane().add(
  -    //        logUI.getToolBarAndMenus().createDockwindowToolbar(f, this), 
BorderLayout.NORTH);
       dockingAction =
         new AbstractAction("Undock") {
             public void actionPerformed(ActionEvent evt) {
  @@ -777,7 +778,7 @@
       dockingAction.putValue(
         Action.SMALL_ICON, new ImageIcon(ChainsawIcons.UNDOCK));
       menuItemToggleDock.setAction(dockingAction);
  -    f.addWindowListener(
  +    undockedFrame.addWindowListener(
         new WindowAdapter() {
           public void windowClosing(WindowEvent e) {
             dock();
  @@ -974,7 +975,170 @@
           });
       }
   
  -    f.pack();
  +    undockedToolbar = createDockwindowToolbar();
  +    externalPanel.add(undockedToolbar, BorderLayout.NORTH);
  +    undockedFrame.pack();
  +  }
  +
  +  private JToolBar createDockwindowToolbar() {
  +    final JToolBar toolbar = new JToolBar();
  +    toolbar.setFloatable(false);
  +
  +    final Action dockPauseAction =
  +      new AbstractAction("Pause") {
  +        public void actionPerformed(ActionEvent evt) {
  +          setPaused(!isPaused());
  +        }
  +      };
  +
  +    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 SmallToggleButton dockPauseButton =
  +      new SmallToggleButton(dockPauseAction);
  +    dockPauseButton.setText("");
  +
  +    dockPauseButton.getModel().setSelected(isPaused());
  +
  +    addPropertyChangeListener(
  +      "paused",
  +      new PropertyChangeListener() {
  +        public void propertyChange(PropertyChangeEvent evt) {
  +          dockPauseButton.getModel().setSelected(isPaused());
  +        }
  +      });
  +    toolbar.add(dockPauseButton);
  +
  +    Action dockShowPrefsAction =
  +      new AbstractAction("") {
  +        public void actionPerformed(ActionEvent arg0) {
  +          showPreferences();
  +        }
  +      };
  +
  +    dockShowPrefsAction.putValue(
  +      Action.SHORT_DESCRIPTION, "Define display and color filters...");
  +    dockShowPrefsAction.putValue(
  +      Action.SMALL_ICON, ChainsawIcons.ICON_PREFERENCES);
  +
  +    Action dockToggleLogTreeAction =
  +      new AbstractAction() {
  +        public void actionPerformed(ActionEvent e) {
  +          toggleLogTreePanel();
  +        }
  +      };
  +
  +    dockToggleLogTreeAction.putValue(Action.SMALL_ICON, null);
  +
  +    dockToggleLogTreeAction.putValue(Action.NAME, "Logger Tree");
  +
  +    dockToggleLogTreeAction.putValue(
  +      Action.SHORT_DESCRIPTION, "Toggles the Log Tree panel");
  +    dockToggleLogTreeAction.putValue(Action.SMALL_ICON, null);
  +
  +    toolbar.add(new SmallButton(dockShowPrefsAction));
  +
  +    SmallToggleButton toggleLogTreeButton =
  +      new SmallToggleButton(dockToggleLogTreeAction);
  +    toggleLogTreeButton.setSelected(isLogTreePanelVisible());
  +    toolbar.add(toggleLogTreeButton);
  +    toolbar.addSeparator();
  +
  +    final Action undockedClearAction =
  +      new AbstractAction("Clear") {
  +        public void actionPerformed(ActionEvent arg0) {
  +          clearModel();
  +        }
  +      };
  +
  +    undockedClearAction.putValue(
  +      Action.SMALL_ICON, new ImageIcon(ChainsawIcons.DELETE));
  +    undockedClearAction.putValue(
  +      Action.SHORT_DESCRIPTION, "Removes all the events from the current view");
  +
  +    final SmallButton dockClearButton = new SmallButton(undockedClearAction);
  +    dockClearButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
  +      KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, InputEvent.CTRL_MASK),
  +      undockedClearAction.getValue(Action.NAME));
  +    dockClearButton.getActionMap().put(
  +      undockedClearAction.getValue(Action.NAME), undockedClearAction);
  +
  +    dockClearButton.setText("");
  +    toolbar.add(dockClearButton);
  +    toolbar.addSeparator();
  +
  +    final JTextField findField = ChainsawToolBarAndMenus.createFindField();
  +    findField.getDocument().addDocumentListener(
  +      new DocumentListener() {
  +        public void insertUpdate(DocumentEvent e) {
  +          findInUndocked(false);
  +        }
  +
  +        public void removeUpdate(DocumentEvent e) {
  +          findInUndocked(false);
  +        }
  +
  +        public void changedUpdate(DocumentEvent e) {
  +          findInUndocked(false);
  +        }
  +
  +        private void findInUndocked(boolean next) {
  +          if (next) {
  +            findNext(findField.getText());
  +          } else {
  +            find(findField.getText());
  +          }
  +        }
  +      });
  +
  +    final Action undockedFindAction =
  +      new AbstractAction() {
  +        public void actionPerformed(ActionEvent e) {
  +          findNext(findField.getText());
  +        }
  +      };
  +
  +    undockedFindAction.putValue(Action.NAME, "Find");
  +    undockedFindAction.putValue(
  +      Action.SHORT_DESCRIPTION, "Finds the next occurrence within this view");
  +    undockedFindAction.putValue(
  +      Action.SMALL_ICON, new ImageIcon(ChainsawIcons.FIND));
  +
  +    SmallButton undockedFindNextButton = new SmallButton(undockedFindAction);
  +
  +    undockedFindNextButton.setAction(undockedFindAction);
  +    undockedFindNextButton.setText("");
  +    undockedFindNextButton.getActionMap().put(
  +      undockedFindAction.getValue(Action.NAME), undockedFindAction);
  +    undockedFindNextButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
  +      KeyStroke.getKeyStroke("F3"), undockedFindAction.getValue(Action.NAME));
  +
  +    toolbar.add(undockedFindNextButton);
  +    toolbar.add(findField);
  +
  +    toolbar.addSeparator();
  +
  +    Action redockAction =
  +      new AbstractAction("", ChainsawIcons.ICON_DOCK) {
  +        public void actionPerformed(ActionEvent arg0) {
  +          dock();
  +        }
  +      };
  +
  +    redockAction.putValue(
  +      Action.SHORT_DESCRIPTION,
  +      "Docks this window back with the main Chainsaw window");
  +
  +    SmallButton redockButton = new SmallButton(redockAction);
  +    toolbar.add(redockButton);
  +
  +    return toolbar;
     }
   
     public void addEventCountListener(EventCountListener l) {
  @@ -1092,7 +1256,7 @@
      */
     void dock() {
       setDocked(true);
  -    f.setVisible(false);
  +    undockedFrame.setVisible(false);
       removeAll();
   
       //      add(lowerPanel, BorderLayout.CENTER);
  @@ -1110,13 +1274,15 @@
     void undock() {
       setDocked(false);
       externalPanel.removeAll();
  +
  +    externalPanel.add(undockedToolbar, BorderLayout.NORTH);
       externalPanel.add(nameTreeAndMainPanelSplit, BorderLayout.CENTER);
       externalPanel.setDocked(false);
  -    f.setSize(getSize());
  +    undockedFrame.setSize(getSize());
   
  -    f.setLocation(getBounds().x, getBounds().y);
  +    undockedFrame.setLocation(getBounds().x, getBounds().y);
   
  -    f.setVisible(true);
  +    undockedFrame.setVisible(true);
       dockingAction.putValue(Action.NAME, "Dock");
       dockingAction.putValue(Action.SMALL_ICON, ChainsawIcons.ICON_DOCK);
     }
  
  
  
  1.6       +17 -21    
jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
  
  Index: ChainsawCyclicBufferTableModel.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChainsawCyclicBufferTableModel.java       9 Sep 2003 03:00:51 -0000       1.5
  +++ ChainsawCyclicBufferTableModel.java       10 Sep 2003 23:03:07 -0000      1.6
  @@ -64,8 +64,8 @@
   import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.ListIterator;
   import java.util.Set;
  -import java.util.Vector;
   
   import javax.swing.SwingUtilities;
   import javax.swing.event.EventListenerList;
  @@ -195,13 +195,13 @@
       }
     }
   
  -     /**
  -      * Changes the underlying display rule in use.  If there was 
  -      * a previous Rule defined, this Model removes itself as a listener
  -      * from the old rule, and adds itself to the new rule (if the new Rule is not 
Null).
  -      * 
  -      * In any case, the model ensures the Filtered list is made up to date in a 
separate thread.
  -      */
  +  /**
  +   * Changes the underlying display rule in use.  If there was
  +   * a previous Rule defined, this Model removes itself as a listener
  +   * from the old rule, and adds itself to the new rule (if the new Rule is not 
Null).
  +   *
  +   * In any case, the model ensures the Filtered list is made up to date in a 
separate thread.
  +   */
     public void setDisplayRule(Rule displayRule) {
       if (this.displayRule != null) {
         this.displayRule.removePropertyChangeListener(this);
  @@ -258,6 +258,11 @@
       notifyCountListeners();
     }
   
  +  /**
  +   * @deprecated - should this be replaced with a Refinement filter?
  +   *
  +   * If not it should be replaced with something inside LogPanel, a Finder class, 
it should not be in the Model.
  +   */
     public int find(int startRow, String text) {
       if (text == null) {
         text = "";
  @@ -269,28 +274,19 @@
       String thisVal = null;
   
       synchronized (syncLock) {
  -      Iterator iter = filteredList.iterator();
  +      ListIterator iter = filteredList.listIterator();
   
         while (iter.hasNext()) {
           currentRow++;
   
  -        Vector v2 = (Vector) iter.next();
  +        LoggingEvent event = (LoggingEvent) iter.next();
   
           if (currentRow < startRow) {
             continue;
           }
   
  -        Iterator iter2 = v2.iterator();
  -
  -        while (iter2.hasNext()) {
  -          thisVal = iter2.next().toString();
  -
  -          boolean result =
  -            ((thisVal != null) && (thisVal.toLowerCase().indexOf(text) > -1));
  -
  -          if (result) {
  -            return currentRow;
  -          }
  +        if (event.getMessage().toString().toLowerCase().indexOf(text) > 0) {
  +          return currentRow;
           }
         }
       }
  
  
  

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

Reply via email to