logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r824592 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: receivers/PluginPropertyEditorPanel.java receivers/ReceiverTreeCellRenderer.java receivers/ReceiversPanel.java vfs/VFSLogFilePatternReceiver.java
Date Tue, 13 Oct 2009 05:24:37 GMT
Author: sdeboy
Date: Tue Oct 13 05:24:36 2009
New Revision: 824592

URL: http://svn.apache.org/viewvc?rev=824592&view=rev
Log:
Chainsaw UI updates
 - increase receiver panel tree and table row heights, add scroll pane around receivers table
 - require non-blank name field when creating or editing receiver configuration
 - modify receivers jtree cell cell rendering logic so preferred size is wider
VFSLogFilePatternReceiver 
  - if null fileURL is provided, log instead of throw NPE

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiverTreeCellRenderer.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java?rev=824592&r1=824591&r2=824592&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
Tue Oct 13 05:24:36 2009
@@ -84,7 +84,7 @@
      *
      */
     private void initComponents() {
-        setPreferredSize(new Dimension(160, 120));
+        propertyTable.setRowHeight(19);
         setLayout(new BorderLayout());
         scrollPane.setViewportView(propertyTable);
 
@@ -348,6 +348,10 @@
 
 
             if (columnIndex == 1) {
+                if (descriptors[rowIndex].getName().toLowerCase().equals("name") &&
aValue == null || aValue.toString().trim().equals("")) {
+                    logger.error("Name required");
+                    return;
+                }
                 aValue = translateValueIfNeeded(rowIndex, aValue);
                 logger.debug(
                     "setValueAt, " + rowIndex + ", " + columnIndex +
@@ -370,7 +374,7 @@
         }
 
         /**
-         * @param columnIndex
+         * @param row
          * @param value
          * @return
          */

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiverTreeCellRenderer.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiverTreeCellRenderer.java?rev=824592&r1=824591&r2=824592&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiverTreeCellRenderer.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiverTreeCellRenderer.java
Tue Oct 13 05:24:36 2009
@@ -17,14 +17,9 @@
 
 package org.apache.log4j.chainsaw.receivers;
 
-import java.awt.BorderLayout;
-import java.awt.Component;
+import java.awt.*;
 
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTree;
+import javax.swing.*;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeCellRenderer;
 
@@ -48,10 +43,13 @@
 
   public ReceiverTreeCellRenderer() {
     super();
+    BoxLayout layout = new BoxLayout(panel, BoxLayout.X_AXIS);
+    panel.setLayout(layout);
     panel.setOpaque(false);
-    panel.setLayout(new BorderLayout());
-    panel.add(this, BorderLayout.CENTER);
-    panel.add(levelLabel, BorderLayout.EAST);
+    panel.add(levelLabel);
+    //set preferredsize to something wide
+    setPreferredSize(new Dimension(200, 19));
+    panel.add(this);
   }
 
   public Component getTreeCellRendererComponent(

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java?rev=824592&r1=824591&r2=824592&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/ReceiversPanel.java
Tue Oct 13 05:24:36 2009
@@ -17,9 +17,7 @@
 
 package org.apache.log4j.chainsaw.receivers;
 
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Container;
+import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
@@ -375,6 +373,7 @@
 
     receiversTree.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
     receiversTree.setCellRenderer(new ReceiverTreeCellRenderer());
+    receiversTree.setRowHeight(19);
 
     buttonPanel = new ReceiverToolbar();
     receiversTree.addTreeSelectionListener(buttonPanel);
@@ -763,11 +762,15 @@
                   panel.getOkPanel().getOkButton().addActionListener(
                     new ActionListener() {
                       public void actionPerformed(ActionEvent e2) {
-                        dialog.dispose();
                         Plugin plugin = panel.getPlugin();
-                        pluginRegistry.addPlugin(plugin);
-                        plugin.activateOptions();
-                        MessageCenter.getInstance().addMessage("Plugin '" + plugin.getName()
+ "' started");
+                        if (plugin.getName() != null && !plugin.getName().trim().equals(""))
{
+                            dialog.dispose();
+                            pluginRegistry.addPlugin(plugin);
+                            plugin.activateOptions();
+                            MessageCenter.getInstance().addMessage("Plugin '" + plugin.getName()
+ "' started");
+                        } else {
+                            MessageCenter.getInstance().getLogger().error("Name required
to create receiver");
+                        }
                       }
                     });
                   dialog.setVisible(true);

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java?rev=824592&r1=824591&r2=824592&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
Tue Oct 13 05:24:36 2009
@@ -303,18 +303,22 @@
     		  }}).start();
       } else {
         String oldURL = getFileURL();
-		int index = oldURL.indexOf("://");
-		String lastPart = oldURL.substring(index + "://".length());
-		int passEndIndex = lastPart.indexOf("@");
-		if (passEndIndex > -1) { //we have a username/password
-		    int passBeginIndex = lastPart.indexOf(":");
-//	        String userName = lastPart.substring(0, passBeginIndex);
-	        password = lastPart.substring(passBeginIndex + 1, passEndIndex);
-            setHost(oldURL.substring(0, index + "://".length()));
-            setPath(lastPart.substring(passEndIndex + 1));
-		}
-        vfsReader = new VFSReader();
-   	    new Thread(vfsReader).start();
+        if (oldURL != null) {
+            int index = oldURL.indexOf("://");
+            String lastPart = oldURL.substring(index + "://".length());
+            int passEndIndex = lastPart.indexOf("@");
+            if (passEndIndex > -1) { //we have a username/password
+                int passBeginIndex = lastPart.indexOf(":");
+    //	        String userName = lastPart.substring(0, passBeginIndex);
+                password = lastPart.substring(passBeginIndex + 1, passEndIndex);
+                setHost(oldURL.substring(0, index + "://".length()));
+                setPath(lastPart.substring(passEndIndex + 1));
+            }
+            vfsReader = new VFSReader();
+            new Thread(vfsReader).start();
+        } else {
+            getLogger().info("null URL - unable to parse file");
+        }
       }
    }
 



Mime
View raw message