logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r992536 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: LogUI.java ReceiverConfigurationPanel.java
Date Sat, 04 Sep 2010 05:04:06 GMT
Author: sdeboy
Date: Sat Sep  4 05:04:06 2010
New Revision: 992536

URL: http://svn.apache.org/viewvc?rev=992536&view=rev
Log:
Minor changes to receiver config panel network receiver section

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=992536&r1=992535&r2=992536&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Sat Sep  4 05:04:06
2010
@@ -1470,9 +1470,9 @@ public class LogUI extends JFrame implem
 
           if (receiverConfigurationPanel.getModel().isNetworkReceiverMode()) {
             int port = receiverConfigurationPanel.getModel().getNetworkReceiverPort();
-            Class receiverClass = receiverConfigurationPanel.getModel().getNetworkReceiverClass();
 
             try {
+              Class receiverClass = receiverConfigurationPanel.getModel().getNetworkReceiverClass();
               Receiver networkReceiver = (Receiver) receiverClass.newInstance();
               networkReceiver.setName(receiverClass.getSimpleName() + "-" + port);
 

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java?rev=992536&r1=992535&r2=992536&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
Sat Sep  4 05:04:06 2010
@@ -30,26 +30,22 @@ import java.net.URL;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-
 import javax.swing.AbstractAction;
 import javax.swing.BorderFactory;
 import javax.swing.ButtonGroup;
 import javax.swing.DefaultComboBoxModel;
-import javax.swing.DefaultListCellRenderer;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
-import javax.swing.JList;
 import javax.swing.JPanel;
 import javax.swing.JRadioButton;
 import javax.swing.JTextField;
 import javax.swing.JTextPane;
 import javax.swing.SwingUtilities;
 import javax.swing.filechooser.FileFilter;
-
 import javax.swing.text.SimpleAttributeSet;
 import javax.swing.text.StyleConstants;
 import javax.swing.text.StyledDocument;
@@ -304,32 +300,14 @@ class ReceiverConfigurationPanel extends
         networkReceiverPortComboBox.setOpaque(false);
 
         networkReceiverClassNameComboBoxModel = new DefaultComboBoxModel();
-        networkReceiverClassNameComboBoxModel.addElement(SocketReceiver.class);
-        networkReceiverClassNameComboBoxModel.addElement(UDPReceiver.class);
+        networkReceiverClassNameComboBoxModel.addElement(SocketReceiver.class.getName());
+        networkReceiverClassNameComboBoxModel.addElement(UDPReceiver.class.getName());
 
         networkReceiverClassNameComboBox = new JComboBox(networkReceiverClassNameComboBoxModel);
 
         networkReceiverClassNameComboBox.setEditable(false);
         networkReceiverClassNameComboBox.setOpaque(false);
 
-        networkReceiverClassNameComboBox.setRenderer(new DefaultListCellRenderer() {
-            public Component getListCellRendererComponent(JList list,
-                Object value, int index, boolean isSelected,
-                boolean cellHasFocus) {
-
-                Component component = super.getListCellRendererComponent(list, value, index,
isSelected, cellHasFocus);
-
-                if (value instanceof Class) {
-                    Class receiverClass = (Class) value;
-                    JLabel cellLabel = (JLabel) component;
-                    String shortenedName = receiverClass.getName().substring(receiverClass.getName().lastIndexOf('.')
+ 1);
-                    cellLabel.setText(shortenedName);
-                }
-
-                return component;
-            }
-        });
-
         JPanel panel = new JPanel(new GridBagLayout());
 
         GridBagConstraints c = new GridBagConstraints();
@@ -680,9 +658,8 @@ class ReceiverConfigurationPanel extends
             return Integer.parseInt(networkReceiverPortComboBoxModel.getSelectedItem().toString());
         }
 
-        Class getNetworkReceiverClass() {
-
-            return (Class) networkReceiverClassNameComboBoxModel.getSelectedItem();
+        Class getNetworkReceiverClass() throws ClassNotFoundException {
+            return Class.forName(networkReceiverClassNameComboBoxModel.getSelectedItem().toString());
         }
 
         boolean isLoadConfig() {



Mime
View raw message