You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ps...@apache.org on 2003/09/17 03:13:41 UTC
cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw ChainsawCyclicBufferTableModel.java EventContainer.java
psmith 2003/09/16 18:13:41
Modified: src/java/org/apache/log4j/chainsaw
ChainsawCyclicBufferTableModel.java
EventContainer.java
Log:
Expose the current size of the unfiltered model via the interface.
Revision Changes Path
1.9 +23 -9 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ChainsawCyclicBufferTableModel.java 13 Sep 2003 05:56:13 -0000 1.8
+++ ChainsawCyclicBufferTableModel.java 17 Sep 2003 01:13:41 -0000 1.9
@@ -92,7 +92,6 @@
private final int INITIAL_CAPACITY = 5000;
List unfilteredList = new CyclicBufferList(INITIAL_CAPACITY);
List filteredList = new CyclicBufferList(INITIAL_CAPACITY);
-
private boolean currentSortAscending;
private int currentSortColumn;
private EventListenerList eventListenerList = new EventListenerList();
@@ -113,7 +112,7 @@
new PropertyChangeSupport(this);
public ChainsawCyclicBufferTableModel() {
- propertySupport.addPropertyChangeListener("cyclic",new ModelChanger());
+ propertySupport.addPropertyChangeListener("cyclic", new ModelChanger());
}
/**
@@ -324,6 +323,11 @@
public Object getValueAt(int rowIndex, int columnIndex) {
LoggingEvent event = (LoggingEvent) filteredList.get(rowIndex);
+
+ if (event == null) {
+ return null;
+ }
+
LocationInfo info = event.getLocationInformation();
if (event == null) {
@@ -548,6 +552,21 @@
propertySupport.addPropertyChangeListener(l);
}
+ /* (non-Javadoc)
+ * @see org.apache.log4j.chainsaw.EventContainer#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(
+ String propertyName, PropertyChangeListener l) {
+ propertySupport.addPropertyChangeListener(propertyName, l);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.log4j.chainsaw.EventContainer#size()
+ */
+ public int size() {
+ return unfilteredList.size();
+ }
+
class SortExecutor implements Runnable {
private JSortTable table;
private int col;
@@ -641,6 +660,7 @@
public void propertyChange(PropertyChangeEvent arg0) {
synchronized (syncLock) {
LogLog.debug("Changing Model, isCyclic is now " + isCyclic());
+
List oldUnfilteredList = unfilteredList;
List oldFilteredList = filteredList;
@@ -655,14 +675,8 @@
unfilteredList.addAll(oldUnfilteredList);
filteredList.addAll(oldFilteredList);
}
+
LogLog.debug("Model Change completed");
}
- }
-
- /* (non-Javadoc)
- * @see org.apache.log4j.chainsaw.EventContainer#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
- */
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener l) {
- propertySupport.addPropertyChangeListener(propertyName, l);
}
}
1.8 +6 -0 jakarta-log4j/src/java/org/apache/log4j/chainsaw/EventContainer.java
Index: EventContainer.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/EventContainer.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- EventContainer.java 13 Sep 2003 05:56:13 -0000 1.7
+++ EventContainer.java 17 Sep 2003 01:13:41 -0000 1.8
@@ -133,6 +133,12 @@
* Returns a copied list of all the event in the model.
*/
List getAllEvents();
+
+ /**
+ * Returns the total number of events currently in the model (all, not just filtered)
+ * @return
+ */
+ int size();
/**
* Returns the vector representing the row.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org