psmith 2003/08/31 19:07:14
Modified: src/java/org/apache/log4j/chainsaw LogUI.java
Log:
Table model is notified of new logger/category names arriving in the batch.
LogPanel now contains a new JTree component that
sits to the West of the Events panel, sizeable via a Split Pane and
scroll bar.
As of this version the tree does nothing but display
the Logger hierarchy in tree form, with no functionality
but Right click popup menu is coming to set levels, filters etc.
Right now I am not 100% certain whether it should stay
where it is sittingbut regardless the component
should be used somewhere (another thought is
in the Preferences area).
IMHO, I think it's useful where it sits, but any feedback appreciated.
Revision Changes Path
1.9 +31 -7 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
Index: LogUI.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- LogUI.java 28 Aug 2003 05:39:04 -0000 1.8
+++ LogUI.java 1 Sep 2003 02:07:14 -0000 1.9
@@ -139,6 +139,7 @@
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JToolBar;
+import javax.swing.JTree;
import javax.swing.JWindow;
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
@@ -153,6 +154,8 @@
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableColumnModelListener;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
@@ -1219,10 +1222,17 @@
//also add it to the unique values list
((Set) map.get(ChainsawConstants.LEVEL_COL_NAME)).add(level);
- ((Set) map.get(ChainsawConstants.LOGGER_COL_NAME)).add(
- v.get(
- ChainsawColumns.getColumnsNames().indexOf(
- ChainsawConstants.LOGGER_COL_NAME)));
+ Object loggerName = v.get(
+ ChainsawColumns.getColumnsNames().indexOf(
+ ChainsawConstants.LOGGER_COL_NAME));
+ ((Set) map.get(ChainsawConstants.LOGGER_COL_NAME)).add(loggerName);
+
+
+ /**
+ * EventContainer is a LoggerNameModel imp, use that for notifing
+ */
+ tableModel.addLoggerName(loggerName.toString());
+
((Set) map.get(ChainsawConstants.THREAD_COL_NAME)).add(
v.get(
ChainsawColumns.getColumnsNames().indexOf(
@@ -1348,7 +1358,7 @@
Set fileSet = new HashSet();
Set levelSet = new HashSet();
ScrollToBottom scrollToBottom;
-
+ private final LogPanelLoggerTreeModel logTreeModel = new
LogPanelLoggerTreeModel();
//used for consistency - stays empty - used to allow none set in the
colordisplay selector and right click
Set noneSet = new HashSet();
Point currentPoint;
@@ -1361,6 +1371,9 @@
this.scrollToBottom = scrollToBottom;
this.tableModel = tableModel;
this.table = table;
+
+ tableModel.addLoggerNameListener(logTreeModel);
+
levelSet = new HashSet((List) levelMap.get(eventType));
map.put(ChainsawConstants.LEVEL_COL_NAME, levelSet);
@@ -1648,6 +1661,9 @@
statusLabelPanel.add(upperPanel, BorderLayout.CENTER);
eventsAndStatusPanel.add(statusLabelPanel, BorderLayout.NORTH);
+ final JTree logTree = new LoggerNameTree(logTreeModel);
+ final JScrollPane logTreeScroll = new JScrollPane(logTree);
+
final JPanel detailPanel = new JPanel(new BorderLayout());
//set valueisadjusting if holding down a key - don't process setdetail events
@@ -1691,8 +1707,16 @@
}
});
- // add(upperPanel, BorderLayout.NORTH);
- add(lowerPanel, BorderLayout.CENTER);
+
+ JSplitPane nameTreeAndMainPanelSplit = new
JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+ nameTreeAndMainPanelSplit.add(logTreeScroll);
+ nameTreeAndMainPanelSplit.add(lowerPanel);
+ nameTreeAndMainPanelSplit.setOneTouchExpandable(true);
+ nameTreeAndMainPanelSplit.setToolTipText("Still under development....");
+ nameTreeAndMainPanelSplit.setDividerLocation(120);
+
+ add(nameTreeAndMainPanelSplit, BorderLayout.CENTER);
+// add(lowerPanel, BorderLayout.CENTER);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]