sdeboy 2003/06/14 14:30:45
Modified: src/java/org/apache/log4j/chainsaw
TableColorizingRenderer.java
DisplayFilterEntry.java LogUI.java
EventContainer.java
ChainsawCyclicBufferTableModel.java
DisplayFilter.java ColorDisplaySelector.java
ColorFilter.java
. build.xml
Removed: src/java/org/apache/log4j/chainsaw FilterChangeExecutor.java
ToolTipSelector.java SortExecutor.java
Log:
Refactoring in progress
- Updated build javadoc target
- Removed dead code
- Moved Filter and SortExecutors into CyclicTableModel and simplified EventContainer
interface
- Updated displayfilterentry - previously supported a flag on whether the display
filter was a positive or negative filter - was always being set to true so removed the
flag.
Revision Changes Path
1.13 +1 -16
jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
Index: TableColorizingRenderer.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TableColorizingRenderer.java 8 Jun 2003 16:20:46 -0000 1.12
+++ TableColorizingRenderer.java 14 Jun 2003 21:30:44 -0000 1.13
@@ -84,7 +84,7 @@
* @author Claude Duguay
*/
public class TableColorizingRenderer extends DefaultTableCellRenderer
- implements SettingsListener, FilterChangedListener {
+ implements SettingsListener {
private static final DateFormat DATE_FORMATTER =
new ISO8601DateFormat(Calendar.getInstance().getTimeZone());
private Map iconMap = new HashMap();
@@ -151,21 +151,6 @@
}
public void saveSettings(SaveSettingsEvent event) {
- }
-
- /**
- *TODO
- */
- public void filterChanged() {
- if (table != null) {
- //assumes calling validate will re-run through each cell's
gettablecellrenderercomponent
- //with an updated colorfilter
- TableModel model = table.getModel();
-
- if (model instanceof EventContainer) {
- ((EventContainer) model).fireTableDataChanged();
- }
- }
}
/**
1.2 +4 -17
jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/DisplayFilterEntry.java
Index: DisplayFilterEntry.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/DisplayFilterEntry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DisplayFilterEntry.java 28 Apr 2003 05:44:31 -0000 1.1
+++ DisplayFilterEntry.java 14 Jun 2003 21:30:44 -0000 1.2
@@ -59,19 +59,16 @@
*/
class DisplayFilterEntry implements Serializable {
- private static final String GLOBAL_MATCH = "*";
private final String columnName;
private final String columnValue;
private final String level;
private ExpressionEvaluator evaluator;
- private final Boolean display;
DisplayFilterEntry(
- String columnName, String columnValue, String level, Boolean display) {
+ String columnName, String columnValue, String level) {
this.columnName = columnName;
this.columnValue = columnValue;
this.level = level;
- this.display = display;
evaluator =
ExpressionEvaluatorFactory.newInstance().getEvaluator(columnValue);
}
@@ -80,10 +77,6 @@
return level;
}
- Boolean getDisplay() {
- return display;
- }
-
String getColumnName() {
return columnName;
}
@@ -95,7 +88,7 @@
boolean matches(String column, String value, String level) {
return ((column != null) && (level != null) && (evaluator != null)
&& column.equals(this.columnName)
- && (level.equals(this.level) || (this.level.equals(GLOBAL_MATCH)))
+ && (level.equals(this.level) ||
(this.level.equals(ChainsawConstants.GLOBAL_MATCH)))
&& evaluator.match(value));
}
@@ -114,10 +107,6 @@
result = (result * 17) + level.hashCode();
}
- if (display != null) {
- result = (result * 17) + display.hashCode();
- }
-
return result;
}
@@ -136,9 +125,7 @@
&& (((level == null) && (f.level == null))
|| ((level != null) && level.equals(f.level)));
- return result
- && (((display == null) && (f.display == null))
- || ((display != null) && display.equals(f.display)));
+ return result;
}
return false;
@@ -146,6 +133,6 @@
public String toString() {
return "columnName: " + columnName + ", columnValue: " + columnValue
- + ", level: " + level + ", display: " + display;
+ + ", level: " + level;
}
}
1.94 +53 -20
jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/LogUI.java
Index: LogUI.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/LogUI.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- LogUI.java 14 Jun 2003 16:48:14 -0000 1.93
+++ LogUI.java 14 Jun 2003 21:30:44 -0000 1.94
@@ -234,7 +234,7 @@
if (splash != null) {
splash.setVisible(false);
splash.dispose();
- }
+ }
}
/**
@@ -842,8 +842,9 @@
boolean rowAdded = false;
Vector lastSelected = null;
- if (table.getSelectedRow() > -1) {
- lastSelected = tableModel.getRow(table.getSelectedRow());
+
+ if (table.getSelectedRow() > -1) {
+ lastSelected = tableModel.getRow(table.getSelectedRow());
}
for (Iterator iter = eventBatchEntrys.iterator(); iter.hasNext();) {
@@ -897,21 +898,22 @@
}
table.getSelectionModel().setValueIsAdjusting(false);
+
+ //tell the model to notify the count listeners
tableModel.notifyCountListeners();
if (rowAdded) {
- if (tableModel.isSortEnabled()) {
- tableModel.sort();
- }
+ tableModel.sort();
+
if (scrollToBottom.isScrolled() && !scrollToBottom.isBypassed()) {
table.scrollToBottom(
table.columnAtPoint(table.getVisibleRect().getLocation()));
} else {
- if (lastSelected != null) {
- table.scrollToRow(
- tableModel.getRowIndex(lastSelected),
- table.columnAtPoint(table.getVisibleRect().getLocation()));
- }
+ if (lastSelected != null) {
+ table.scrollToRow(
+ tableModel.getRowIndex(lastSelected),
+ table.columnAtPoint(table.getVisibleRect().getLocation()));
+ }
}
}
}
@@ -1035,10 +1037,10 @@
TableColorizingRenderer renderer = new TableColorizingRenderer();
sm.addSettingsListener(renderer);
sm.configure(renderer);
+
renderer.setColorFilter(colorFilter);
- colorFilter.addFilterChangedListener(renderer);
- displayFilter.addFilterChangedListener(renderer);
+ colorFilter.addFilterChangedListener(tableModel);
table.setDefaultRenderer(Object.class, renderer);
@@ -1069,8 +1071,19 @@
thisItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent evt) {
+ Vector lastSelected = tableModel.getRow(table.getSelectedRow());
colorDisplaySelector.applyColorUpdateForColumn(colName);
colorDisplaySelector.applyColorFilters(colName);
+
+ if (lastSelected != null) {
+ int newIndex = tableModel.getRowIndex(lastSelected);
+
+ if (newIndex > -1) {
+ table.scrollToRow(
+ newIndex,
+ table.columnAtPoint(table.getVisibleRect().getLocation()));
+ }
+ }
}
});
bg.add(thisItem);
@@ -1088,8 +1101,19 @@
thisItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent evt) {
+ Vector lastSelected = tableModel.getRow(table.getSelectedRow());
colorDisplaySelector.applyDisplayUpdateForColumn(colName);
colorDisplaySelector.applyDisplayFilters(colName);
+
+ if (lastSelected != null) {
+ int newIndex = tableModel.getRowIndex(lastSelected);
+
+ if (newIndex > -1) {
+ table.scrollToRow(
+ newIndex,
+ table.columnAtPoint(table.getVisibleRect().getLocation()));
+ }
+ }
}
});
bg2.add(thisItem);
@@ -1177,8 +1201,7 @@
displayFilter.setCustomFilter(
new DisplayFilterEntry(
(String) customFilterList.getSelectedItem(),
- filterText.getText(), ChainsawConstants.GLOBAL_MATCH,
- Boolean.TRUE));
+ filterText.getText(), ChainsawConstants.GLOBAL_MATCH));
}
}
});
@@ -1199,7 +1222,7 @@
displayFilter.setCustomFilter(
new DisplayFilterEntry(
(String) customFilterList.getSelectedItem(),
- filterText.getText(), "*", Boolean.TRUE));
+ filterText.getText(), ChainsawConstants.GLOBAL_MATCH));
}
}
});
@@ -1211,14 +1234,23 @@
override.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent evt) {
+ Vector lastSelected = tableModel.getRow(table.getSelectedRow());
displayFilter.setCustomFilterOverride(override.isSelected());
+
+ if (lastSelected != null) {
+ int newIndex = tableModel.getRowIndex(lastSelected);
+
+ if (newIndex > -1) {
+ table.scrollToRow(
+ newIndex,
+ table.columnAtPoint(table.getVisibleRect().getLocation()));
+ }
+ }
}
});
- // override.setPreferredSize(new Dimension(80,16));
- // override.setFont(new Font("Dialog", Font.BOLD, 10));
- // override.setMargin(new Insets(2,2,2,2));
- override.setToolTipText("Override");
+ override.setToolTipText(
+ "<html>Unchecked: Apply custom filter to displayed rows<br>Checked: Apply
custom filter to ALL rows (override display filter setting)</html>");
JPanel upperRightPanel =
new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
@@ -1610,6 +1642,7 @@
detailPaneUpdater.setSelectedRow(-1);
detail.notify();
}
+
statusBar.setNothingSelected();
}
1.6 +21 -80
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EventContainer.java 7 Jun 2003 04:30:27 -0000 1.5
+++ EventContainer.java 14 Jun 2003 21:30:44 -0000 1.6
@@ -49,10 +49,8 @@
package org.apache.log4j.chainsaw;
-import java.util.Collection;
import java.util.Vector;
-
/**
* To allow pluggable TableModel implementations for Chainsaw, this interface has
been factored out.
*
@@ -62,30 +60,17 @@
*
*/
public interface EventContainer extends SortTableModel, FilterChangedListener {
-
/**
* Adds an EventCountListener, to be notified when the # of events changes
* @param listener
*/
- public void addEventCountListener(EventCountListener listener);
-
- /**
- * Adds a row to the model
- * @param row
- */
- public void addRow(Vector row);
-
- /**
- * Clears the events that are currently being displayed
- *
- */
- public void clearFilteredEvents();
+ void addEventCountListener(EventCountListener listener);
/**
* Clears the model completely
*
*/
- public void clearModel();
+ void clearModel();
/**
* Locates a row number, starting from startRow, containing the text
@@ -94,97 +79,53 @@
* @param text
* @return
*/
- public int find(int startRow, String text);
+ int find(int startRow, String text);
/**
- * returns every single event in the model
+ * Returns every event in the model
* @return
*/
- public Vector getAllEvents();
-
-// /**
-// * Returns all the Events that have matched the Filter
-// * @deprecated
-// * @return
-// */
-// public Vector getDisplayableEvents();
-
- /**
- * Returns the currently in use DisplayFilter
- */
- public DisplayFilter getDisplayFilter();
+ Vector getAllEvents();
-// /**
-// * returns the LoggingEvent with a specific ID
-// * @param ID
-// * @return
-// */
-// public LoggingEvent getEvent(Integer ID);
-
- public Vector getRow(int row);
-
- /**
- * Returns a map of Unfiltered events
- */
- public Collection getUnfilteredEvents();
/**
- * Return the number of unfiltered rows in the model (so, # of ALL rows)
+ * Returns the vector representing the row
* @return
*/
- public int getUnfilteredRowCount();
+ Vector getRow(int row);
/**
- * Adds a row to the model, and returns true if the new row in question
- * is accepted by the display Filter.
+ * Adds a row to the model
* @param row
* @param valueIsAdjusting
- * @return
- */
- public boolean isAddRow(Vector row, boolean valueIsAdjusting);
-
- /**
- * Returns true if Sorting is active/enabled
- * @return
+ * @return flag representing whether or not the row is being displayed (not
filtered)
*/
- public boolean isSortEnabled();
+ boolean isAddRow(Vector row, boolean valueIsAdjusting);
/**
- * Can be explicitly called to nudge all EventCountListeners
+ * Allow a forced notification of the EventCountListeners
*
*/
- public void notifyCountListeners();
-
- /**
- * Confitures the column index to sort on, and whether it's
- * ascending or descending
- * @param col
- * @param ascending
- */
- public void setCurrentSortColumn(int col, boolean ascending);
+ void notifyCountListeners();
/**
* Sets the DisplayFilter in operation
* @param displayFilter
*/
- public void setDisplayFilter(DisplayFilter displayFilter);
+ void setDisplayFilter(DisplayFilter displayFilter);
/**
- * Sets whether sorting is active/enabled
- * @param b
+ * Returns the index of the row
+ * @param row
*/
- public void setSortEnabled(boolean b);
+ int getRowIndex(Vector v);
- public int getRowIndex(Vector v);
-
/**
* Causes the EventContainer to sort according to it's configured attributes
- *
*/
- public void sort();
+ void sort();
- public String getDetailText(int selectedRow);
-
- public void fireTableDataChanged();
-
- public void addFilteredRow(Vector row);
+ /**
+ * Return the detail text - uses the selected columns defined in the display
filter
+ */
+ String getDetailText(int selectedRow);
}
1.15 +111 -89
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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ChainsawCyclicBufferTableModel.java 14 Jun 2003 16:48:14 -0000 1.14
+++ ChainsawCyclicBufferTableModel.java 14 Jun 2003 21:30:44 -0000 1.15
@@ -52,7 +52,6 @@
import org.apache.log4j.helpers.LogLog;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -65,12 +64,12 @@
/**
- * A CyclicBuffer implementation of the EventContainer.
- *
+ * A CyclicBuffer implementation of the EventContainer.
+ *
* NOTE: This implementation prevents duplicate rows from being added to the model.
- *
+ *
* Ignoring duplicates was added to support receivers which may attempt to deliver
the same
- * event more than once but can be safely ignored (for example, the database
receiver
+ * event more than once but can be safely ignored (for example, the database
receiver
* when set to retrieve in a loop).
*
* @author Paul Smith <[EMAIL PROTECTED]>
@@ -85,8 +84,9 @@
private boolean currentSortAscending;
private int currentSortColumn;
private DisplayFilter displayFilter;
- private final FilterChangeExecutor filterExecutor;
- private boolean sortEnabled;
+ private final FilterChangeExecutor filterExecutor =
+ new FilterChangeExecutor();
+ private boolean sortEnabled = false;
protected final Object syncLock = new Object();
//because we may be using a cyclic buffer, if an ID is not provided in the
property,
@@ -94,7 +94,6 @@
int uniqueRow;
public ChainsawCyclicBufferTableModel(boolean isCyclic, int bufferSize) {
- filterExecutor = new FilterChangeExecutor(this, syncLock);
if (isCyclic) {
unfilteredList = new CyclicBufferList(bufferSize);
filteredList = new CyclicBufferList(bufferSize);
@@ -112,54 +111,31 @@
SwingUtilities.invokeLater(filterExecutor);
}
- protected boolean getCurrentSortAscending() {
- return currentSortAscending;
- }
-
- protected int getCurrentSortColumn() {
- return currentSortColumn;
- }
-
- public DisplayFilter getDisplayFilter() {
- return displayFilter;
- }
-
public boolean isSortable(int col) {
return true;
}
- public boolean isSortEnabled() {
- return sortEnabled;
- }
-
public void notifyCountListeners() {
for (int i = 0; i < countListeners.size(); i++) {
((EventCountListener) countListeners.get(i)).eventCountChanged(
- getRowCount(), getUnfilteredRowCount());
+ filteredList.size(), unfilteredList.size());
}
}
- public void setCurrentSortColumn(int col, boolean ascending) {
- currentSortColumn = col;
- currentSortAscending = ascending;
- }
-
public void setDisplayFilter(DisplayFilter displayFilter) {
this.displayFilter = displayFilter;
}
- public void setSortEnabled(boolean sortEnabled) {
- this.sortEnabled = sortEnabled;
- }
-
/* (non-Javadoc)
* @see org.apache.log4j.chainsaw.EventContainer#sort()
*/
public void sort() {
- synchronized (syncLock) {
- Collections.sort(
- getSortableCollection(),
- new ColumnComparator(currentSortColumn, currentSortAscending));
+ if (sortEnabled) {
+ synchronized (syncLock) {
+ Collections.sort(
+ filteredList,
+ new ColumnComparator(currentSortColumn, currentSortAscending));
+ }
}
}
@@ -168,8 +144,7 @@
System.out.println(
"request to sort col=" + col + ", which is "
+ ChainsawColumns.getColumnsNames().get(col));
- SwingUtilities.invokeLater(
- new SortExecutor(this, this, table, col, row, ascending));
+ SwingUtilities.invokeLater(new SortExecutor(table, col, row, ascending));
}
/**
@@ -220,29 +195,6 @@
}
/* (non-Javadoc)
- * @see org.apache.log4j.chainsaw.EventContainer#addFilteredRow(java.util.Vector)
- */
- public void addFilteredRow(Vector row) {
- synchronized (syncLock) {
- filteredList.add(row);
- }
- }
-
- public void addRow(Vector row) {
- synchronized (syncLock) {
- unfilteredList.add(row);
- }
- }
-
- public void clearFilteredEvents() {
- synchronized (syncLock) {
- filteredList.clear();
- }
-
- fireTableDataChanged();
- }
-
- /* (non-Javadoc)
* @see org.apache.log4j.chainsaw.EventContainer#clear()
*/
public void clearModel() {
@@ -251,6 +203,7 @@
filteredList.clear();
uniqueRow = 0;
}
+
fireTableDataChanged();
notifyCountListeners();
}
@@ -337,7 +290,7 @@
return "";
}
- ListIterator iter = getDisplayFilter().getDetailColumns().listIterator();
+ ListIterator iter = displayFilter.getDetailColumns().listIterator();
String column = null;
int index = -1;
@@ -373,20 +326,8 @@
}
}
- protected List getSortableCollection() {
- return filteredList;
- }
-
- public Collection getUnfilteredEvents() {
- return unfilteredList;
- }
-
- public int getUnfilteredRowCount() {
- return unfilteredList.size();
- }
-
public Object getValueAt(int rowIndex, int columnIndex) {
- Vector row = getRow(rowIndex);
+ Vector row = (Vector) filteredList.get(rowIndex);
if (row == null) {
LogLog.error("Invalid rowindex=" + rowIndex);
@@ -400,7 +341,6 @@
boolean rowAdded = false;
synchronized (syncLock) {
-
//set the last field to the 'unfilteredevents size + 1 - an ID based on
reception order
int propertiesIndex =
ChainsawColumns.getColumnsNames().indexOf(
@@ -439,16 +379,15 @@
row.add(thisInt);
- //prevent duplicate rows
- if(unfilteredList.contains(row)) {
- return false;
- }
-
- addRow(row);
-
- if (
- (getDisplayFilter() == null) || (getDisplayFilter().isDisplayed(row))) {
- addFilteredRow(row);
+ //prevent duplicate rows
+ if (unfilteredList.contains(row)) {
+ return false;
+ }
+
+ unfilteredList.add(row);
+
+ if ((displayFilter == null) || (displayFilter.isDisplayed(row))) {
+ filteredList.add(row);
rowAdded = true;
}
@@ -457,7 +396,90 @@
if (!valueIsAdjusting) {
notifyCountListeners();
}
- fireTableRowsInserted(getRowIndex(row), getRowIndex(row));
+
+ int newRow = filteredList.indexOf(row);
+
+ fireTableRowsInserted(newRow, newRow);
+
return rowAdded;
+ }
+
+ class SortExecutor implements Runnable {
+ private JSortTable table;
+ private int col;
+ private int currentRow;
+ private boolean ascending;
+
+ /**
+ * Re-apply current sort column in the same order, and re-select the row.
+ */
+ public SortExecutor(
+ JSortTable table, int col, int currentRow, boolean ascending) {
+ this.table = table;
+ this.col = col;
+ this.currentRow = currentRow;
+ this.ascending = ascending;
+ }
+
+ public void run() {
+ synchronized (syncLock) {
+ Vector v = null;
+
+ if ((currentRow > -1) && (currentRow < filteredList.size())) {
+ v = (Vector) filteredList.get(currentRow);
+ }
+
+ sortEnabled = true;
+ currentSortColumn = col;
+ currentSortAscending = ascending;
+
+ if (col > -1) {
+ sort();
+ }
+
+ if (v == null) {
+ table.scrollToRow(
+ -1, table.columnAtPoint(table.getVisibleRect().getLocation()));
+ } else {
+ table.scrollToRow(
+ filteredList.indexOf(v),
+ table.columnAtPoint(table.getVisibleRect().getLocation()));
+ }
+ }
+ }
+ }
+
+ class FilterChangeExecutor implements Runnable {
+ /**
+ * Update filtered rows.
+ */
+ FilterChangeExecutor() {
+ }
+
+ public void run() {
+ synchronized (syncLock) {
+ filteredList.clear();
+
+ Vector v2 = null;
+ Iterator iter = unfilteredList.iterator();
+
+ while (iter.hasNext()) {
+ v2 = (Vector) iter.next();
+
+ if (displayFilter != null) {
+ if (displayFilter.isDisplayed(v2)) {
+ filteredList.add(v2);
+ }
+ }
+ }
+
+ if (sortEnabled) {
+ sort();
+ }
+ }
+
+ fireTableDataChanged();
+ notifyCountListeners();
+ }
}
}
1.7 +39 -92
jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/DisplayFilter.java
Index: DisplayFilter.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/DisplayFilter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DisplayFilter.java 3 Jun 2003 06:32:57 -0000 1.6
+++ DisplayFilter.java 14 Jun 2003 21:30:44 -0000 1.7
@@ -49,6 +49,8 @@
package org.apache.log4j.chainsaw;
+import org.apache.log4j.chainsaw.prefs.SettingsManager;
+
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
@@ -66,8 +68,6 @@
import java.util.List;
import java.util.Vector;
-import org.apache.log4j.chainsaw.prefs.SettingsManager;
-
/**
* If there are no filters defined, null is returned for color (the table
background should then be used).
@@ -85,40 +85,40 @@
private transient DisplayFilterEntry customFilter;
private transient boolean customFilterOverride = false;
private List colNames = ChainsawColumns.getColumnsNames();
- private Vector toolTipColumns;
+ private Vector toolTipDetailColumns;
private Boolean toolTipsEnabled = Boolean.FALSE;
private String ident;
public DisplayFilter(String ident) {
- this.ident = ident;
- toolTipColumns = new Vector(colNames);
+ this.ident = ident;
+ toolTipDetailColumns = new Vector(colNames);
}
public void save() {
- ObjectOutputStream o2 = null;
+ ObjectOutputStream o2 = null;
- try {
- o2 =
- new ObjectOutputStream(
- new BufferedOutputStream(
- new FileOutputStream(
- new File(
- SettingsManager.getInstance().getSettingsDirectory()
- + File.separator + ident
- + ChainsawConstants.SETTINGS_EXTENSION))));
- o2.writeObject(this);
- o2.flush();
- } catch (FileNotFoundException fnfe) {
- } catch (IOException ioe) {
- ioe.printStackTrace();
- }
-
- try {
- if (o2 != null) {
- o2.close();
- }
- } catch (IOException ioe) {
+ try {
+ o2 =
+ new ObjectOutputStream(
+ new BufferedOutputStream(
+ new FileOutputStream(
+ new File(
+ SettingsManager.getInstance().getSettingsDirectory()
+ + File.separator + ident
+ + ChainsawConstants.SETTINGS_EXTENSION))));
+ o2.writeObject(this);
+ o2.flush();
+ } catch (FileNotFoundException fnfe) {
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+
+ try {
+ if (o2 != null) {
+ o2.close();
}
+ } catch (IOException ioe) {
+ }
}
public void setCustomFilterOverride(boolean customFilterOverride) {
@@ -139,8 +139,9 @@
customFilter.matches(
customFilter.getColumnName(),
formatField(v.get(colNames.indexOf(customFilter.getColumnName())))
- .toString(), (String)
v.get(colNames.indexOf(ChainsawConstants.LEVEL_COL_NAME)))) {
- passesCustomFilter = customFilter.getDisplay().booleanValue();
+ .toString(),
+ (String) v.get(colNames.indexOf(ChainsawConstants.LEVEL_COL_NAME)))) {
+ passesCustomFilter = true;
} else {
passesCustomFilter = false;
}
@@ -157,12 +158,14 @@
while (iter.hasNext()) {
DisplayFilterEntry entry = (DisplayFilterEntry) iter.next();
+
if (
entry.matches(
entry.getColumnName(),
(String) v.get(colNames.indexOf(entry.getColumnName())),
- (String) v.get(colNames.indexOf(ChainsawConstants.LEVEL_COL_NAME)))) {
- return passesCustomFilter && entry.getDisplay().booleanValue();
+ (String) v.get(
+ colNames.indexOf(ChainsawConstants.LEVEL_COL_NAME)))) {
+ return passesCustomFilter;
}
}
@@ -171,7 +174,7 @@
}
public void setDetailColumns(Vector v) {
- toolTipColumns = v;
+ toolTipDetailColumns = v;
notifyListeners();
}
@@ -184,21 +187,7 @@
}
public Vector getDetailColumns() {
- return toolTipColumns;
-
- //was previously filtering out detail columns for only displayed columns
-
- /*
- Vector displayedToolTips = new Vector();
- ListIterator iter = toolTipColumns.listIterator();
- while (iter.hasNext()) {
- String colName = (String) iter.next();
- if (displayedColumns.contains(colName)) {
- displayedToolTips.add(colName);
- }
- }
- return displayedToolTips;
- */
+ return toolTipDetailColumns;
}
public void addFilterChangedListener(FilterChangedListener listener) {
@@ -223,48 +212,6 @@
}
}
- public synchronized void addFilter(DisplayFilterEntry entry) {
- Iterator iter = filters.iterator();
- DisplayFilterEntry removable = null;
-
- while (iter.hasNext()) {
- DisplayFilterEntry entry2 = (DisplayFilterEntry) iter.next();
-
- if (
- (entry2.getColumnName().equals(entry.getColumnName()))
- && (entry.getColumnValue().equals(entry2.getColumnValue()))) {
- removable = entry;
- }
- }
-
- if (removable != null) {
- filters.remove(removable);
- }
-
- if (!filters.contains(entry)) {
- filters.add(entry);
- }
-
- notifyListeners();
- }
-
- public synchronized void clear(String column) {
- Iterator iter = filters.iterator();
- Vector removable = new Vector();
-
- while (iter.hasNext()) {
- DisplayFilterEntry entry = (DisplayFilterEntry) iter.next();
-
- if (entry.getColumnName().equals(column)) {
- removable.add(entry);
- }
- }
-
- filters.removeAll(removable);
-
- notifyListeners();
- }
-
public synchronized void clear() {
filters.clear();
notifyListeners();
@@ -318,9 +265,9 @@
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
ident = (String) in.readObject();
- toolTipColumns = (Vector) in.readObject();
+ toolTipDetailColumns = (Vector) in.readObject();
toolTipsEnabled = (Boolean) in.readObject();
- colNames = ChainsawColumns.getColumnsNames();
+ colNames = ChainsawColumns.getColumnsNames();
filterListeners = new Vector();
filters = new Vector();
customFilterOverride = false;
@@ -329,7 +276,7 @@
private void writeObject(java.io.ObjectOutputStream out)
throws IOException {
out.writeObject(ident);
- out.writeObject(toolTipColumns);
+ out.writeObject(toolTipDetailColumns);
out.writeObject(toolTipsEnabled);
}
}
1.6 +8 -8
jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ColorDisplaySelector.java
Index: ColorDisplaySelector.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ColorDisplaySelector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ColorDisplaySelector.java 10 Jun 2003 19:38:19 -0000 1.5
+++ ColorDisplaySelector.java 14 Jun 2003 21:30:44 -0000 1.6
@@ -371,7 +371,7 @@
;
addDisplayFilter(
new DisplayFilterEntry(
- selectedColumn, selectedValue, level, Boolean.TRUE));
+ selectedColumn, selectedValue, level));
}
} else {
if ((selectedValue != null) && (selectedColumn != null)) {
@@ -381,7 +381,7 @@
;
removeDisplayFilter(
new DisplayFilterEntry(
- selectedColumn, selectedValue, level, Boolean.TRUE));
+ selectedColumn, selectedValue, level));
}
}
@@ -420,11 +420,11 @@
if (box.isSelected()) {
addDisplayFilter(
new DisplayFilterEntry(
- selectedColumn, level, level, Boolean.TRUE));
+ selectedColumn, level, level));
} else {
removeDisplayFilter(
new DisplayFilterEntry(
- selectedColumn, level, level, Boolean.TRUE));
+ selectedColumn, level, level));
}
} else {
if (box.isSelected()) {
@@ -879,7 +879,7 @@
String thisValue = (String) iter.next();
DisplayFilterEntry entry =
new DisplayFilterEntry(
- selectedColumn, thisValue, level, Boolean.TRUE);
+ selectedColumn, thisValue, level);
if (!v.contains(entry)) {
addDisplayFilter(entry);
@@ -898,7 +898,7 @@
String thisValue = (String) iter.next();
DisplayFilterEntry entry =
new DisplayFilterEntry(
- selectedColumn, thisValue, level, Boolean.TRUE);
+ selectedColumn, thisValue, level);
if (v.contains(entry)) {
removeDisplayFilter(entry);
@@ -952,7 +952,7 @@
DisplayFilterEntry entry = (DisplayFilterEntry) iter.next();
if (entry.matches(selectedColumn, selectedValue, level)) {
- selectedFlag = entry.getDisplay().booleanValue();
+ selectedFlag = true;
}
}
}
@@ -994,7 +994,7 @@
if (selectedColumn.equalsIgnoreCase(LEVEL_COL_NAME)) {
DisplayFilterEntry entry =
new DisplayFilterEntry(
- selectedColumn, currentLevel, currentLevel, Boolean.TRUE);
+ selectedColumn, currentLevel, currentLevel);
if (((Vector) columnDisplayMap.get(selectedColumn)).contains(entry)) {
selected = true;
1.3 +1 -17
jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ColorFilter.java
Index: ColorFilter.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ColorFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ColorFilter.java 26 May 2003 04:42:39 -0000 1.2
+++ ColorFilter.java 14 Jun 2003 21:30:44 -0000 1.3
@@ -171,22 +171,6 @@
return color;
}
- //go through all of the filters..if a filter matches for the column and
expression, return color
- public synchronized Color getColor(String column, String expression) {
- Color color = null;
- Iterator iter = filters.iterator();
-
- while (iter.hasNext()) {
- FilterEntry entry = (FilterEntry) iter.next();
-
- if (entry.matches(column, expression)) {
- return entry.getColor();
- }
- }
-
- return color;
- }
-
class FilterEntry {
private final String columnName;
private final String regExp;
@@ -260,4 +244,4 @@
+ color;
}
}
-}
+}
\ No newline at end of file
1.10 +9 -2 jakarta-log4j-sandbox/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j-sandbox/build.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- build.xml 11 Jun 2003 05:57:50 -0000 1.9
+++ build.xml 14 Jun 2003 21:30:45 -0000 1.10
@@ -266,9 +266,16 @@
<javadoc sourcepath="${java.source.dir}"
destdir="${javadoc.dest}"
- packagenames="org.apache.log4j.filter,
+ packagenames="org.apache.log4j,
+ org.apache.log4j.chainsaw,
+ org.apache.log4j.filter,
+ org.apache.log4j.helpers,
+ org.apache.log4j.jdbc,
+ org.apache.log4j.net,
+ org.apache.log4j.plugins,
org.apache.log4j.selector,
- org.apache.log4j.servlet"
+ org.apache.log4j.servlet,
+ org.apache.log4j.xml"
version="true"
protected="true"
author="true"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]