sdeboy 2004/05/16 23:17:59
Modified: src/java/org/apache/log4j/chainsaw
ChainsawCyclicBufferTableModel.java LogPanel.java
LogUI.java ApplicationPreferenceModelPanel.java
ApplicationPreferenceModel.java
src/java/org/apache/log4j/chainsaw/prefs default.properties
src/java/org/apache/log4j/chainsaw/help release-notes.html
Log:
Added 'cyclic buffer size' as an application property
Changing between tabs now updates detail panel accordingly
Updated release notes (should happen with each commit)
Revision Changes Path
1.30 +16 -23
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.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- ChainsawCyclicBufferTableModel.java 12 May 2004 06:37:30 -0000 1.29
+++ ChainsawCyclicBufferTableModel.java 17 May 2004 06:17:59 -0000 1.30
@@ -55,12 +55,11 @@
class ChainsawCyclicBufferTableModel extends AbstractTableModel
implements EventContainer, PropertyChangeListener {
private static final int DEFAULT_CAPACITY = 5000;
- private static final String PANEL_CAPACITY = "CHAINSAW_CAPACITY";
private boolean cyclic = true;
- private int capacity = DEFAULT_CAPACITY;
+ private int cyclicBufferSize = DEFAULT_CAPACITY;
List unfilteredList;
List filteredList;
- Set idSet = new HashSet(capacity);
+ Set idSet = new HashSet(cyclicBufferSize);
private boolean currentSortAscending;
private int currentSortColumn;
private EventListenerList eventListenerList = new EventListenerList();
@@ -80,18 +79,12 @@
private PropertyChangeSupport propertySupport =
new PropertyChangeSupport(this);
- public ChainsawCyclicBufferTableModel() {
+ public ChainsawCyclicBufferTableModel(int cyclicBufferSize) {
propertySupport.addPropertyChangeListener("cyclic", new ModelChanger());
+ this.cyclicBufferSize = cyclicBufferSize;
- if (System.getProperty(PANEL_CAPACITY) != null) {
- try {
- capacity = Integer.parseInt(System.getProperty(PANEL_CAPACITY));
- } catch (NumberFormatException nfe) {
- }
- }
-
- unfilteredList = new CyclicBufferList(capacity);
- filteredList = new CyclicBufferList(capacity);
+ unfilteredList = new CyclicBufferList(cyclicBufferSize);
+ filteredList = new CyclicBufferList(cyclicBufferSize);
}
/* (non-Javadoc)
@@ -480,16 +473,16 @@
if (cyclic) {
if (!reachedCapacity) {
//if we didn't loop and it's the 1st time, insert
- if ((begin + count) < capacity) {
+ if ((begin + count) < cyclicBufferSize) {
fireTableRowsInserted(begin, end);
} else {
//we did loop - insert and then update rows
- fireTableRowsInserted(begin, capacity);
- fireTableRowsUpdated(0, capacity);
+ fireTableRowsInserted(begin, cyclicBufferSize);
+ fireTableRowsUpdated(0, cyclicBufferSize);
reachedCapacity = true;
}
} else {
- fireTableRowsUpdated(0, capacity);
+ fireTableRowsUpdated(0, cyclicBufferSize);
}
} else {
fireTableRowsInserted(begin, end);
@@ -521,7 +514,7 @@
* @return
*/
public int getMaxSize() {
- return capacity;
+ return cyclicBufferSize;
}
/* (non-Javadoc)
@@ -614,14 +607,14 @@
List newFilteredList = null;
HashSet newIDSet = null;
- newIDSet = new HashSet(capacity);
+ newIDSet = new HashSet(cyclicBufferSize);
if (isCyclic()) {
- newUnfilteredList = new CyclicBufferList(capacity);
- newFilteredList = new CyclicBufferList(capacity);
+ newUnfilteredList = new CyclicBufferList(cyclicBufferSize);
+ newFilteredList = new CyclicBufferList(cyclicBufferSize);
} else {
- newUnfilteredList = new ArrayList(capacity);
- newFilteredList = new ArrayList(capacity);
+ newUnfilteredList = new ArrayList(cyclicBufferSize);
+ newFilteredList = new ArrayList(cyclicBufferSize);
}
int increment = 0;
1.72 +16 -3 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.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- LogPanel.java 13 May 2004 06:16:50 -0000 1.71
+++ LogPanel.java 17 May 2004 06:17:59 -0000 1.72
@@ -27,6 +27,8 @@
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
@@ -228,12 +230,11 @@
* @param statusBar shared status bar, provided by main application
* @param identifier used to load and save settings
*/
- public LogPanel(final ChainsawStatusBar statusBar, final String identifier) {
+ public LogPanel(final ChainsawStatusBar statusBar, final String identifier, int
cyclicBufferSize) {
this.identifier = identifier;
this.statusBar = statusBar;
setLayout(new BorderLayout());
-
scroll = true;
findPanel = new JPanel();
@@ -553,7 +554,7 @@
/*
*End of preferenceModel listeners
*/
- tableModel = new ChainsawCyclicBufferTableModel();
+ tableModel = new ChainsawCyclicBufferTableModel(cyclicBufferSize);
table = new JSortTable(tableModel);
//add a listener to update the 'refine focus'
tableModel.addNewKeyListener(new NewKeyListener() {
@@ -916,6 +917,18 @@
detail.setEditable(false);
detailPaneUpdater = new DetailPaneUpdater();
+
+ addFocusListener(new FocusListener() {
+
+ public void focusGained(FocusEvent e) {
+ detailPaneUpdater.updateDetailPane();
+ }
+
+ public void focusLost(FocusEvent e) {
+
+ }
+ });
+
addPropertyChangeListener(
"detailPaneConversionPattern", detailPaneUpdater);
1.95 +5 -1 logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
Index: LogUI.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- LogUI.java 15 May 2004 06:32:44 -0000 1.94
+++ LogUI.java 17 May 2004 06:17:59 -0000 1.95
@@ -155,6 +155,7 @@
DEFAULT_MAIN_RECEIVER_SPLIT_LOCATION;
private final List identifierPanels = new ArrayList();
private int dividerSize;
+ private int cyclicBufferSize;
/**
* Set to true, if and only if the GUI has completed it's full
@@ -258,6 +259,7 @@
if (model.isShowSplash()) {
showSplash(logUI);
}
+ logUI.cyclicBufferSize = model.getCyclicBufferSize();
logUI.handler = new ChainsawAppenderHandler();
logUI.handler.addEventBatchListener(logUI.new NewTabEventBatchReceiver());
@@ -304,6 +306,8 @@
public void activateViewer(ChainsawAppender appender) {
ApplicationPreferenceModel model = new ApplicationPreferenceModel();
SettingsManager.getInstance().configure(model);
+
+ cyclicBufferSize = model.getCyclicBufferSize();
applyLookAndFeel(model.getLookAndFeelClassName());
handler = new ChainsawAppenderHandler(appender);
@@ -1715,7 +1719,7 @@
private void buildLogPanel(
boolean customExpression, final String ident, final List eventBatchEntrys)
throws IllegalArgumentException {
- final LogPanel thisPanel = new LogPanel(getStatusBar(), ident);
+ final LogPanel thisPanel = new LogPanel(getStatusBar(), ident,
cyclicBufferSize);
/**
* Now add the panel as a batch listener so it can handle it's own
1.14 +31 -4
logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
Index: ApplicationPreferenceModelPanel.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ApplicationPreferenceModelPanel.java 20 Apr 2004 00:39:40 -0000 1.13
+++ ApplicationPreferenceModelPanel.java 17 May 2004 06:17:59 -0000 1.14
@@ -61,7 +61,8 @@
private ApplicationPreferenceModel uncommittedPreferenceModel =
new ApplicationPreferenceModel();
private JTextField identifierExpression;
- private JTextField toolTipDisplayMillis;
+ private JTextField toolTipDisplayMillis;
+ private JTextField cyclicBufferSize;
private final JTextField configurationURL = new JTextField(25);
ApplicationPreferenceModelPanel(ApplicationPreferenceModel model) {
@@ -79,6 +80,12 @@
uncommittedPreferenceModel.setToolTipDisplayMillis(millis);
}
} catch (NumberFormatException nfe) {}
+ try {
+ int bufferSize = Integer.parseInt(cyclicBufferSize.getText());
+ if (bufferSize >= 0) {
+ uncommittedPreferenceModel.setCyclicBufferSize(bufferSize);
+ }
+ } catch (NumberFormatException nfe) {}
committedPreferenceModel.apply(uncommittedPreferenceModel);
hidePanel();
}
@@ -370,7 +377,7 @@
identifierExpression = new JTextField(20);
toolTipDisplayMillis = new JTextField(8);
-
+ cyclicBufferSize = new JTextField(8);
Box p = new Box(BoxLayout.X_AXIS);
p.add(showNoReceiverWarning);
@@ -412,11 +419,23 @@
JPanel p5 = new JPanel(new FlowLayout(FlowLayout.LEFT));
- p5.add(new JLabel("Automatic Configuration"));
+ p5.add(new JLabel("Cyclic buffer size"));
p5.add(Box.createHorizontalStrut(5));
- p5.add(configurationURL);
+ p5.add(cyclicBufferSize);
add(p5);
+ JPanel p6 = new JPanel(new FlowLayout(FlowLayout.LEFT));
+
+ p6.add(new JLabel("Automatic Configuration"));
+ p6.add(Box.createHorizontalStrut(5));
+ p6.add(configurationURL);
+ add(p6);
+
+ JPanel p7 = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ p7.add(
+ new JLabel(
+ "Cyclic buffer size change will apply the next time you start Chainsaw"));
+ add(p7);
add(Box.createVerticalGlue());
@@ -498,6 +517,14 @@
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
toolTipDisplayMillis.setText(evt.getNewValue().toString());
+ }
+ });
+
+ uncommittedPreferenceModel.addPropertyChangeListener(
+ "cyclicBufferSize",
+ new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ cyclicBufferSize.setText(evt.getNewValue().toString());
}
});
1.19 +14 -2
logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
Index: ApplicationPreferenceModel.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ApplicationPreferenceModel.java 14 May 2004 03:21:13 -0000 1.18
+++ ApplicationPreferenceModel.java 17 May 2004 06:17:59 -0000 1.19
@@ -40,9 +40,8 @@
private boolean showSplash;
private String lookAndFeelClassName;
private int toolTipDisplayMillis;
+ private int cyclicBufferSize;
private String lastUsedVersion;
-
-
private int responsiveness;
private String identifierExpression = Constants.HOSTNAME_KEY + " - " +
Constants.APPLICATION_KEY;
@@ -129,6 +128,16 @@
return identifierExpression;
}
+ public final void setCyclicBufferSize(int newCyclicBufferSize) {
+ int oldCyclicBufferSize = cyclicBufferSize;
+ cyclicBufferSize = newCyclicBufferSize;
+ firePropertyChange("cyclicBufferSize", oldCyclicBufferSize,
newCyclicBufferSize);
+ }
+
+ public final int getCyclicBufferSize() {
+ return cyclicBufferSize;
+ }
+
public final void setToolTipDisplayMillis(int newToolTipDisplayMillis) {
int oldToolTipDisplayMillis = toolTipDisplayMillis;
toolTipDisplayMillis = newToolTipDisplayMillis;
@@ -169,6 +178,7 @@
setConfirmExit(event.asBoolean("confirmExit"));
setShowSplash(event.asBoolean("showSplash"));
setToolTipDisplayMillis(event.asInt("toolTipDisplayMillis"));
+ setCyclicBufferSize(event.asInt("cyclicBufferSize"));
setConfigurationURL(event.getSetting("configurationURL"));
setLastUsedVersion(event.getSetting("lastUsedVersion"));
}
@@ -188,6 +198,7 @@
event.saveSetting("confirmExit",isConfirmExit());
event.saveSetting("showSplash", isShowSplash());
event.saveSetting("toolTipDisplayMillis", getToolTipDisplayMillis());
+ event.saveSetting("cyclicBufferSize", getCyclicBufferSize());
event.saveSetting("configurationURL", getConfigurationURL());
event.saveSetting("lastUsedVersion", getLastUsedVersion());
}
@@ -209,6 +220,7 @@
setConfirmExit(model.isConfirmExit());
setShowSplash(model.isShowSplash());
setToolTipDisplayMillis(model.getToolTipDisplayMillis());
+ setCyclicBufferSize(model.getCyclicBufferSize());
setConfigurationURL(model.getConfigurationURL());
setLastUsedVersion(model.getLastUsedVersion());
}
1.18 +1 -0
logging-log4j/src/java/org/apache/log4j/chainsaw/prefs/default.properties
Index: default.properties
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/prefs/default.properties,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- default.properties 14 May 2004 03:21:13 -0000 1.17
+++ default.properties 17 May 2004 06:17:59 -0000 1.18
@@ -26,6 +26,7 @@
toolTipDisplayMillis=4000
configurationURL=
lastUsedVersion=
+cyclicBufferSize=5000
# These are the default LogPanel settings
dateFormatPattern=ISO8601
1.3 +7 -0
logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html
Index: release-notes.html
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- release-notes.html 14 May 2004 06:57:50 -0000 1.2
+++ release-notes.html 17 May 2004 06:17:59 -0000 1.3
@@ -8,6 +8,13 @@
<h2>Release Notes</h2>
<h3>v1.99.99 (pre-log4j 1.3 Alpha)</h3>
+<h2>16 May 2004</h2>
+<ul>
+ <li>Added 'cyclic buffer size' as an application property</li>
+ <li>Changing between tabs now updates detail panel accordingly</li>
+</ul>
+
+<h2>13 May 2004</h2>
<ul>
<li>The first version we decided we needed to have some release notes in... :)
<li>Fix for LoggingEvent class - connecting Chainsaw v2 to a remote log4j1.2.x
caused a NullPointerException
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]