logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject cvs commit: jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw DefaultSortTableModel.java EventContainer.java ChainsawCyclicBufferTableModel.java SortExecutor.java
Date Sat, 07 Jun 2003 04:30:28 GMT
sdeboy      2003/06/06 21:30:27

  Modified:    src/java/org/apache/log4j/chainsaw
                        DefaultSortTableModel.java EventContainer.java
                        ChainsawCyclicBufferTableModel.java
                        SortExecutor.java
  Log:
  Updated defaultsorttablemodel and sortexecutor to correctly re-set the last selected row
after a sort (using the row's vector instead of the LoggingEvent representing the row).
  
  Revision  Changes    Path
  1.18      +6 -2      jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/DefaultSortTableModel.java
  
  Index: DefaultSortTableModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/DefaultSortTableModel.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DefaultSortTableModel.java	28 May 2003 07:34:57 -0000	1.17
  +++ DefaultSortTableModel.java	7 Jun 2003 04:30:27 -0000	1.18
  @@ -122,6 +122,12 @@
       }
     }
   
  +  public int getRowIndex(Vector v) {
  +  	synchronized(getDataVector()) {
  +	  	return getDataVector().indexOf(v);
  +  	}
  +  }
  +  
     public Vector getRow(int row) {
       if ((getDataVector().size() >= row) && (row > -1)) {
         int col = columnIdentifiers.indexOf(ChainsawConstants.ID_COL_NAME);
  @@ -298,8 +304,6 @@
   
     public Vector getAllEvents() {
       Vector v = new Vector();
  -    int index = allColumnNames.indexOf(ChainsawConstants.ID_COL_NAME);
  -
       synchronized (getDataVector()) {
         Iterator iter = unfilteredEvents.keySet().iterator();
   
  
  
  
  1.5       +2 -0      jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/EventContainer.java
  
  Index: EventContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/EventContainer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EventContainer.java	26 May 2003 06:50:09 -0000	1.4
  +++ EventContainer.java	7 Jun 2003 04:30:27 -0000	1.5
  @@ -174,6 +174,8 @@
      */
     public void setSortEnabled(boolean b);
   
  +  public int getRowIndex(Vector v);
  +  
     /**
      * Causes the EventContainer to sort according to it's configured attributes
      *
  
  
  
  1.7       +6 -0      jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
  
  Index: ChainsawCyclicBufferTableModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ChainsawCyclicBufferTableModel.java	28 May 2003 16:52:49 -0000	1.6
  +++ ChainsawCyclicBufferTableModel.java	7 Jun 2003 04:30:27 -0000	1.7
  @@ -114,6 +114,12 @@
       }
     }
   
  +  public int getRowIndex(Vector v) {
  +  	synchronized(syncLock) {
  +	  	return cyclicBufferList.indexOf(v);
  +  	}
  +  }
  +  
     public int getColumnCount() {
       return ChainsawColumns.getColumnsNames().size();
     }
  
  
  
  1.5       +9 -5      jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/SortExecutor.java
  
  Index: SortExecutor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/SortExecutor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SortExecutor.java	2 Jun 2003 04:23:08 -0000	1.4
  +++ SortExecutor.java	7 Jun 2003 04:30:27 -0000	1.5
  @@ -49,6 +49,9 @@
   
   package org.apache.log4j.chainsaw;
   
  +import java.util.Vector;
  +
  +
   /**
    * A Runnable task that is executed in the Swing Event Dispatching
    * thread to ensure that the data is sorted by a particular column
  @@ -74,24 +77,25 @@
   
     public void run() {
       synchronized (syncLock) {
  -      Object o = null;
  +      Vector v = null;
   
         if ((currentRow > -1) && (currentRow < model.getAllEvents().size()))
{
  -        o = model.getAllEvents().get(currentRow);
  +        v = model.getRow(currentRow);
         }
   
         model.setSortEnabled(true);
         model.setCurrentSortColumn(col, ascending);
  +
         if (col > -1) {
  -	      model.sort();
  +        model.sort();
         }
   
  -      if (o == null) {
  +      if (v == null) {
           table.scrollToRow(
             -1, table.columnAtPoint(table.getVisibleRect().getLocation()));
         } else {
           table.scrollToRow(
  -          model.getAllEvents().indexOf(o),
  +          model.getRowIndex(v),
             table.columnAtPoint(table.getVisibleRect().getLocation()));
         }
       }
  
  
  

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