logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r1021624 - in /logging/chainsaw/trunk/src/main: java/org/apache/log4j/chainsaw/ resources/org/apache/log4j/chainsaw/prefs/
Date Tue, 12 Oct 2010 04:23:08 GMT
Author: sdeboy
Date: Tue Oct 12 04:23:07 2010
New Revision: 1021624

URL: http://svn.apache.org/viewvc?rev=1021624&view=rev
Log:
Minor UI fixes
 - Removing Nimbus from available look and feels (chronic issues with Nimbus look and feel
and JTable colors)
 - Updating displayed look and feel in preferences panel to ensure default look and feel is
selected
 - non-wrap option was still using multi-line jtextpane in the tablecellrenderer, causing
visual glitches in Windows look and feel
 - updated default msg field to be wider, other fields to right of msg field are now a bit
narrower

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
    logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties

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=1021624&r1=1021623&r2=1021624&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
Tue Oct 12 04:23:07 2010
@@ -21,6 +21,7 @@ import java.beans.PropertyChangeListener
 import java.beans.PropertyChangeSupport;
 import java.util.Vector;
 
+import javax.swing.UIManager;
 
 /**
  * Encapsulates the Chainsaw Application wide properties
@@ -193,7 +194,12 @@ public class ApplicationPreferenceModel 
       setStatusBar(model.isStatusBar());
       setToolbar(model.isToolbar());
       setReceivers(model.isReceivers());
-      setLookAndFeelClassName(model.getLookAndFeelClassName());
+      if (model.getLookAndFeelClassName() != null && !model.getLookAndFeelClassName().trim().equals(""))
{
+          setLookAndFeelClassName(model.getLookAndFeelClassName());
+      } else {
+          //ensure current look and feel is selected
+          setLookAndFeelClassName(UIManager.getLookAndFeel().getClass().getName());
+      }
       setConfirmExit(model.isConfirmExit());
       setShowSplash(model.isShowSplash());
       setToolTipDisplayMillis(model.getToolTipDisplayMillis());

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java?rev=1021624&r1=1021623&r2=1021624&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
Tue Oct 12 04:23:07 2010
@@ -175,12 +175,28 @@ public static void main(String[] args) {
     private final JCheckBox statusBar = new JCheckBox("Show Status bar");
     private final JCheckBox toolBar = new JCheckBox("Show Toolbar");
     private final JCheckBox receivers = new JCheckBox("Show Receivers");
-    private UIManager.LookAndFeelInfo[] lookAndFeels =
-      UIManager.getInstalledLookAndFeels();
+    private UIManager.LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels();
     private final ButtonGroup lookAndFeelGroup = new ButtonGroup();
 
     private VisualsPrefPanel() {
       super("Visuals");
+
+      //Nimbus has major issues with colors in tables..just remove it from the list..
+      //only use this if nimbus was found..
+      UIManager.LookAndFeelInfo[] newLookAndFeels = new UIManager.LookAndFeelInfo[lookAndFeels.length
- 1];
+      boolean useNewLookAndFeels = false;
+      int j = 0;
+      for (int i=0;i<lookAndFeels.length;i++) {
+          if (!lookAndFeels[i].getClassName().toLowerCase().contains("nimbus")) {
+              newLookAndFeels[j++] = lookAndFeels[i];
+          } else {
+              useNewLookAndFeels = true;
+          }
+      }
+      if (useNewLookAndFeels) {
+          lookAndFeels = newLookAndFeels;
+      }
+
       setupComponents();
       setupListeners();
       setupInitialValues();

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java?rev=1021624&r1=1021623&r2=1021624&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
Tue Oct 12 04:23:07 2010
@@ -99,7 +99,7 @@ public class TableColorizingRenderer ext
 
   private static int borderWidth = 2;
 
-  private static Color borderColor = (Color)UIManager.get("Table.selectionBackground");
+  private final Color borderColor;
 
   private final JTextPane levelTextPane = new JTextPane();
   private JTextPane singleLineTextPane = new JTextPane();
@@ -130,6 +130,11 @@ public class TableColorizingRenderer ext
     levelPanel.setLayout(new BoxLayout(levelPanel, BoxLayout.Y_AXIS));
     maxHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
 
+    if (UIManager.get("Table.selectionBackground") != null) {
+        borderColor = (Color)UIManager.get("Table.selectionBackground");
+    } else {
+        borderColor = Color.BLUE;
+    }
     //define the 'bold' attributeset
     boldAttributeSet = new SimpleAttributeSet();
     StyleConstants.setBold(boldAttributeSet, true);
@@ -287,39 +292,41 @@ public class TableColorizingRenderer ext
     case ChainsawColumns.INDEX_LOG4J_MARKER_COL_NAME:
     case ChainsawColumns.INDEX_MESSAGE_COL_NAME:
         String thisString = value.toString().trim();
-        multiLineTextPane.setText(thisString);
+        JTextPane textPane = wrap ? multiLineTextPane : singleLineTextPane;
+        JComponent textPaneContainer = wrap ? multiLinePanel : generalPanel;
+        textPane.setText(thisString);
 
         if (colIndex == ChainsawColumns.INDEX_LOG4J_MARKER_COL_NAME) {
             //property keys are set as all uppercase
-            setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.PROP_FIELD
+ ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE.toUpperCase()), (StyledDocument) multiLineTextPane.getDocument());
+            setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.PROP_FIELD
+ ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE.toUpperCase()), (StyledDocument) textPane.getDocument());
         } else {
-            setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.MSG_FIELD),
(StyledDocument) multiLineTextPane.getDocument());
+            setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.MSG_FIELD),
(StyledDocument) textPane.getDocument());
         }
-        multiLinePanel.removeAll();
+        textPaneContainer.removeAll();
         if (delta > 0 && logPanelPreferenceModel.isShowMillisDeltaAsGap()) {
             JPanel newPanel = new JPanel();
             newPanel.setOpaque(true);
             newPanel.setBackground(applicationPreferenceModel.getDeltaColor());
             newPanel.setPreferredSize(new Dimension(width, (int) delta));
-            multiLinePanel.add(newPanel, BorderLayout.NORTH);
+            textPaneContainer.add(newPanel, BorderLayout.NORTH);
         }
-        multiLinePanel.add(multiLineTextPane, BorderLayout.SOUTH);
+        textPaneContainer.add(textPane, BorderLayout.SOUTH);
 
         if (delta == 0 || !logPanelPreferenceModel.isShowMillisDeltaAsGap()) {
           if (col == 0) {
-            multiLineTextPane.setBorder(getLeftBorder(isSelected, delta));
+            textPane.setBorder(getLeftBorder(isSelected, delta));
           } else if (col == table.getColumnCount() - 1) {
-            multiLineTextPane.setBorder(getRightBorder(isSelected, delta));
+            textPane.setBorder(getRightBorder(isSelected, delta));
           } else {
-            multiLineTextPane.setBorder(getMiddleBorder(isSelected, delta));
+            textPane.setBorder(getMiddleBorder(isSelected, delta));
           }
         } else {
             if (col == 0) {
-              multiLineTextPane.setBorder(getLeftBorder(isSelected, 0));
+              textPane.setBorder(getLeftBorder(isSelected, 0));
             } else if (col == table.getColumnCount() - 1) {
-              multiLineTextPane.setBorder(getRightBorder(isSelected, 0));
+              textPane.setBorder(getRightBorder(isSelected, 0));
             } else {
-              multiLineTextPane.setBorder(getMiddleBorder(isSelected, 0));
+              textPane.setBorder(getMiddleBorder(isSelected, 0));
             }
         }
         int currentMarkerHeight = loggingEvent.getMarkerHeight();
@@ -337,13 +344,13 @@ public class TableColorizingRenderer ext
             int calculatedHeight = calculateHeight(thisString, width, paramMap);
              */
             //instead, set size to max height
-            multiLineTextPane.setSize(new Dimension(width, maxHeight));
-            int multiLinePanelPrefHeight = multiLinePanel.getPreferredSize().height;
+            textPane.setSize(new Dimension(width, maxHeight));
+            int multiLinePanelPrefHeight = textPaneContainer.getPreferredSize().height;
             newRowHeight = Math.max(ChainsawConstants.DEFAULT_ROW_HEIGHT, multiLinePanelPrefHeight);
 
         }
         if (!wrap && logPanelPreferenceModel.isShowMillisDeltaAsGap()) {
-            multiLineTextPane.setSize(new Dimension(Integer.MAX_VALUE, ChainsawConstants.DEFAULT_ROW_HEIGHT));
+            textPane.setSize(new Dimension(Integer.MAX_VALUE, ChainsawConstants.DEFAULT_ROW_HEIGHT));
             newRowHeight = (int) (ChainsawConstants.DEFAULT_ROW_HEIGHT + delta);
         }
 
@@ -364,7 +371,7 @@ public class TableColorizingRenderer ext
             table.setRowHeight(row, newRowHeight);
         }
 
-        component = multiLinePanel;
+        component = textPaneContainer;
         break;
     case ChainsawColumns.INDEX_LEVEL_COL_NAME:
       if (levelUseIcons) {

Modified: logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties?rev=1021624&r1=1021623&r2=1021624&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties
(original)
+++ logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/prefs/default.properties
Tue Oct 12 04:23:07 2010
@@ -25,7 +25,7 @@ main.window.width=1024
 main.window.height=768
 
 table.columns.order=ID,TIMESTAMP,MARKER,LEVEL,LOGGER,MESSAGE,THROWABLE,THREAD,NDC,CLASS,METHOD,FILE,LINE,MILLISDELTA
-table.columns.widths=50,80,95,50,100,300,100,150,150,300,150,100,100,100
+table.columns.widths=50,80,95,50,100,500,100,100,100,100,100,100,100,100
 
 SavedConfigs.Size=0
 DateFormat.1=HH:mm:ss



Mime
View raw message