psmith      2004/07/20 15:22:11

  Modified:    src/java/org/apache/log4j/chainsaw
                        ChainsawCyclicBufferTableModel.java LogPanel.java
                        EventContainer.java FileSaveAction.java
  Log:
  Applied patch from Stephen Pain.
  
  Patch changes the FileSaveAction so that only the displayed events are saved, which 
makes much more sense
  and is inline with what the tooltip of the button was saying anyway... :|
  
  Revision  Changes    Path
  1.32      +13 -1     
logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
  
  Index: ChainsawCyclicBufferTableModel.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ChainsawCyclicBufferTableModel.java       21 May 2004 18:45:07 -0000      1.31
  +++ ChainsawCyclicBufferTableModel.java       20 Jul 2004 22:22:11 -0000      1.32
  @@ -51,6 +51,7 @@
    *
    * @author Paul Smith <[EMAIL PROTECTED]>
    * @author Scott Deboy <[EMAIL PROTECTED]>
  + * @author Stephen Pain
    *
    */
   class ChainsawCyclicBufferTableModel extends AbstractTableModel
  @@ -280,7 +281,18 @@
   
       return list;
     }
  -
  +  
  +  
  +  public List getFilteredEvents() {
  +     List list = new ArrayList(filteredList.size());
  +     
  +     synchronized (filteredList) {
  +             list.addAll(filteredList);
  +     }
  +     
  +     return list;
  +  }
  +  
     public int getRowIndex(LoggingEvent e) {
       synchronized (filteredList) {
         return filteredList.indexOf(e);
  
  
  
  1.81      +10 -0     logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
  
  Index: LogPanel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- LogPanel.java     2 Jul 2004 05:49:27 -0000       1.80
  +++ LogPanel.java     20 Jul 2004 22:22:11 -0000      1.81
  @@ -178,6 +178,7 @@
    *
    [EMAIL PROTECTED] Scott Deboy (sdeboy at apache.org)
    [EMAIL PROTECTED] Paul Smith (psmith at apache.org)
  + [EMAIL PROTECTED] Stephen Pain
    *
    */
   public class LogPanel extends DockablePanel implements EventBatchListener,
  @@ -1492,6 +1493,15 @@
       return tableModel.getAllEvents();
     }
   
  +  /**
  +   * Return the events that are visible with the current filter applied
  +   *
  +   * @return list of LoggingEvents
  +   */
  +  List getFilteredEvents() {
  +     return tableModel.getFilteredEvents();  
  +  }
  +  
     List getMatchingEvents(Rule rule) {
       return tableModel.getMatchingEvents(rule);
     }
  
  
  
  1.16      +6 -0      
logging-log4j/src/java/org/apache/log4j/chainsaw/EventContainer.java
  
  Index: EventContainer.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/EventContainer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- EventContainer.java       12 May 2004 06:37:30 -0000      1.15
  +++ EventContainer.java       20 Jul 2004 22:22:11 -0000      1.16
  @@ -31,6 +31,7 @@
    *
    * @author Paul Smith <[EMAIL PROTECTED]>
    * @author Scott Deboy <[EMAIL PROTECTED]>
  + * @author Stephen Pain
    *
    */
   public interface EventContainer extends SortTableModel, LoggerNameModel {
  @@ -106,6 +107,11 @@
      */
     List getAllEvents();
   
  +  /**
  +   * Returns a copied list containing the events in the model with filter applied
  +   */
  +  List getFilteredEvents();
  +  
     /**
      * Returns the total number of events currently in the model (all, not just 
filtered)
      * @return
  
  
  
  1.6       +2 -1      
logging-log4j/src/java/org/apache/log4j/chainsaw/FileSaveAction.java
  
  Index: FileSaveAction.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/FileSaveAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FileSaveAction.java       27 Feb 2004 16:47:29 -0000      1.5
  +++ FileSaveAction.java       20 Jul 2004 22:22:11 -0000      1.6
  @@ -44,6 +44,7 @@
    *
    * @author Scott Deboy <[EMAIL PROTECTED]>
    * @author Paul Smith <[EMAIL PROTECTED]>
  + * @author Stephen Pain
    */
   class FileSaveAction extends AbstractAction {
     private LogUI parent;
  @@ -91,7 +92,7 @@
   
       if (selectedFile != null) {
         try {
  -        List v = parent.getCurrentLogPanel().getEvents();
  +        List v = parent.getCurrentLogPanel().getFilteredEvents();
   
           if (((v != null) && (v.size() == 0)) || (v == null)) {
             //no events to save
  
  
  

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

Reply via email to