logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r1030846 - in /logging/chainsaw/trunk/src/main: java/org/apache/log4j/chainsaw/ resources/org/apache/log4j/chainsaw/ resources/org/apache/log4j/chainsaw/help/
Date Thu, 04 Nov 2010 07:14:03 GMT
Author: sdeboy
Date: Thu Nov  4 07:14:03 2010
New Revision: 1030846

URL: http://svn.apache.org/viewvc?rev=1030846&view=rev
Log:
Added ability to define which columns are displayed by default when a new tab is created by
clicking the 'Use selected columns as default visible columns' button on the logpanel preferences
column selection screen
Also updated Welcome panel to make the keyboard shortcut table 100% width

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java
    logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html
    logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java?rev=1030846&r1=1030845&r2=1030846&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
Thu Nov  4 07:14:03 2010
@@ -19,6 +19,8 @@ package org.apache.log4j.chainsaw;
 import java.awt.Color;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Vector;
 
 import javax.swing.UIManager;
@@ -71,8 +73,10 @@ public class ApplicationPreferenceModel 
      */
     private boolean okToRemoveSecurityManager = false;
     private static final int CONFIGURATION_URL_ENTRY_COUNT = 10;
+    private List defaultColumnNames = new ArrayList();
+    private boolean defaultColumnsSet;
 
-    /**
+  /**
      * @param listener
      */
     public void addPropertyChangeListener(PropertyChangeListener listener) {
@@ -227,6 +231,9 @@ public class ApplicationPreferenceModel 
         setAlternatingBackgroundColor(alternatingBackground);
         setAlternatingForegroundColor(alternatingForeground);
       }
+      if (model.isDefaultColumnsSet()) {
+        setDefaultColumnNames(model.getDefaultColumnNames());
+      }
     }
 
     //use a lighter version of search color as the delta color
@@ -497,4 +504,18 @@ public class ApplicationPreferenceModel 
         this.okToRemoveSecurityManager = okToRemoveSecurityManager;
         firePropertyChange("okToRemoveSecurityManager", oldValue, this.okToRemoveSecurityManager);
 	}
+
+  public void setDefaultColumnNames(List defaultColumnNames) {
+    defaultColumnsSet = true;
+    this.defaultColumnNames.clear();
+    this.defaultColumnNames.addAll(defaultColumnNames);
+  }
+
+  public boolean isDefaultColumnsSet() {
+    return defaultColumnsSet;
+  }
+
+  public List getDefaultColumnNames() {
+    return defaultColumnNames;
+  }
 }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?rev=1030846&r1=1030845&r2=1030846&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java Thu Nov 
4 07:14:03 2010
@@ -227,7 +227,8 @@ public class LogPanel extends DockablePa
   private final JSplitPane nameTreeAndMainPanelSplit;
   private final LoggerNameTreePanel logTreePanel;
   private final LogPanelPreferenceModel preferenceModel = new LogPanelPreferenceModel();
-  private final LogPanelPreferencePanel logPanelPreferencesPanel = new LogPanelPreferencePanel(preferenceModel);
+  private ApplicationPreferenceModel applicationPreferenceModel;
+  private final LogPanelPreferencePanel logPanelPreferencesPanel;
   private final FilterModel filterModel = new FilterModel();
   private final RuleColorizer colorizer = new RuleColorizer();
   private final RuleMediator tableRuleMediator = new RuleMediator(false);
@@ -252,7 +253,6 @@ public class LogPanel extends DockablePa
   private AutoFilterComboBox findCombo;
   private JScrollPane eventsPane;
   private int currentSearchMatchCount;
-  private ApplicationPreferenceModel applicationPreferenceModel;
   private Rule clearTableExpressionRule;
   private int lowerPanelDividerLocation;
   private EventContainer searchModel;
@@ -278,10 +278,11 @@ public class LogPanel extends DockablePa
    * @param identifier used to load and save settings
    */
   public LogPanel(final ChainsawStatusBar statusBar, final String identifier, int cyclicBufferSize,
-                  Map allColorizers, ApplicationPreferenceModel applicationPreferenceModel)
{
+                  Map allColorizers, final ApplicationPreferenceModel applicationPreferenceModel)
{
     this.identifier = identifier;
     this.statusBar = statusBar;
     this.applicationPreferenceModel = applicationPreferenceModel;
+    this.logPanelPreferencesPanel = new LogPanelPreferencePanel(preferenceModel, applicationPreferenceModel);
     logger.debug("creating logpanel for " + identifier);
 
     setLayout(new BorderLayout());
@@ -1034,9 +1035,12 @@ public class LogPanel extends DockablePa
           col.setHeaderValue(e.getKey());
 
           if (preferenceModel.addColumn(col)) {
-        	  table.addColumn(col);
-              searchTable.addColumn(col);
-        	  preferenceModel.setColumnVisible(e.getKey().toString(), true);
+            if (preferenceModel.isColumnVisible(col) || !applicationPreferenceModel.isDefaultColumnsSet()
|| applicationPreferenceModel.isDefaultColumnsSet() &&
+                applicationPreferenceModel.getDefaultColumnNames().contains(col.getHeaderValue()))
{
+              table.addColumn(col);
+                searchTable.addColumn(col);
+          	  preferenceModel.setColumnVisible(e.getKey().toString(), true);
+            }
           }
         		}
         	});
@@ -3138,9 +3142,12 @@ public class LogPanel extends DockablePa
     for (Iterator iter = sortedColumnList.iterator(); iter.hasNext();) {
       TableColumn element = (TableColumn) iter.next();
       if (preferenceModel.addColumn(element)) {
-          table.addColumn(element);
-          searchTable.addColumn(element);
-    	  preferenceModel.setColumnVisible(element.getHeaderValue().toString(), true);
+          if (!applicationPreferenceModel.isDefaultColumnsSet() || applicationPreferenceModel.isDefaultColumnsSet()
&&
+              applicationPreferenceModel.getDefaultColumnNames().contains(element.getHeaderValue()))
{
+            table.addColumn(element);
+            searchTable.addColumn(element);
+            preferenceModel.setColumnVisible(element.getHeaderValue().toString(), true);
+          }
       }
     }
 

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java?rev=1030846&r1=1030845&r2=1030846&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java
Thu Nov  4 07:14:03 2010
@@ -25,6 +25,7 @@ import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
@@ -33,6 +34,7 @@ import javax.swing.BorderFactory;
 import javax.swing.Box;
 import javax.swing.BoxLayout;
 import javax.swing.ButtonGroup;
+import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JEditorPane;
 import javax.swing.JFrame;
@@ -64,12 +66,14 @@ public class LogPanelPreferencePanel ext
   private final LogPanelPreferenceModel preferenceModel;
   private final ModifiableListModel columnListModel = new ModifiableListModel();
   private static final Logger logger = LogManager.getLogger(LogPanelPreferencePanel.class);
+  private ApplicationPreferenceModel appPreferenceModel;
 
   //~ Constructors ============================================================
 
-  public LogPanelPreferencePanel(LogPanelPreferenceModel model)
+  public LogPanelPreferencePanel(LogPanelPreferenceModel model, ApplicationPreferenceModel
appModel)
   {
     preferenceModel = model;
+    appPreferenceModel = appModel;
     initComponents();
 
     getOkButton().addActionListener(new ActionListener()
@@ -100,7 +104,8 @@ public class LogPanelPreferencePanel ext
   {
     JFrame f = new JFrame("Preferences Panel Test Bed");
     LogPanelPreferenceModel model = new LogPanelPreferenceModel();
-    LogPanelPreferencePanel panel = new LogPanelPreferencePanel(model);
+    ApplicationPreferenceModel appModel = new ApplicationPreferenceModel();
+    LogPanelPreferencePanel panel = new LogPanelPreferencePanel(model, appModel);
     f.getContentPane().add(panel);
 
     model.addPropertyChangeListener(new PropertyChangeListener()
@@ -214,9 +219,21 @@ public class LogPanelPreferencePanel ext
               }
           }
         });
+      JButton setAsDefaultsButton = new JButton("Use selected columns as default visible
columns");
+      setAsDefaultsButton.addActionListener(new ActionListener() {
+        public void actionPerformed(ActionEvent actionEvent) {
+          List selectedColumns = new ArrayList();
+          for (int i = 0;i<columnListModel.getSize();i++) {
+            if (preferenceModel.isColumnVisible((TableColumn) columnListModel.get(i))) {
+              selectedColumns.add(((TableColumn)columnListModel.get(i)).getHeaderValue());
+            }
+          }
+          appPreferenceModel.setDefaultColumnNames(selectedColumns);
+        }
+      });
       columnList.setCellRenderer(cellRenderer);
       columnBox.add(new JScrollPane(columnList));
-
+      columnBox.add(setAsDefaultsButton);
       add(columnBox);
       add(Box.createVerticalGlue());
     }

Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html?rev=1030846&r1=1030845&r2=1030846&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html
(original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/WelcomePanel.html
Thu Nov  4 07:14:03 2010
@@ -41,107 +41,82 @@
 <tr><td><a href="#FilteringColouring">Filtering and Colouring</a></td></tr>
 </table>
 -->
-<p><table border="0" cellspacing="2" cellpadding="2" >
+<p><table border="0" cellspacing="2" cellpadding="2" width=100%>
 <tr><td colspan="6" class="TableTitle" bgcolor="#000089"><font color="white">Hot
Keys</font></td></tr>
 <tr valign="top">
 	<td nowrap class="HotKey">CMD-LEFT</td>
-	<td width="50" align="center">-</td>
 	<td>Activate a tab to the left</td>
     <td nowrap class="HotKey">CTRL-RIGHT</td>
-    <td width="50" align="center">-</td>
     <td>Activate a tab to the right</td>
 </tr>
 <tr valign="top" bgcolor="#EEEEEE">
     <td nowrap class="HotKey">F3</td>
-    <td width="50" align="center">-</td>
     <td>Find Next</td>
     <td nowrap class="HotKey">SHIFT-F3</td>
-    <td width="50" align="center">-</td>
     <td>Find previous</td>
 </tr>
 <tr valign="top">
     <td nowrap class="HotKey">CMD-A</td>
-    <td width="50" align="center">-</td>
     <td>Scroll to top</td>
     <td nowrap class="HotKey">CMD-B</td>
-    <td width="50" align="center">-</td>
     <td>Scroll to bottom</td>
 </tr>
 <tr valign="top" bgcolor="#EEEEEE">
     <td nowrap class="HotKey">CMD-F2 or double-click on a row</td>
-    <td width="50" align="center">-</td>
     <td>Define a 'marker' (add a note to a row)</td>
     <td nowrap class="HotKey">CMD-SHIFT-F2</td>
-    <td width="50" align="center">-</td>
     <td>Clear all markers</td>
 </tr>
 <tr valign="top">
     <td nowrap class="HotKey">F2</td>
-    <td width="50" align="center">-</td>
     <td>Find next marker</td>
     <td nowrap class="HotKey">SHIFT-F2</td>
-    <td width="50" align="center">-</td>
     <td>Find previous marker</td>
 </tr>
 <tr valign="top" bgcolor="#EEEEEE">
     <td nowrap class="HotKey">CMD-F</td>
-    <td width="50" align="center">-</td>
     <td>Set focus in 'find' field</td>
     <td nowrap class="HotKey">CMD-R</td>
-    <td width="50" align="center">-</td>
     <td>Set focus in 'refine focus' field</td>
 </tr>
 <tr valign="top" bgcolor="#EEEEEE">
     <td nowrap class="HotKey">CMD--SHIFT-F</td>
-    <td width="50" align="center">-</td>
     <td>Clear 'find' field</td>
     <td nowrap class="HotKey">CMD-SHIFT-R</td>
-    <td width="50" align="center">-</td>
     <td>Clear 'refine focus' field</td>
 </tr>
 <tr valign="top" >
 	<td nowrap class="HotKey">CMD-S</td>
-	<td width="50" align="center">-</td>
 	<td>Save displayed events</td>
     <td nowrap class="HotKey">CMD-O</td>
-    <td width="50" align="center">-</td>
     <td>Load file of XML events</td>
 </tr>
 <tr valign="top" bgcolor="#EEEEEE">
     <td nowrap class="HotKey">CMD-BACKSPACE</td>
-    <td width="50" align="center">-</td>
     <td>Purges current panels events</td>
 	<td nowrap class="HotKey">F12</td>
-	<td width="50" align="center">-</td>
 	<td>Pause display</td>
 </tr>
 <tr valign="top">
 	<td nowrap class="HotKey">CMD-D</td>
-	<td width="50" align="center">-</td>
 	<td>Show/Hide the Detail pane</td>
 	<td nowrap class="HotKey">CMD-T</td>
-	<td width="50" align="center">-</td>
 	<td>Show/Hide the Logger Tree pane</td>
 </tr>
 <tr valign="top" bgcolor="#EEEEEE">
     <td nowrap class="HotKey">F1</td>
-    <td width="50" align="center">-</td>
     <td>Hide/Show Welcome Panel/Help page</td>
     <td nowrap class="HotKey">F6</td>
-    <td width="50" align="center">-</td>
     <td>Show Receivers Dialog</td>
 </tr>
 <tr valign="top">
     <td nowrap class="HotKey">CMD-N</td>
-    <td width="50" align="center">-</td>
     <td>Go to next colored row</td>
     <td nowrap class="HotKey">CMD-P</td>
-    <td width="50" align="center">-</td>
     <td>Go to previous colored row</td>
 </tr>
 <tr valign="top" bgcolor="#EEEEEE">
     <td nowrap class="HotKey">CMD-G</td>
-    <td width="50" align="center">-</td>
     <td>Go to line</td>
 	<td></td>
 	<td></td>

Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html?rev=1030846&r1=1030845&r2=1030846&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
(original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
Thu Nov  4 07:14:03 2010
@@ -10,6 +10,10 @@
 <b>NOTE:</b> The mechanism and format used to persist settings in Chainsaw is
subject to change.  If you are experiencing problems displaying events in Chainsaw, please
delete everything in the $user.dir/.chainsaw directory and restart Chainsaw.
 <br>
 <h1>2.1</h1>
+<h2>4 Nov 2010</h2>
+<ul>
+<li>Added ability to define which columns are displayed by default when a new tab is
created by clicking the 'Use selected columns as default visible columns' button on the logpanel
preferences column selection screen</li>
+</ul>
 <h2>22 Oct 2010</h2>
 <ul>
 <li>Updated keyboard shortcuts to use system-specific option (Apple command key, Windows
control key)</li>



Mime
View raw message