Author: sdeboy Date: Sun Sep 12 05:29:05 2010 New Revision: 996254 URL: http://svn.apache.org/viewvc?rev=996254&view=rev Log: Minor update to receiver configuration panel - changed logformat to a combobox and pre-loaded combobox with a few examples Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java 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=996254&r1=996253&r2=996254&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 Sun Sep 12 05:29:05 2010 @@ -77,9 +77,10 @@ class ReceiverConfigurationPanel extends private JButton browseLogFileButton; private JComboBox logFileFormatTypeComboBox; - private JTextField logFileFormatTextField; + private JComboBox logFileFormatComboBox; private JComboBox logFileFormatTimestampFormatComboBox; private JTextField logFileURLTextField; + private DefaultComboBoxModel logFileFormatComboBoxModel; private DefaultComboBoxModel logFileFormatTimestampFormatComboBoxModel; //use existing configuration widgets @@ -118,9 +119,9 @@ class ReceiverConfigurationPanel extends buttonGroup = new ButtonGroup(); lowerPanel = new JPanel(new BorderLayout()); - lowerPanel.setBorder(BorderFactory.createEtchedBorder()); - lowerPanel.setPreferredSize(new Dimension(600, 275)); - lowerPanel.setMinimumSize(new Dimension(600, 275)); + lowerPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); + lowerPanel.setPreferredSize(new Dimension(600, 200)); + lowerPanel.setMinimumSize(new Dimension(600, 200)); int yPos = 0; @@ -377,8 +378,11 @@ class ReceiverConfigurationPanel extends c.insets = new Insets(0, 5, 5, 5); panel.add(new JLabel(" Log file format "), c); - logFileFormatTextField = new JTextField(); - logFileFormatTextField.setEditable(true); + logFileFormatComboBoxModel = new DefaultComboBoxModel(); + seedLogFileFormatComboBoxModel(); + logFileFormatComboBox = new JComboBox(logFileFormatComboBoxModel); + logFileFormatComboBox.setEditable(true); + logFileFormatComboBox.setOpaque(false); c = new GridBagConstraints(); c.gridx = 1; @@ -387,7 +391,7 @@ class ReceiverConfigurationPanel extends c.anchor = GridBagConstraints.LINE_START; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(0, 0, 5, 0); - panel.add(logFileFormatTextField, c); + panel.add(logFileFormatComboBox, c); c = new GridBagConstraints(); c.gridx = 0; @@ -414,10 +418,18 @@ class ReceiverConfigurationPanel extends c.gridy = 5; c.gridwidth=5; c.insets = new Insets(5, 5, 0, 5); - panel.add(new JLabel(" Log file format examples: See PatternLayout or LogFilePatternReceiver JavaDoc for details"), c); + panel.add(new JLabel(" See PatternLayout or LogFilePatternReceiver JavaDoc for details "), c); return panel; } + private void seedLogFileFormatComboBoxModel() + { + logFileFormatComboBoxModel.addElement("%p %t %c - %m%n"); + logFileFormatComboBoxModel.addElement("LEVEL THREAD LOGGER - MESSAGE"); + logFileFormatComboBoxModel.addElement("%d{ABSOLUTE} %-5p [%c{1}] %m%n"); + logFileFormatComboBoxModel.addElement("TIMESTAMP LEVEL [LOGGER] MESSAGE"); + } + private void seedLogFileFormatTimestampComboBoxModel() { logFileFormatTimestampFormatComboBoxModel.addElement("yyyy-MM-dd HH:mm:ss,SSS"); @@ -712,7 +724,7 @@ class ReceiverConfigurationPanel extends } String getLogFormat() { - Object item = logFileFormatTextField.getText(); + Object item = logFileFormatComboBox.getSelectedItem(); if (item != null) { return item.toString(); }