cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-12-22 Thread psmith
psmith  2003/12/22 03:00:02

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  use of refactored code.
  
  Revision  ChangesPath
  1.63  +2 -6  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- LogUI.java20 Dec 2003 05:27:16 -  1.62
  +++ LogUI.java22 Dec 2003 11:00:02 -  1.63
  @@ -114,6 +114,7 @@
   import org.apache.log4j.UtilLoggingLevel;
   import org.apache.log4j.chainsaw.help.HelpManager;
   import org.apache.log4j.chainsaw.help.Tutorial;
  +import org.apache.log4j.chainsaw.helper.SwingHelper;
   import org.apache.log4j.chainsaw.icons.ChainsawIcons;
   import org.apache.log4j.chainsaw.messages.MessageCenter;
   import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  @@ -232,12 +233,7 @@
   
 private static final void showSplash(Frame owner) {
   splash = new ChainsawSplash(owner);
  -
  -Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  -splash.setLocation(
  -  (screenSize.width / 2) - (splash.getWidth() / 2),
  -  (screenSize.height / 2) - (splash.getHeight() / 2));
  -
  +SwingHelper.centerOnScreen(splash);
   splash.setVisible(true);
 }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-12-19 Thread psmith
psmith  2003/12/19 20:59:54

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  extracted some setup code for the Welcome & Receiver panel
  into their own methods as a tidy up.
  
  Revision  ChangesPath
  1.61  +64 -17jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- LogUI.java20 Dec 2003 00:22:06 -  1.60
  +++ LogUI.java20 Dec 2003 04:59:53 -  1.61
  @@ -83,7 +83,9 @@
   import javax.swing.AbstractAction;
   import javax.swing.Action;
   import javax.swing.BorderFactory;
  +import javax.swing.Box;
   import javax.swing.ImageIcon;
  +import javax.swing.JButton;
   import javax.swing.JComponent;
   import javax.swing.JDialog;
   import javax.swing.JEditorPane;
  @@ -330,23 +332,10 @@
  *
  */
 private void initGUI() {
  -welcomePanel = new WelcomePanel(this);
  +setupHelpSystem();
   
  -/**
  - * Setup a listener on the HelpURL property and automatically change the 
WelcomePages URL
  - * to it.
  - */
  -HelpManager.getInstance().addPropertyChangeListener("helpURL", new 
PropertyChangeListener(){
  -
  - public void propertyChange(PropertyChangeEvent evt) {
  - URL newURL = (URL) evt.getNewValue();
  - if(newURL != null) {
  - welcomePanel.setURL(newURL);
  - }
  - 
  - }});
  +setupReceiverPanel();
   
  -receiversPanel = new ReceiversPanel(this);
   setToolBarAndMenus(new ChainsawToolBarAndMenus(this));
   toolbar = getToolBarAndMenus().getToolbar();
   setJMenuBar(getToolBarAndMenus().getMenubar());
  @@ -361,6 +350,64 @@
   
 }
   
  +  private void setupReceiverPanel() {
  +receiversPanel = new ReceiversPanel();
  +receiversPanel.addPropertyChangeListener("visible", new 
PropertyChangeListener() {
  +
  +  public void propertyChange(PropertyChangeEvent evt) {
  +messageLogger.debug("Receiver's panel:" + evt.getNewValue());
  +  
getApplicationPreferenceModel().setReceivers(((Boolean)evt.getNewValue()).booleanValue());
  +  }});
  +  }
  +
  +  /**
  +   * Initialises the Help system and the WelcomePanel
  +   *
  +   */
  +  private void setupHelpSystem() {
  +welcomePanel = new WelcomePanel();
  +JToolBar tb = welcomePanel.getToolbar();
  +tb.add(
  +new SmallButton(
  +new AbstractAction("Tutorial", new ImageIcon(ChainsawIcons.HELP)) {
  +  public void actionPerformed(ActionEvent e) {
  +setupTutorial();
  +  }
  +}));
  +tb.addSeparator();
  +
  +final Action exampleConfigAction =
  +new AbstractAction("View example Receiver configuration") {
  +  public void actionPerformed(ActionEvent e) {
  +HelpManager.getInstance().setHelpURL(ChainsawConstants.EXAMLE_CONFIG_URL);
  +  }
  +};
  +
  +exampleConfigAction.putValue(
  +Action.SHORT_DESCRIPTION,
  +"Displays an example Log4j configuration file with several Receivers 
defined.");
  +
  +JButton exampleButton = new SmallButton(exampleConfigAction);
  +tb.add(exampleButton);
  +
  +tb.add(Box.createHorizontalGlue());
  +
  +
  +/**
  + * Setup a listener on the HelpURL property and automatically change the 
WelcomePages URL
  + * to it.
  + */
  +HelpManager.getInstance().addPropertyChangeListener("helpURL", new 
PropertyChangeListener(){
  +
  + public void propertyChange(PropertyChangeEvent evt) {
  + URL newURL = (URL) evt.getNewValue();
  + if(newURL != null) {
  + welcomePanel.setURL(newURL);
  + }
  + 
  + }});
  +  }
  +
 /**
  * Given the load event, configures the size/location of the main window etc
  * etc.
  @@ -719,7 +766,7 @@
   ((ImageIcon) ChainsawIcons.ICON_PREFERENCES).getImage());
   preferencesFrame.getContentPane().add(applicationPreferenceModelPanel);
   
  -preferencesFrame.setSize(640, 340);
  +preferencesFrame.setSize(640, 480);
   
   Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
   preferencesFrame.setLocation(new 
Point((screenDimension.width/2)-(preferencesFrame.getSize().width/2),  
(screenDimension.height/2)-(preferencesFrame.getSize().height/2)  ));
  @@ -848,7 +895,7 @@
   container.setLayout(new BorderLayout());
   
   try {
  -  tutorialArea.setPage(getWelcomePanel().getTutorialURL());
  +  tutorialArea.setPage(ChainsawConstants.TUTORIAL_URL);
 contain

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-12-19 Thread psmith
psmith  2003/12/19 02:15:59

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Once and for all (touch wood) solved the problem of some components
  not getting the chance to get the correct l&f.
  
  This is done by loading the App pref model BEFORE any GUI elements
  get initialised, and therefore we know what the correct L&F should be.
  
  Revision  ChangesPath
  1.59  +19 -29jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- LogUI.java19 Dec 2003 06:51:58 -  1.58
  +++ LogUI.java19 Dec 2003 10:15:59 -  1.59
  @@ -159,7 +159,6 @@
 private static final String MAIN_WINDOW_X = "main.window.x";
 static final String TABLE_COLUMN_ORDER = "table.columns.order";
 static final String TABLE_COLUMN_WIDTHS = "table.columns.widths";
  -  private static final String LOOK_AND_FEEL = "LookAndFeel";
 private static final String STATUS_BAR = "StatusBar";
 static final String COLUMNS_EXTENSION = ".columns";
 static final String COLORS_EXTENSION = ".colors";
  @@ -182,7 +181,6 @@
 private ChainsawToolBarAndMenus tbms;
 private ChainsawAbout aboutBox;
 private final SettingsManager sm = SettingsManager.getInstance();
  -  private String lookAndFeelClassName;
 private final JFrame tutorialFrame = new JFrame("Chainsaw Tutorial");
   
 /**
  @@ -212,6 +210,7 @@
  */
 private EventListenerList shutdownListenerList = new EventListenerList();
 private WelcomePanel welcomePanel;
  +  private String lookAndFeelClassName;
   
 /**
  * Constructor which builds up all the visual elements of the frame including
  @@ -270,7 +269,14 @@
  * @param args
  */
 public static void main(String[] args) {
  -createChainsawGUI(true, null);
  +
  +ApplicationPreferenceModel model = new ApplicationPreferenceModel();
  +
  +SettingsManager.getInstance().configure(model);
  +
  +applyLookAndFeel(model.getLookAndFeelClassName());
  +
  +createChainsawGUI(model, true, null);
 }
   
 /**
  @@ -282,7 +288,7 @@
  * @param shutdownAction
  *DOCUMENT ME!
  */
  -  public static void createChainsawGUI(
  +  public static void createChainsawGUI(ApplicationPreferenceModel model,
   boolean showSplash, Action shutdownAction) {
   LogUI logUI = new LogUI();
   
  @@ -295,6 +301,8 @@
   LogManager.getRootLogger().addAppender(logUI.handler);
   logUI.activateViewer();
   
  +logUI.getApplicationPreferenceModel().apply(model);
  +
   if (shutdownAction != null) {
 logUI.setShutdownAction(shutdownAction);
   }
  @@ -380,10 +388,6 @@
   event.saveSetting(LogUI.MAIN_WINDOW_WIDTH, getWidth());
   event.saveSetting(LogUI.MAIN_WINDOW_HEIGHT, getHeight());
   
  -if (lookAndFeelClassName != null) {
  -  event.saveSetting(LogUI.LOOK_AND_FEEL, lookAndFeelClassName);
  -}
  -
   if (configURLToUse != null) {
 event.saveSetting(LogUI.CONFIG_FILE_TO_USE, configURLToUse.toString());
   }
  @@ -698,21 +702,7 @@
   Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
   preferencesFrame.setLocation(new 
Point((screenDimension.width/2)-(preferencesFrame.getSize().width/2),  
(screenDimension.height/2)-(preferencesFrame.getSize().height/2)  ));
   
  -getSettingsManager().configure(
  -  new SettingsListener() {
  -public void loadSettings(LoadSettingsEvent event) {
  -  lookAndFeelClassName = event.getSetting(LogUI.LOOK_AND_FEEL);
  -
  -  if (lookAndFeelClassName != null) {
  -applyLookAndFeel(lookAndFeelClassName);
  -  }
  -}
  -
  -public void saveSettings(SaveSettingsEvent event) {
  -  //required because of SettingsListener interface..not used during load
  -}
  -  });
  -
  + 
   pack();
   
   final JPopupMenu tabPopup = new JPopupMenu();
  @@ -1326,7 +1316,7 @@
  * @param lookAndFeelClassName
  *The FQN of the LookANdFeel
  */
  -  private void applyLookAndFeel(String lookAndFeelClassName) {
  +  private static void applyLookAndFeel(String lookAndFeelClassName) {
   if (
 UIManager.getLookAndFeel().getClass().getName().equals(
 lookAndFeelClassName)) {
  @@ -1335,14 +1325,14 @@
 return;
   }
   
  -LogLog.debug("Setting L&F -> " + lookAndFeelClassName);
   
  +if(lookAndFeelClassName == null || lookAndFeelClassName.trim().equals("")) {
  +  LogLog.info("Using System native L&F");
  +  lookAndFeelClassName = UIManager.getSystemLookAndFeelClassName();
  +}
  +LogLog.debug("Setting L&F -> " + lo

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-12-18 Thread psmith
psmith  2003/12/18 22:51:59

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  GUI now registers a PropertyChangeListener on the HelpManager
  and sets the new URL on the Welcome panel.
  
  Revision  ChangesPath
  1.58  +18 -1 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- LogUI.java18 Dec 2003 21:36:59 -  1.57
  +++ LogUI.java19 Dec 2003 06:51:58 -  1.58
  @@ -108,13 +108,14 @@
   import org.apache.log4j.LogManager;
   import org.apache.log4j.Priority;
   import org.apache.log4j.UtilLoggingLevel;
  +import org.apache.log4j.chainsaw.help.HelpManager;
   import org.apache.log4j.chainsaw.help.Tutorial;
   import org.apache.log4j.chainsaw.icons.ChainsawIcons;
   import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
   import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
   import org.apache.log4j.chainsaw.prefs.SettingsListener;
   import org.apache.log4j.chainsaw.prefs.SettingsManager;
  -import org.apache.log4j.chainsaw.receivers.*;
  +import org.apache.log4j.chainsaw.receivers.ReceiversPanel;
   import org.apache.log4j.helpers.LogLog;
   import org.apache.log4j.helpers.OptionConverter;
   import org.apache.log4j.net.SocketNodeEventListener;
  @@ -318,6 +319,21 @@
  */
 private void initGUI() {
   welcomePanel = new WelcomePanel(this);
  +
  +/**
  + * Setup a listener on the HelpURL property and automatically change the 
WelcomePages URL
  + * to it.
  + */
  +HelpManager.getInstance().addPropertyChangeListener("helpURL", new 
PropertyChangeListener(){
  +
  + public void propertyChange(PropertyChangeEvent evt) {
  + URL newURL = (URL) evt.getNewValue();
  + if(newURL != null) {
  + welcomePanel.setURL(newURL);
  + }
  + 
  + }});
  +
   receiversPanel = new ReceiversPanel(this);
   setToolBarAndMenus(new ChainsawToolBarAndMenus(this));
   toolbar = getToolBarAndMenus().getToolbar();
  @@ -1325,6 +1341,7 @@
 UIManager.setLookAndFeel(lookAndFeelClassName);
 SwingUtilities.updateComponentTreeUI(this);
 SwingUtilities.updateComponentTreeUI(preferencesFrame);
  +   SwingUtilities.updateComponentTreeUI(receiversPanel);
 applicationPreferenceModelPanel.notifyOfLookAndFeelChange();
} catch (Exception e) {
 LogLog.error("Failed to change L&F", e);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-12-18 Thread psmith
psmith  2003/12/18 13:36:59

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  As part of some general package reshuffling, made this some methods
  public.
  
  Revision  ChangesPath
  1.57  +2 -1  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- LogUI.java16 Dec 2003 09:25:01 -  1.56
  +++ LogUI.java18 Dec 2003 21:36:59 -  1.57
  @@ -114,6 +114,7 @@
   import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
   import org.apache.log4j.chainsaw.prefs.SettingsListener;
   import org.apache.log4j.chainsaw.prefs.SettingsManager;
  +import org.apache.log4j.chainsaw.receivers.*;
   import org.apache.log4j.helpers.LogLog;
   import org.apache.log4j.helpers.OptionConverter;
   import org.apache.log4j.net.SocketNodeEventListener;
  @@ -1337,7 +1338,7 @@
  * @param url
  *for content to show
  */
  -  void showHelp(URL url) {
  +  public void showHelp(URL url) {
   removeWelcomePanel();
   addWelcomePanel();
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-12-16 Thread psmith
psmith  2003/12/16 01:25:02

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Tutorial frame now uses the Help icon for the frame.
  
  Revision  ChangesPath
  1.56  +1 -0  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- LogUI.java16 Dec 2003 01:07:07 -  1.55
  +++ LogUI.java16 Dec 2003 09:25:01 -  1.56
  @@ -825,6 +825,7 @@
 LogLog.error("Error occurred loading the Tutorial", e);
   }
   
  +tutorialFrame.setIconImage(new ImageIcon(ChainsawIcons.HELP).getImage());
   tutorialFrame.setSize(new Dimension(640, 480));
   
   final Action startTutorial =
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-12-12 Thread psmith
psmith  2003/12/12 02:32:40

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  New app pref frame was not receiving L&F change notification and
  so stayed in the Metal L&F.
  
  Revision  ChangesPath
  1.51  +1 -0  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- LogUI.java12 Dec 2003 02:25:53 -  1.50
  +++ LogUI.java12 Dec 2003 10:32:40 -  1.51
  @@ -1305,6 +1305,7 @@
   try {
 UIManager.setLookAndFeel(lookAndFeelClassName);
 SwingUtilities.updateComponentTreeUI(this);
  +  SwingUtilities.updateComponentTreeUI(preferencesFrame);
   } catch (Exception e) {
 LogLog.error("Failed to change L&F", e);
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java NoReceiversWarningPanel.java

2003-12-10 Thread psmith
psmith  2003/12/10 18:59:01

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
NoReceiversWarningPanel.java
  Log:
  Modified so LogUI (the 'app') uses an ApplicationPreferenceModel
  which will load and save it-' own settings.  We can
  add new properties to this.
  
  Also added a "Don't show me this again" option for
  the No Receivers warning panel.
  
  Eventually there will be an application wide settings
  Preference panel in a similar style to the LogPanel's
  preferences.
  
  Revision  ChangesPath
  1.47  +6 -1  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- LogUI.java8 Dec 2003 06:00:20 -   1.46
  +++ LogUI.java11 Dec 2003 02:59:01 -  1.47
  @@ -121,6 +121,7 @@
   import org.apache.log4j.plugins.PluginListener;
   import org.apache.log4j.plugins.PluginRegistry;
   import org.apache.log4j.plugins.Receiver;
  +import org.omg.CORBA.portable.ApplicationException;
   
   
   /**
  @@ -167,6 +168,7 @@
 private ChainsawTabbedPane tabbedPane;
 private JToolBar toolbar;
 private ChainsawStatusBar statusBar;
  +  private ApplicationPreferenceModel appPreferenceModel = new 
ApplicationPreferenceModel();
 private final Map tableModelMap = new HashMap();
 private final Map tableMap = new HashMap();
 private final List filterableColumns = new ArrayList();
  @@ -726,6 +728,7 @@
 });
   
   getSettingsManager().addSettingsListener(this);
  +getSettingsManager().addSettingsListener(appPreferenceModel);
   getSettingsManager().addSettingsListener(getToolBarAndMenus());
   getSettingsManager().loadSettings();
   
  @@ -738,7 +741,7 @@
 initializationLock.notifyAll();
   }
   
  -if (noReceiversDefined) {
  +if (noReceiversDefined && appPreferenceModel.isShowNoReceiverWarning()) {
 showNoReceiversWarningPanel();
   }
   
  @@ -868,6 +871,7 @@
  * user to choose some options for configuration
  */
 private void showNoReceiversWarningPanel() {
  +
   final NoReceiversWarningPanel noReceiversWarningPanel =
 new NoReceiversWarningPanel();
   
  @@ -930,6 +934,7 @@
   
 dialog.dispose();
   
  +  
appPreferenceModel.setShowNoReceiverWarning(!noReceiversWarningPanel.isDontWarnMeAgain());
 if (noReceiversWarningPanel.getModel().isManualMode()) {
   toggleReceiversPanel();
 } else if (noReceiversWarningPanel.getModel().isSimpleReceiverMode()) {
  
  
  
  1.7   +468 -405  
jakarta-log4j/src/java/org/apache/log4j/chainsaw/NoReceiversWarningPanel.java
  
  Index: NoReceiversWarningPanel.java
  ===
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/NoReceiversWarningPanel.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NoReceiversWarningPanel.java  11 Sep 2003 09:43:14 -  1.6
  +++ NoReceiversWarningPanel.java  11 Dec 2003 02:59:01 -  1.7
  @@ -46,11 +46,14 @@
* Apache Software Foundation, please see .
*
*/
  -
  -/*
  - */
   package org.apache.log4j.chainsaw;
   
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.net.PortBased;
  +import org.apache.log4j.net.SocketAppender;
  +import org.apache.log4j.net.SocketHubReceiver;
  +import org.apache.log4j.net.SocketReceiver;
  +
   import java.awt.Component;
   import java.awt.Dimension;
   import java.awt.GridBagConstraints;
  @@ -60,7 +63,9 @@
   import java.awt.event.ActionListener;
   import java.awt.event.FocusEvent;
   import java.awt.event.FocusListener;
  +
   import java.io.File;
  +
   import java.net.MalformedURLException;
   import java.net.URL;
   
  @@ -71,6 +76,7 @@
   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;
  @@ -84,12 +90,6 @@
   import javax.swing.event.ListDataListener;
   import javax.swing.filechooser.FileFilter;
   
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.net.PortBased;
  -import org.apache.log4j.net.SocketAppender;
  -import org.apache.log4j.net.SocketHubReceiver;
  -import org.apache.log4j.net.SocketReceiver;
  -
   
   /**
* A dialog panel to inform the user that they do not have
  @@ -100,463 +100,526 @@
* @author Paul Smith
*/
   class NoReceiversWarningPanel extends JPanel {
  -  private final JComboBox previousConfigs = new JComboBox();
   
  -  private final JRadioButton simpleReceiver =

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-12-04 Thread psmith
psmith  2003/12/04 02:40:52

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Fixed NPE bug found by [EMAIL PROTECTED] when
  attempting to close the welcome panel using the right click
  popup menu on the tabs.
  
  Also reordered the position of this popup code so the L&F changes
  affected the popup menu (was staying in the Metal L&F).
  
  Now listens for tabs being removed, and disables the hide actions if the 
  Welcome panel has been selected.
  
  Tutorial Frame toolbar now tracks whether there are any Tutorial Generator
  Receivers running, and if not, ensures that the Start Tutorial button
  does not stay activated.
  
  Revision  ChangesPath
  1.45  +103 -68   jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- LogUI.java3 Dec 2003 04:04:18 -   1.44
  +++ LogUI.java4 Dec 2003 10:40:52 -   1.45
  @@ -78,6 +78,8 @@
   import java.awt.Toolkit;
   import java.awt.event.ActionEvent;
   import java.awt.event.ActionListener;
  +import java.awt.event.ContainerEvent;
  +import java.awt.event.ContainerListener;
   import java.awt.event.InputEvent;
   import java.awt.event.KeyEvent;
   import java.awt.event.MouseAdapter;
  @@ -326,73 +328,6 @@
   setJMenuBar(getToolBarAndMenus().getMenubar());
   setTabbedPane(new ChainsawTabbedPane());
   
  -//
getTabbedPane().addChangeListener(getToolBarAndMenus().getPanelListener());
  -final JPopupMenu tabPopup = new JPopupMenu();
  -Action hideCurrentTabAction =
  -  new AbstractAction("Hide") {
  -public void actionPerformed(ActionEvent e) {
  -  displayPanel(getCurrentLogPanel().getIdentifier(), false);
  -  tbms.stateChange();
  -}
  -  };
  -
  -Action hideOtherTabsAction =
  -  new AbstractAction("Hide Others") {
  -public void actionPerformed(ActionEvent e) {
  -  String currentName = getCurrentLogPanel().getIdentifier();
  -
  -  int count = getTabbedPane().getTabCount();
  -  int index = 0;
  -
  -  for (int i = 0; i < count; i++) {
  -String name = getTabbedPane().getTitleAt(index);
  -
  -if (
  -  getPanelMap().keySet().contains(name)
  -&& !name.equals(currentName)) {
  -  displayPanel(name, false);
  -  tbms.stateChange();
  -} else {
  -  index++;
  -}
  -  }
  -}
  -  };
  -
  -Action showHiddenTabsAction =
  -  new AbstractAction("Show All Hidden") {
  -public void actionPerformed(ActionEvent e) {
  -  for (Iterator iter = getPanels().keySet().iterator();
  -  iter.hasNext();) {
  -String identifier = (String) iter.next();
  -int count = getTabbedPane().getTabCount();
  -boolean found = false;
  -
  -for (int i = 0; i < count; i++) {
  -  String name = getTabbedPane().getTitleAt(i);
  -
  -  if (name.equals(identifier)) {
  -found = true;
  -
  -break;
  -  }
  -}
  -
  -if (!found) {
  -  displayPanel(identifier, true);
  -  tbms.stateChange();
  -}
  -  }
  -}
  -  };
  -
  -tabPopup.add(hideCurrentTabAction);
  -tabPopup.add(hideOtherTabsAction);
  -tabPopup.addSeparator();
  -tabPopup.add(showHiddenTabsAction);
  -
  -final PopupListener tabPopupListener = new PopupListener(tabPopup);
  -getTabbedPane().addMouseListener(tabPopupListener);
 }
   
 /**
  @@ -703,7 +638,94 @@
 });
   
   pack();
  +
  +final JPopupMenu tabPopup = new JPopupMenu();
  +final Action hideCurrentTabAction =
  +  new AbstractAction("Hide") {
  +public void actionPerformed(ActionEvent e) {
  +  displayPanel(getCurrentLogPanel().getIdentifier(), false);
  +  tbms.stateChange();
  +}
  +  };
  +
  +final Action hideOtherTabsAction =
  +  new AbstractAction("Hide Others") {
  +public void actionPerformed(ActionEvent e) {
  +  String currentName = getCurrentLogPanel().getIdentifier();
  +
  +  int count = getTabbedPane().getTabCount();
  +  int index = 0;
  +
  +  for (int i = 0; i < count; i++) {
  +String name = getTabbedPane().getTitleAt(index);
  +
  +if (
  +  getPanelMap().keySet().contains(name)
  +&& !name.equals(currentName)) {
  +  displayPanel(name, false);
  +  tbms.stateChange();
  +} else {
  +  index++;
  +}
  +  

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java LogPanel.java LogPanelPreferenceModel.java

2003-11-30 Thread psmith
psmith  2003/11/30 17:57:31

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java LogPanel.java
LogPanelPreferenceModel.java
  Log:
  All Preferences for a LogPanel (those that are encapsulate in
  the LogPanelPreferenceModel class at any rate) are now remembered
  between application sessions.
  
  Currently this relies on the object being serialized, and
  the column widths are stored in a separate file at the moment.
  Soon to be combined into a single permanent storage item/file.
  
  Each LogPanel is now registered with the SettingsManager and
  is notified when to save it's settings.
  
  Revision  ChangesPath
  1.42  +1 -10 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- LogUI.java20 Nov 2003 22:11:19 -  1.41
  +++ LogUI.java1 Dec 2003 01:57:31 -   1.42
  @@ -879,16 +879,6 @@
   //TODO Ask the user if they want to save the settings via a dialog.
   getSettingsManager().saveSettings();
   
  -int tabCount = getTabbedPane().getTabCount();
  -
  -for (int i = 0; i < tabCount; i++) {
  -  Component c = getTabbedPane().getComponentAt(i);
  -
  -  if (c instanceof LogPanel) {
  -((LogPanel) c).saveSettings();
  -  }
  -}
  -
   shutdown();
 }
   
  @@ -1372,6 +1362,7 @@
   getTabbedPane().add(ident, thisPanel);
   getPanelMap().put(ident, thisPanel);
   
  +getSettingsManager().addSettingsListener(thisPanel);
   getSettingsManager().configure(thisPanel);
   
   /**
  
  
  
  1.26  +64 -12jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
  
  Index: LogPanel.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- LogPanel.java 20 Nov 2003 22:09:40 -  1.25
  +++ LogPanel.java 1 Dec 2003 01:57:31 -   1.26
  @@ -1658,30 +1658,50 @@
 !getPreferenceModel().isLogTreePanelVisible());
 }
   
  -  public void saveSettings() {
  -saveColumnSettings(identifier, table.getColumnModel());
  -
  -//  colorDisplaySelector.save();
  -//  TODO save display rule settings
  -//  displayFilter.save();
  -  }
  -
 public void saveSettings(SaveSettingsEvent event) {
  -//not used..save of columns performed via tablecolumnmodellistener event 
callback
  +ObjectOutputStream o = null;
  +
  +try {
  +  File f =
  +  new File(
  +  SettingsManager.getInstance().getSettingsDirectory()
  +  + File.separator + getIdentifier()+ ".prefs");
  +  o = new ObjectOutputStream(
  +  new BufferedOutputStream(new FileOutputStream(f)));
  +  
  +  o.writeObject(getPreferenceModel());
  +}
  +catch(IOException e)
  +{
  +  LogLog.error("Error ocurred saving the Preferences",e);
  +}finally
  +{
  +  if(o!=null)
  +  {
  +try
  +{
  +o.close();
  +}
  +catch (Exception e)
  +{
  +}
  +  }
  +}
  +saveColumnSettings();
 }
   
  -  void saveColumnSettings(String ident, TableColumnModel model) {
  +  void saveColumnSettings() {
   ObjectOutputStream o = null;
   
   try {
 File f =
   new File(
 SettingsManager.getInstance().getSettingsDirectory()
  -  + File.separator + ident + LogUI.COLUMNS_EXTENSION);
  +  + File.separator + getIdentifier() + LogUI.COLUMNS_EXTENSION);
 o = new ObjectOutputStream(
 new BufferedOutputStream(new FileOutputStream(f)));
   
  -  Enumeration e = model.getColumns();
  +  Enumeration e = this.table.getColumnModel().getColumns();
   
 while (e.hasMoreElements()) {
   TableColumn c = (TableColumn) e.nextElement();
  @@ -1717,6 +1737,38 @@
  * @see 
org.apache.log4j.chainsaw.prefs.Profileable#loadSettings(org.apache.log4j.chainsaw.prefs.LoadSettingsEvent)
  */
 public void loadSettings(LoadSettingsEvent event) {
  +ObjectInputStream o = null;
  +
  +try {
  +  File f =
  +  new File(
  +  SettingsManager.getInstance().getSettingsDirectory()
  +  + File.separator + getIdentifier()+ ".prefs");
  +  o = new ObjectInputStream(
  +  new BufferedInputStream(new FileInputStream(f)));
  +  
  +  LogPanelPreferenceModel model = (LogPanelPreferenceModel) o.readObject();
  +  getPreferenceModel().apply(model);
  +}
  +catch(Exception e)
  +{
  +  LogLog.error("Error ocurred loading the Pr

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-11-20 Thread psmith
psmith  2003/11/20 14:11:19

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  small refactor so that an in VM class could start Chainsaw.
  
  Revision  ChangesPath
  1.41  +20 -1 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- LogUI.java9 Nov 2003 09:59:28 -   1.40
  +++ LogUI.java20 Nov 2003 22:11:19 -  1.41
  @@ -266,14 +266,33 @@
  */
 public static void main(String[] args) {
   
  +createChainsawGUI(true,null);
  +  }
  +
  +/**
  + * Creates, activates, and then shows the Chainsaw GUI, optionally showing
  + * the splash screen, and using the passed shutdown action when the user
  + * requests to exit the application (if null, then Chainsaw will exit the vm)
  + * 
  + * @param showSplash
  + */
  +  public static void createChainsawGUI(boolean showSplash, Action shutdownAction)
  +  {
   LogUI logUI = new LogUI();
  -showSplash(logUI);
  +if (showSplash)
  +{
  +  showSplash(logUI);
  +}
   
   logUI.handler = new ChainsawAppenderHandler();
   logUI.handler.addEventBatchListener(logUI.new NewTabEventBatchReceiver());
   LogManager.getRootLogger().addAppender(logUI.handler);
   logUI.activateViewer();
  +
  +if (shutdownAction!=null) {
  + logUI.setShutdownAction(shutdownAction);
 }
  +}
   
 public void activateViewer(ChainsawAppender appender) {
   handler = new ChainsawAppenderHandler(appender);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-10-08 Thread psmith
psmith  2003/10/08 14:57:40

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  reordered the point where the L&F is applied.  Under W2k the Welcome panel
  was still using the Metal L&F prior to this change.
  
  Revision  ChangesPath
  1.38  +14 -15jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- LogUI.java27 Sep 2003 01:50:34 -  1.37
  +++ LogUI.java8 Oct 2003 21:57:40 -   1.38
  @@ -417,21 +417,6 @@
   getSettingsManager().configure(
 new SettingsListener() {
   public void loadSettings(LoadSettingsEvent event) {
  -  lookAndFeelClassName = event.getSetting(LogUI.LOOK_AND_FEEL);
  -
  -  if (lookAndFeelClassName != null) {
  -applyLookAndFeel(lookAndFeelClassName);
  -  }
  -}
  -
  -public void saveSettings(SaveSettingsEvent event) {
  -  //required because of SettingsListener interface..not used during load
  -}
  -  });
  -
  -getSettingsManager().configure(
  -  new SettingsListener() {
  -public void loadSettings(LoadSettingsEvent event) {
 String configFile = event.getSetting(LogUI.CONFIG_FILE_TO_USE);
   
 //if both a config file are defined and a log4j.configuration property 
are set,  
  @@ -598,6 +583,20 @@
 exit();
   }
 });
  + getSettingsManager().configure(
  +   new SettingsListener() {
  + public void loadSettings(LoadSettingsEvent event) {
  +   lookAndFeelClassName = event.getSetting(LogUI.LOOK_AND_FEEL);
  +
  +   if (lookAndFeelClassName != null) {
  + applyLookAndFeel(lookAndFeelClassName);
  +   }
  + }
  +
  + public void saveSettings(SaveSettingsEvent event) {
  +   //required because of SettingsListener interface..not used during 
load
  + }
  +   });
   
   pack();
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-26 Thread psmith
psmith  2003/09/26 18:50:34

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Fixed a visual bug.  When the Tutorial was started, and the main LogUI screen
  resized, the status bar did not go through a layout validation, and
  so looked 'clipped'.
  
  Revision  ChangesPath
  1.37  +6 -1  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- LogUI.java23 Sep 2003 23:28:06 -  1.36
  +++ LogUI.java27 Sep 2003 01:50:34 -  1.37
  @@ -1268,18 +1268,23 @@
  *
  */
 public void setupTutorial() {
  +SwingUtilities.invokeLater(new Runnable(){
  +
  +  public void run() {
   Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
   setLocation(0, getLocation().y);
   
   double chainsawwidth = 0.7;
   double tutorialwidth = 1 - chainsawwidth;
   setSize((int) (screen.width * chainsawwidth), getSize().height);
  -
  +invalidate();
  +validate();
   Dimension size = getSize();
   Point loc = getLocation();
   tutorialFrame.setSize((int) (screen.width * tutorialwidth), size.height);
   tutorialFrame.setLocation(loc.x + size.width, loc.y);
   tutorialFrame.setVisible(true);
  +  }});
 }
   
 /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-23 Thread psmith
psmith  2003/09/23 16:13:14

  Modified:src/java/org/apache/log4j/chainsaw/help tutorial.html
Tutorial.java
   src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Tutorial dialog now has a toolbar to start/stop the tutorial.
  
  These actions are now encapsulated as proper Swing actions, with
  the buttons tracking their state correctly.
  
  Revision  ChangesPath
  1.4   +2 -2  
jakarta-log4j/src/java/org/apache/log4j/chainsaw/help/tutorial.html
  
  Index: tutorial.html
  ===
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/help/tutorial.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- tutorial.html 23 Sep 2003 04:10:01 -  1.3
  +++ tutorial.html 23 Sep 2003 23:13:14 -  1.4
  @@ -21,7 +21,7 @@
   If you would like to 
read more about Receivers first, then click here. (TODO)
   
   
  -When you are ready to begin the tutorial, click 
here.
  +When you are ready to begin the tutorial, click 
here, or click the "Start Tutorial" button in this dialog's toolbar.
   
   Receivers
   After you have said yes to the confirmation dialog, you should see 3 new tabs 
appear 
  @@ -112,7 +112,7 @@
   
   Show the Receivers panel () 
and shutdown each of the Generator Receivers by using the  icon.
   
  -For convenience you can simply click here, and 
Chainsaw will stop all the tutorial generators for you (If you created any other 
non-Generator Receivers, they will be left untouched).
  +For convenience you can simply click here or click on 
the Stop Tutorial button in this dialogs toolbar, and Chainsaw will stop all the 
tutorial generators for you (If you created any other non-Generator Receivers, they 
will be left untouched).
   
   
   Transmission Ends
  
  
  
  1.3   +0 -8  
jakarta-log4j/src/java/org/apache/log4j/chainsaw/help/Tutorial.java
  
  Index: Tutorial.java
  ===
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/help/Tutorial.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Tutorial.java 22 Sep 2003 06:55:27 -  1.2
  +++ Tutorial.java 23 Sep 2003 23:13:14 -  1.3
  @@ -53,8 +53,6 @@
   import org.apache.log4j.plugins.Plugin;
   import org.apache.log4j.plugins.PluginRegistry;
   
  -import javax.swing.JOptionPane;
  -
   
   /**
* A runnable element that installs into the Log4j environment some fake Receivers
  @@ -67,17 +65,11 @@
  * @see java.lang.Runnable#run()
  */
 public void run() {
  -if (
  -  JOptionPane.showConfirmDialog(
  -  null,
  -  "This will start 3 \"Generator\" receivers for use in the Tutorial.  Is 
that ok?",
  -  "Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
 Plugin p1 = new Generator("Generator 1");
 Plugin p2 = new Generator("Generator 2");
 Plugin p3 = new Generator("Generator 3");
 PluginRegistry.startPlugin(p1);
 PluginRegistry.startPlugin(p2);
 PluginRegistry.startPlugin(p3);
  -}
 }
   }
  
  
  
  1.35  +85 -15jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- LogUI.java23 Sep 2003 04:09:13 -  1.34
  +++ LogUI.java23 Sep 2003 23:13:14 -  1.35
  @@ -631,36 +631,98 @@
   final JEditorPane tutorialArea = new JEditorPane();
   tutorialArea.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
   tutorialArea.setEditable(false);
  +container.setLayout(new BorderLayout());
   
   try {
 tutorialArea.setPage(getWelcomePanel().getTutorialURL());
  -  container.add(new JScrollPane(tutorialArea));
  +  container.add(new JScrollPane(tutorialArea), BorderLayout.CENTER);
   } catch (Exception e) {
 LogLog.error("Error occurred loading the Tutorial", e);
   }
   
   tutorialFrame.setSize(new Dimension(640, 480));
   
  +final Action startTutorial =
  +  new AbstractAction(
  +"Start Tutorial", new ImageIcon(ChainsawIcons.ICON_RESUME_RECEIVER)) {
  +public void actionPerformed(ActionEvent e) {
  +  if (
  +JOptionPane.showConfirmDialog(
  +null,
  +"This will start 3 \"Generator\" receivers for use in the Tutorial. 
 Is that ok?",
  +"Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
  +new Thread(new Tutorial()).start();
  +putValue("TutorialStarted", Boolean.TRUE);
  +  } else {
  +putValue("Tu

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-22 Thread psmith
psmith  2003/09/22 21:09:13

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Added convenience hyperlink handler to halt all the tutorial
  Receivers.
  
  Revision  ChangesPath
  1.34  +16 -1 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- LogUI.java22 Sep 2003 07:02:59 -  1.33
  +++ LogUI.java23 Sep 2003 04:09:13 -  1.34
  @@ -647,6 +647,20 @@
 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
   if (e.getDescription().equals("StartTutorial")) {
 new Thread(new Tutorial()).start();
  +} else if (e.getDescription().equals("StopTutorial")) {
  +  new Thread(
  +new Runnable() {
  +  public void run() {
  +List list =
  +  PluginRegistry.getPlugins(
  +LogManager.getLoggerRepository(), Generator.class);
  +
  +for (Iterator iter = list.iterator(); iter.hasNext();) {
  +  Plugin plugin = (Plugin) iter.next();
  +  PluginRegistry.stopPlugin(plugin);
  +}
  +  }
  +}).start();
   } else {
 try {
   tutorialArea.setPage(e.getURL());
  @@ -1283,7 +1297,8 @@
 new Runnable() {
   public void run() {
 getTabbedPane().addANewTab(
  -ident, thisPanel, new ImageIcon(ChainsawIcons.ANIM_RADIO_TOWER));
  +ident, thisPanel, new ImageIcon(
  +  ChainsawIcons.ANIM_RADIO_TOWER));
   }
 });
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-22 Thread psmith
psmith  2003/09/22 00:02:59

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  When the Tutorial is kicked off, it is now located in a separate
  floating JFrame which resizes everything to sit next
  to the main GUI like a real help/tutorial should.
  
  Also some changes due to the addition of the Receiver icon.
  
  Revision  ChangesPath
  1.33  +80 -24jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- LogUI.java19 Sep 2003 03:56:56 -  1.32
  +++ LogUI.java22 Sep 2003 07:02:59 -  1.33
  @@ -53,6 +53,7 @@
   import org.apache.log4j.LogManager;
   import org.apache.log4j.Priority;
   import org.apache.log4j.UtilLoggingLevel;
  +import org.apache.log4j.chainsaw.help.Tutorial;
   import org.apache.log4j.chainsaw.icons.ChainsawIcons;
   import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
   import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  @@ -69,6 +70,7 @@
   
   import java.awt.BorderLayout;
   import java.awt.Component;
  +import java.awt.Container;
   import java.awt.Dimension;
   import java.awt.Event;
   import java.awt.Point;
  @@ -105,12 +107,15 @@
   
   import javax.swing.AbstractAction;
   import javax.swing.Action;
  +import javax.swing.BorderFactory;
   import javax.swing.ImageIcon;
   import javax.swing.JComponent;
   import javax.swing.JDialog;
  +import javax.swing.JEditorPane;
   import javax.swing.JFrame;
   import javax.swing.JOptionPane;
   import javax.swing.JPanel;
  +import javax.swing.JScrollPane;
   import javax.swing.JToolBar;
   import javax.swing.JWindow;
   import javax.swing.KeyStroke;
  @@ -119,6 +124,8 @@
   import javax.swing.event.ChangeEvent;
   import javax.swing.event.ChangeListener;
   import javax.swing.event.EventListenerList;
  +import javax.swing.event.HyperlinkEvent;
  +import javax.swing.event.HyperlinkListener;
   
   
   /**
  @@ -173,6 +180,7 @@
 private ChainsawAbout aboutBox;
 private final SettingsManager sm = SettingsManager.getInstance();
 private String lookAndFeelClassName;
  +  private final JFrame tutorialFrame = new JFrame("Chainsaw Tutorial");
   
 /**
  * Set to true, if and only if the GUI has completed
  @@ -202,6 +210,7 @@
  * when the user has requested Chainsaw to exit.
  */
 private EventListenerList shutdownListenerList = new EventListenerList();
  +  private WelcomePanel welcomePanel;
   
 /**
  * Constructor which builds up all the visual elements of the frame
  @@ -260,14 +269,6 @@
  * @param args
  */
 public static void main(String[] args) {
  -//TODO remove this when ready
  -JOptionPane.showMessageDialog(
  -  null,
  -  "Chainsaw v2 is currently going through some refactoring work at present.\n\n"
  -  + "Some features, most notably filtering and colouring, may be inoperable at 
this time.\n\n"
  -  + "The Log4J Dev team apologises for this inconvenience, but be assured this 
functionality will be back very shortly.",
  -  "Apologise", JOptionPane.WARNING_MESSAGE);
  -
   showSplash();
   
   LogUI logUI = new LogUI();
  @@ -347,6 +348,8 @@
  * layout, table columns, and sets itself viewable.
  */
 public void activateViewer() {
  +welcomePanel = new WelcomePanel(this);
  +
   final SocketNodeEventListener socketListener =
 new SocketNodeEventListener() {
   public void socketOpened(String remoteInfo) {
  @@ -586,6 +589,8 @@
   getContentPane().add(toolbar, BorderLayout.NORTH);
   getContentPane().add(panePanel, BorderLayout.CENTER);
   getContentPane().add(statusBar, BorderLayout.SOUTH);
  +receiversPanel.setVisible(false);
  +getContentPane().add(receiversPanel, BorderLayout.EAST);
   
   addWindowListener(
 new WindowAdapter() {
  @@ -621,6 +626,37 @@
   if (noReceiversDefined) {
 showNoReceiversWarningPanel();
   }
  +
  +Container container = tutorialFrame.getContentPane();
  +final JEditorPane tutorialArea = new JEditorPane();
  +tutorialArea.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
  +tutorialArea.setEditable(false);
  +
  +try {
  +  tutorialArea.setPage(getWelcomePanel().getTutorialURL());
  +  container.add(new JScrollPane(tutorialArea));
  +} catch (Exception e) {
  +  LogLog.error("Error occurred loading the Tutorial", e);
  +}
  +
  +tutorialFrame.setSize(new Dimension(640, 480));
  +
  +tutorialArea.addHyperlinkListener(
  +  new HyperlinkListener() {
  +public void hyperlinkUpdate(HyperlinkEvent e) {
  +  if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
  +if (e.getDescription().equals("StartTut

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-18 Thread psmith
psmith  2003/09/18 20:56:56

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Small change to Plugin Listener notification within Chainsaw.
  
  Revision  ChangesPath
  1.32  +47 -21jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- LogUI.java18 Sep 2003 04:03:38 -  1.31
  +++ LogUI.java19 Sep 2003 03:56:56 -  1.32
  @@ -49,6 +49,24 @@
   
   package org.apache.log4j.chainsaw;
   
  +import org.apache.log4j.Level;
  +import org.apache.log4j.LogManager;
  +import org.apache.log4j.Priority;
  +import org.apache.log4j.UtilLoggingLevel;
  +import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  +import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  +import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  +import org.apache.log4j.chainsaw.prefs.SettingsListener;
  +import org.apache.log4j.chainsaw.prefs.SettingsManager;
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.helpers.OptionConverter;
  +import org.apache.log4j.net.SocketNodeEventListener;
  +import org.apache.log4j.plugins.Plugin;
  +import org.apache.log4j.plugins.PluginEvent;
  +import org.apache.log4j.plugins.PluginListener;
  +import org.apache.log4j.plugins.PluginRegistry;
  +import org.apache.log4j.plugins.Receiver;
  +
   import java.awt.BorderLayout;
   import java.awt.Component;
   import java.awt.Dimension;
  @@ -63,15 +81,20 @@
   import java.awt.event.MouseEvent;
   import java.awt.event.WindowAdapter;
   import java.awt.event.WindowEvent;
  +
   import java.beans.PropertyChangeEvent;
   import java.beans.PropertyChangeListener;
  +
   import java.io.BufferedInputStream;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.IOException;
   import java.io.ObjectInputStream;
  +
   import java.lang.reflect.Method;
  +
   import java.net.URL;
  +
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -97,24 +120,6 @@
   import javax.swing.event.ChangeListener;
   import javax.swing.event.EventListenerList;
   
  -import org.apache.log4j.Level;
  -import org.apache.log4j.LogManager;
  -import org.apache.log4j.Priority;
  -import org.apache.log4j.UtilLoggingLevel;
  -import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  -import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  -import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  -import org.apache.log4j.chainsaw.prefs.SettingsListener;
  -import org.apache.log4j.chainsaw.prefs.SettingsManager;
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.helpers.OptionConverter;
  -import org.apache.log4j.net.SocketNodeEventListener;
  -import org.apache.log4j.plugins.Plugin;
  -import org.apache.log4j.plugins.PluginEvent;
  -import org.apache.log4j.plugins.PluginListener;
  -import org.apache.log4j.plugins.PluginRegistry;
  -import org.apache.log4j.plugins.Receiver;
  -
   
   /**
* The main entry point for Chainsaw, this class represents the first frame
  @@ -357,9 +362,19 @@
 new PluginListener() {
   public void pluginStarted(PluginEvent e) {
 statusBar.setMessage(e.getPlugin().getName() + " started!");
  +
  +  Method method = getAddListenerMethod(e.getPlugin());
  +
  +  if (method != null) {
  +try {
  +  method.invoke(e.getPlugin(), new Object[] { socketListener });
  +} catch (Exception ex) {
  +  LogLog.error("Failed to add a SocketNodeEventListener", ex);
  +}
  +  }
   }
   
  -Method getSocketNodeEventListenerMethod(Plugin p) {
  +Method getRemoveListenerMethod(Plugin p) {
 try {
   return p.getClass().getMethod(
 "removeSocketNodeEventListener",
  @@ -369,8 +384,18 @@
 }
   }
   
  +Method getAddListenerMethod(Plugin p) {
  +  try {
  +return p.getClass().getMethod(
  +  "addSocketNodeEventListener",
  +  new Class[] { SocketNodeEventListener.class });
  +  } catch (Exception e) {
  +return null;
  +  }
  +}
  +
   public void pluginStopped(PluginEvent e) {
  -  Method method = getSocketNodeEventListenerMethod(e.getPlugin());
  +  Method method = getRemoveListenerMethod(e.getPlugin());
   
 if (method != null) {
   try {
  @@ -379,7 +404,8 @@
 LogLog.error("Failed to remove SocketNodeEventListener", ex);
   }
 }
  -   statusBar.setMessage(e.getPlugin().getName() + " stopped!");
  +
  +  statusBar.setMessage(e.getPlugin().getName() + " stopped!");
 

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-17 Thread psmith
psmith  2003/09/17 21:03:38

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Things that like to react when new Plugins are started/stopped
  are now decoupled from the things that actually
  create/stop them.  Much cleaner.
  
  Revision  ChangesPath
  1.31  +107 -89   jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- LogUI.java17 Sep 2003 01:25:23 -  1.30
  +++ LogUI.java18 Sep 2003 04:03:38 -  1.31
  @@ -49,22 +49,6 @@
   
   package org.apache.log4j.chainsaw;
   
  -import org.apache.log4j.Level;
  -import org.apache.log4j.LogManager;
  -import org.apache.log4j.Priority;
  -import org.apache.log4j.UtilLoggingLevel;
  -import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  -import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  -import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  -import org.apache.log4j.chainsaw.prefs.SettingsListener;
  -import org.apache.log4j.chainsaw.prefs.SettingsManager;
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.helpers.OptionConverter;
  -import org.apache.log4j.net.SocketNodeEventListener;
  -import org.apache.log4j.net.SocketReceiver;
  -import org.apache.log4j.plugins.PluginRegistry;
  -import org.apache.log4j.plugins.Receiver;
  -
   import java.awt.BorderLayout;
   import java.awt.Component;
   import java.awt.Dimension;
  @@ -79,20 +63,15 @@
   import java.awt.event.MouseEvent;
   import java.awt.event.WindowAdapter;
   import java.awt.event.WindowEvent;
  -
   import java.beans.PropertyChangeEvent;
   import java.beans.PropertyChangeListener;
  -
   import java.io.BufferedInputStream;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.IOException;
   import java.io.ObjectInputStream;
  -
   import java.lang.reflect.Method;
  -
   import java.net.URL;
  -
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -118,6 +97,24 @@
   import javax.swing.event.ChangeListener;
   import javax.swing.event.EventListenerList;
   
  +import org.apache.log4j.Level;
  +import org.apache.log4j.LogManager;
  +import org.apache.log4j.Priority;
  +import org.apache.log4j.UtilLoggingLevel;
  +import org.apache.log4j.chainsaw.icons.ChainsawIcons;
  +import org.apache.log4j.chainsaw.prefs.LoadSettingsEvent;
  +import org.apache.log4j.chainsaw.prefs.SaveSettingsEvent;
  +import org.apache.log4j.chainsaw.prefs.SettingsListener;
  +import org.apache.log4j.chainsaw.prefs.SettingsManager;
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.helpers.OptionConverter;
  +import org.apache.log4j.net.SocketNodeEventListener;
  +import org.apache.log4j.plugins.Plugin;
  +import org.apache.log4j.plugins.PluginEvent;
  +import org.apache.log4j.plugins.PluginListener;
  +import org.apache.log4j.plugins.PluginRegistry;
  +import org.apache.log4j.plugins.Receiver;
  +
   
   /**
* The main entry point for Chainsaw, this class represents the first frame
  @@ -345,6 +342,49 @@
  * layout, table columns, and sets itself viewable.
  */
 public void activateViewer() {
  +final SocketNodeEventListener socketListener =
  +  new SocketNodeEventListener() {
  +public void socketOpened(String remoteInfo) {
  +  statusBar.remoteConnectionReceived(remoteInfo);
  +}
  +
  +public void socketClosedEvent(Exception e) {
  +  statusBar.setMessage("Collection lost! :: " + e.getMessage());
  +}
  +  };
  +
  +PluginListener pluginListener =
  +  new PluginListener() {
  +public void pluginStarted(PluginEvent e) {
  +  statusBar.setMessage(e.getPlugin().getName() + " started!");
  +}
  +
  +Method getSocketNodeEventListenerMethod(Plugin p) {
  +  try {
  +return p.getClass().getMethod(
  +  "removeSocketNodeEventListener",
  +  new Class[] { SocketNodeEventListener.class });
  +  } catch (Exception e) {
  +return null;
  +  }
  +}
  +
  +public void pluginStopped(PluginEvent e) {
  +  Method method = getSocketNodeEventListenerMethod(e.getPlugin());
  +
  +  if (method != null) {
  +try {
  +  method.invoke(e.getPlugin(), new Object[] { socketListener });
  +} catch (Exception ex) {
  +  LogLog.error("Failed to remove SocketNodeEventListener", ex);
  +}
  +  }
  +   statusBar.setMessage(e.getPlugin().getName() + " stopped!");
  +}
  +  };
  +
  +PluginRegistry.addPluginListener(pluginListener);
  +
   getSettingsManager().configure(
 new SettingsListener(

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-16 Thread psmith
psmith  2003/09/16 18:25:23

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Removed the need to notify the status bar of events being
  received, the data rate is handling this.
  
  Revision  ChangesPath
  1.30  +0 -5  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- LogUI.java15 Sep 2003 22:13:26 -  1.29
  +++ LogUI.java17 Sep 2003 01:25:23 -  1.30
  @@ -1133,11 +1133,6 @@
   }
 }
   
  -  /**
  -   * notify the status bar we received an event
  -   */
  -  statusBar.receivedEvent();
  -
 if (!getPanelMap().containsKey(ident)) {
   final String eventType =
 ((ChainsawEventBatchEntry) eventBatchEntrys.get(0)).getEventType();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-14 Thread psmith
psmith  2003/09/14 23:38:35

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Fixed bug where a settings Listener was never given a chance to load settings
  and so the previous configs used were not presented
  in the No Receivers Warning dialog.
  
  Revision  ChangesPath
  1.28  +25 -23jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- LogUI.java14 Sep 2003 23:47:26 -  1.27
  +++ LogUI.java15 Sep 2003 06:38:35 -  1.28
  @@ -589,33 +589,34 @@
final NoReceiversWarningPanel noReceiversWarningPanel =
 new NoReceiversWarningPanel();
   
  + final SettingsListener sl = new SettingsListener() {
  +   public void loadSettings(LoadSettingsEvent event) {
  + int size = event.asInt("SavedConfigs.Size");
  + Object[] configs = new Object[size];
  +
  + for (int i = 0; i < size; i++) {
  +   configs[i] = event.getSetting("SavedConfigs." + i);
  + }
  +
  + noReceiversWarningPanel.getModel().setRememberedConfigs(configs);
  +   }
  +
  +   public void saveSettings(SaveSettingsEvent event) {
  + Object[] configs =
  +   noReceiversWarningPanel.getModel().getRememberedConfigs();
  + event.saveSetting("SavedConfigs.Size", configs.length);
  +
  + for (int i = 0; i < configs.length; i++) {
  +   event.saveSetting("SavedConfigs." + i, configs[i].toString());
  + }
  +   }
  + };
  /**
* This listener sets up the NoReciversWarningPanel and
* loads saves the configs/logfiles
*/
  -   getSettingsManager().addSettingsListener(
  -  new SettingsListener() {
  -public void loadSettings(LoadSettingsEvent event) {
  -  int size = event.asInt("SavedConfigs.Size");
  -  Object[] configs = new Object[size];
  -
  -  for (int i = 0; i < size; i++) {
  -configs[i] = event.getSetting("SavedConfigs." + i);
  -  }
  -
  -  noReceiversWarningPanel.getModel().setRememberedConfigs(configs);
  -}
  -
  -public void saveSettings(SaveSettingsEvent event) {
  -  Object[] configs =
  -noReceiversWarningPanel.getModel().getRememberedConfigs();
  -  event.saveSetting("SavedConfigs.Size", configs.length);
  -
  -  for (int i = 0; i < configs.length; i++) {
  -event.saveSetting("SavedConfigs." + i, configs[i].toString());
  -  }
  -}
  -  });
  +   getSettingsManager().addSettingsListener(sl);
  +   getSettingsManager().configure(sl);
   
   SwingUtilities.invokeLater(
 new Runnable() {
  @@ -690,6 +691,7 @@
   } catch (Exception e) {
 LogLog.error("Error initializing Log4j", e);
   }
  +
LogManager.getLoggerRepository().getRootLogger().addAppender(handler);
   
   receiversPanel.updateReceiverTreeInDispatchThread();
 }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java ChainsawAppenderHandler.java ChainsawStatusBar.java

2003-09-14 Thread psmith
psmith  2003/09/14 16:47:27

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
ChainsawAppenderHandler.java ChainsawStatusBar.java
  Log:
  For a bit of fun, I added a Data Rate concept to the
  object that receives and processes events inside Chainsaw,
  and displayed it in the Status bar.
  
  Revision  ChangesPath
  1.27  +9 -0  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- LogUI.java11 Sep 2003 09:42:31 -  1.26
  +++ LogUI.java14 Sep 2003 23:47:26 -  1.27
  @@ -553,6 +553,15 @@
 });
   
   pack();
  +
  +this.handler.addPropertyChangeListener("dataRate", new PropertyChangeListener(){
  +
  + public void propertyChange(PropertyChangeEvent evt) {
  + double dataRate = ((Double)evt.getNewValue()).doubleValue();
  + LogLog.debug("dataRate=" + dataRate);
  + statusBar.setDataRate(dataRate);
  + 
  + }});
   
   getSettingsManager().addSettingsListener(this);
   getSettingsManager().addSettingsListener(getToolBarAndMenus());
  
  
  
  1.6   +121 -39   
jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java
  
  Index: ChainsawAppenderHandler.java
  ===
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChainsawAppenderHandler.java  4 Sep 2003 02:27:15 -   1.5
  +++ ChainsawAppenderHandler.java  14 Sep 2003 23:47:26 -  1.6
  @@ -57,6 +57,9 @@
   import org.apache.log4j.spi.LocationInfo;
   import org.apache.log4j.spi.LoggingEvent;
   
  +import java.beans.PropertyChangeListener;
  +import java.beans.PropertyChangeSupport;
  +
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Date;
  @@ -85,6 +88,9 @@
 private final Object mutex = new Object();
 private int sleepInterval = 1000;
 private EventListenerList listenerList = new EventListenerList();
  +  private double dataRate = 0.0;
  +  private PropertyChangeSupport propertySupport =
  +new PropertyChangeSupport(this);
   
 public ChainsawAppenderHandler(ChainsawAppender appender) {
   this.appender = appender;
  @@ -133,7 +139,7 @@
  * Converts a LoggingEvent into a Vector of element (columns really).
  * @param event
  * @return
  -   * 
  +   *
  * @deprecated
  */
 public static Vector convert(LoggingEvent event) {
  @@ -234,7 +240,7 @@
  * @param v
  * @return
  */
  -private static String getTabIdentifier(LoggingEvent e) {
  +  private static String getTabIdentifier(LoggingEvent e) {
   StringBuffer ident = new StringBuffer();
   String machinename = e.getProperty(ChainsawConstants.LOG4J_MACHINE_KEY);
   
  @@ -243,7 +249,7 @@
   }
   
   String appname = e.getProperty(ChainsawConstants.LOG4J_APP_KEY);
  -
  +
   if (appname != null) {
 ident.append("-");
 ident.append(appname);
  @@ -253,16 +259,19 @@
 /**
  * Maybe there's a Remote Host entry?
  */
  -  String remoteHost = e.getProperty(ChainsawConstants.LOG4J_REMOTEHOST_KEY);
  -  if(remoteHost!=null) {
  -int colonIndex = remoteHost.indexOf(":");
  -
  -if (colonIndex == -1) {
  -  colonIndex = remoteHost.length();
  -}
  -
  -remoteHost = remoteHost.substring(0, colonIndex);
  -  }
  +  String remoteHost =
  +e.getProperty(ChainsawConstants.LOG4J_REMOTEHOST_KEY);
  +
  +  if (remoteHost != null) {
  +int colonIndex = remoteHost.indexOf(":");
  +
  +if (colonIndex == -1) {
  +  colonIndex = remoteHost.length();
  +}
  +
  +remoteHost = remoteHost.substring(0, colonIndex);
  +  }
  +
 if (remoteHost != null) {
   ident.append(remoteHost);
 }
  @@ -276,6 +285,91 @@
 }
   
 /**
  +   * A little test bed
  +   * @param args
  +   */
  +  public static void main(String[] args) throws InterruptedException {
  +ChainsawAppenderHandler handler = new ChainsawAppenderHandler();
  +handler.addEventBatchListener(
  +  new EventBatchListener() {
  +public String getInterestedIdentifier() {
  +  return null;
  +}
  +
  +public void receiveEventBatch(
  +  String identifier, List eventBatchEntrys) {
  +  LogLog.debug(
  +"received batch for '" + identifier + "', list.size()="
  + 

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-11 Thread psmith
psmith  2003/09/11 02:42:31

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  If the selected L&F is not Metal, then the No Receiver Warning dialog
  looks out of place, as it was initialised before the L&F is loaded from 
  the preferences.
  
  Revision  ChangesPath
  1.26  +31 -30jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- LogUI.java10 Sep 2003 03:18:33 -  1.25
  +++ LogUI.java11 Sep 2003 09:42:31 -  1.26
  @@ -171,8 +171,6 @@
 private ChainsawAbout aboutBox;
 private final SettingsManager sm = SettingsManager.getInstance();
 private String lookAndFeelClassName;
  -  private final NoReceiversWarningPanel noReceiversWarningPanel =
  -new NoReceiversWarningPanel();
   
 /**
  * Set to true, if and only if the GUI has completed
  @@ -394,34 +392,6 @@
   }
 });
   
  -/**
  - * This listener sets up the NoReciversWarningPanel and
  - * loads saves the configs/logfiles
  - */
  -getSettingsManager().addSettingsListener(
  -  new SettingsListener() {
  -public void loadSettings(LoadSettingsEvent event) {
  -  int size = event.asInt("SavedConfigs.Size");
  -  Object[] configs = new Object[size];
  -
  -  for (int i = 0; i < size; i++) {
  -configs[i] = event.getSetting("SavedConfigs." + i);
  -  }
  -
  -  noReceiversWarningPanel.getModel().setRememberedConfigs(configs);
  -}
  -
  -public void saveSettings(SaveSettingsEvent event) {
  -  Object[] configs =
  -noReceiversWarningPanel.getModel().getRememberedConfigs();
  -  event.saveSetting("SavedConfigs.Size", configs.length);
  -
  -  for (int i = 0; i < configs.length; i++) {
  -event.saveSetting("SavedConfigs." + i, configs[i].toString());
  -  }
  -}
  -  });
  -
   if (
 PluginRegistry.getPlugins(
 LogManager.getLoggerRepository(), Receiver.class).size() == 0) {
  @@ -607,6 +577,37 @@
  * and allows the user to choose some options for configuration
  */
 private void showNoReceiversWarningPanel() {
  + final NoReceiversWarningPanel noReceiversWarningPanel =
  +  new NoReceiversWarningPanel();
  +
  +   /**
  + * This listener sets up the NoReciversWarningPanel and
  + * loads saves the configs/logfiles
  + */
  +   getSettingsManager().addSettingsListener(
  +  new SettingsListener() {
  +public void loadSettings(LoadSettingsEvent event) {
  +  int size = event.asInt("SavedConfigs.Size");
  +  Object[] configs = new Object[size];
  +
  +  for (int i = 0; i < size; i++) {
  +configs[i] = event.getSetting("SavedConfigs." + i);
  +  }
  +
  +  noReceiversWarningPanel.getModel().setRememberedConfigs(configs);
  +}
  +
  +public void saveSettings(SaveSettingsEvent event) {
  +  Object[] configs =
  +noReceiversWarningPanel.getModel().getRememberedConfigs();
  +  event.saveSetting("SavedConfigs.Size", configs.length);
  +
  +  for (int i = 0; i < configs.length; i++) {
  +event.saveSetting("SavedConfigs." + i, configs[i].toString());
  +  }
  +}
  +  });
  +
   SwingUtilities.invokeLater(
 new Runnable() {
   public void run() {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-04 Thread psmith
psmith  2003/09/04 23:08:42

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  When a simple receiver is created, it's threshold is
  now set to be DEBUG.
  
  The rationale here is that otherwise it doesn't have a Level,
  and the GUI looks better when one is explicityl defined.
  
  Revision  ChangesPath
  1.22  +3 -1  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- LogUI.java5 Sep 2003 03:39:43 -   1.21
  +++ LogUI.java5 Sep 2003 06:08:42 -   1.22
  @@ -707,7 +707,9 @@
 "setPort", new Class[] { int.class });
 portMethod.invoke(
   simpleReceiver, new Object[] { new Integer(port) });
  -
  + 
  + simpleReceiver.setThreshold(Level.DEBUG);
  + 
 PluginRegistry.startPlugin(simpleReceiver);
 receiversPanel.updateReceiverTreeInDispatchThread();
 getStatusBar().setMessage(
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java ChainsawCyclicBufferTableModel.java EventContainer.java

2003-09-04 Thread psmith
psmith  2003/09/04 20:39:43

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
ChainsawCyclicBufferTableModel.java
EventContainer.java
  Log:
  Added NewKeyListener support to the model and the GUI.
  
  Now when a new MDC key arrives via a LoggingEvent into
  the table model, a listener ensures that a new Column
  is automatically added to the visible Table to ensure it is displayed
  correctly.
  
  Revision  ChangesPath
  1.21  +26 -9 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- LogUI.java4 Sep 2003 23:45:38 -   1.20
  +++ LogUI.java5 Sep 2003 03:39:43 -   1.21
  @@ -772,10 +772,9 @@
 }
   
 void removeWelcomePanel() {
  -if(tabbedPane.containsWelcomePanel()) {
  -tabbedPane.remove(
  -  tabbedPane.getComponentAt(tabbedPane.indexOfTab("Welcome")));
  -
  +if (tabbedPane.containsWelcomePanel()) {
  +  tabbedPane.remove(
  +tabbedPane.getComponentAt(tabbedPane.indexOfTab("Welcome")));
   }
 }
   
  @@ -1148,6 +1147,8 @@
 ((ChainsawEventBatchEntry) eventBatchEntrys.get(0)).getEventType();
   final LogPanel thisPanel = new LogPanel(ident, eventType);
   
  +sm.configure(thisPanel);
  +
   /**
* Let the new LogPanel receive this batch
*/
  @@ -1166,8 +1167,6 @@
   }
 });
   
  -sm.configure(thisPanel);
  -
   String msg = "added tab " + ident;
   LogLog.debug(msg);
   statusBar.setMessage(msg);
  @@ -1261,6 +1260,16 @@
   
 table.setAutoCreateColumnsFromModel(false);
   
  +  /**
  +   * We listen for new Key's coming in so we can get them automatically 
added as columns
  +  */
  +  tableModel.addNewKeyListener(
  +new NewKeyListener() {
  +  public void newKeyAdded(NewKeyEvent e) {
  +table.addColumn(new TableColumn(e.getNewModelIndex()));
  +  }
  +});
  +
 table.setRowHeight(20);
 table.setShowGrid(false);
   
  @@ -2231,9 +2240,16 @@
   
   while (e.hasMoreElements()) {
 TableColumn c = (TableColumn) e.nextElement();
  -  o.writeObject(
  -new TableColumnData(
  -  (String) c.getHeaderValue(), c.getModelIndex(), c.getWidth()));
  +
  +  if (c.getModelIndex() < ChainsawColumns.getColumnsNames().size()) {
  +o.writeObject(
  +  new TableColumnData(
  +(String) c.getHeaderValue(), c.getModelIndex(), c.getWidth()));
  +  } else {
  +LogLog.debug(
  +  "Not saving col ' " + c.getHeaderValue()
  +  + "' not part of standard columns");
  +  }
   }
   
   o.flush();
  @@ -2742,6 +2758,7 @@
   }
   
   public void columnAdded(TableColumnModelEvent e) {
  +  LogLog.debug("Detected columnAdded" + e);
   }
   
   public void columnRemoved(TableColumnModelEvent e) {
  
  
  
  1.4   +76 -16
jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
  
  Index: ChainsawCyclicBufferTableModel.java
  ===
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ChainsawCyclicBufferTableModel.java   3 Sep 2003 05:44:51 -   1.3
  +++ ChainsawCyclicBufferTableModel.java   5 Sep 2003 03:39:43 -   1.4
  @@ -49,21 +49,24 @@
   
   package org.apache.log4j.chainsaw;
   
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.spi.LocationInfo;
  -import org.apache.log4j.spi.LoggingEvent;
  -
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Collections;
   import java.util.Date;
  +import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.Set;
   import java.util.Vector;
   
   import javax.swing.SwingUtilities;
  +import javax.swing.event.EventListenerList;
   import javax.swing.table.AbstractTableModel;
   
  +import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.spi.LocationInfo;
  +import org.apache.log4j.spi.LoggingEvent;
  +
   
   /**
* A CyclicBuffer implementation of the EventContainer.
  @@ -84,9 +87,12 @@
 private final int INITIAL_CAPACITY = 1024;
 final List unfilteredList;
 final List filteredList;
  -  private Vector countListeners = new Vector();
  +
  +  //  private Vector countListeners = new Vector();
 private bool

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-03 Thread psmith
psmith  2003/09/03 22:45:16

  Modified:src/java/org/apache/log4j/chainsaw/layout
EventDetailLayout.java
   src/java/org/apache/log4j/chainsaw LogUI.java
  Added:   src/java/org/apache/log4j/chainsaw/layout
DefaultLayoutFactory.java LayoutEditorPane.java
  Log:
  added support for a PatternLayout Editor dialog which
  edits and sets the Layout used in the Event detail pane.
  
  Allows user to Edit pattern text and shows a running preview
  of the result in a preview pane as you type.
  
  Refactored the loading of the default html pattern text into
  a separate class.
  
  Revision  ChangesPath
  1.2   +7 -52 
jakarta-log4j/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
  
  Index: EventDetailLayout.java
  ===
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EventDetailLayout.java4 Sep 2003 02:30:28 -   1.1
  +++ EventDetailLayout.java4 Sep 2003 05:45:16 -   1.2
  @@ -52,80 +52,35 @@
   import org.apache.log4j.Layout;
   import org.apache.log4j.Logger;
   import org.apache.log4j.PatternLayout;
  -import org.apache.log4j.helpers.LogLog;
   import org.apache.log4j.spi.LocationInfo;
   import org.apache.log4j.spi.LoggingEvent;
   
  -import java.io.BufferedReader;
   import java.io.IOException;
  -import java.io.InputStreamReader;
   import java.io.Writer;
   
  -import java.net.URL;
  -
   import java.util.Hashtable;
   import java.util.Iterator;
   import java.util.Set;
   
  -import javax.swing.text.html.HTMLEditorKit;
  -
   
   /**
* This layout is used for formatting HTML text for use inside
* the Chainsaw Event Detail Panel, and the tooltip used
  - * when mouse-over on a particular log event row
  + * when mouse-over on a particular log event row.
  + *
  + * It relies an an internal PatternLayout to accomplish this, but ensures HTML 
characters
  + * from any LoggingEvent are escaped first.
*
* @author Paul Smith <[EMAIL PROTECTED]>
*/
   public class EventDetailLayout extends Layout {
  -  private PatternLayout patternLayout =
  -new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN);
  +  private PatternLayout patternLayout = new PatternLayout();
   
 public EventDetailLayout() {
  -URL defaultLayoutURL =
  -  this.getClass().getClassLoader().getResource(
  -"org/apache/log4j/chainsaw/layout/DefaultDetailLayout.html");
  -
  -if (defaultLayoutURL == null) {
  -  LogLog.warn(
  -"Could not locate the default Layout for Event Details and Tooltips");
  -} else {
  -  HTMLEditorKit kit = new HTMLEditorKit();
  -
  -  try {
  -StringBuffer content = new StringBuffer();
  -BufferedReader reader = null;
  -
  -try {
  -  reader =
  -new BufferedReader(
  -  new InputStreamReader(defaultLayoutURL.openStream()));
  -
  -  String line = "";
  -
  -  while ((line = reader.readLine()) != null) {
  -content.append(line);
  -  }
  -} finally {
  -  if (reader != null) {
  -reader.close();
  -  }
  -}
  -
  -if (content != null) {
  -  LogLog.debug("Loaded layout content:\n" + content);
  -  patternLayout.setConversionPattern(content.toString());
  -} else {
  -  LogLog.warn("No Layout content retrieved, using default");
  -}
  -  } catch (Exception e) {
  -LogLog.error("Failed to read in the Layout", e);
  -  }
  -}
 }
   
  -  public void setConverionPatter(String conversionPatter) {
  -patternLayout.setConversionPattern(conversionPatter);
  +  public void setConversionPattern(String conversionPattern) {
  +patternLayout.setConversionPattern(conversionPattern);
 }
   
 public String getConversionPattern() {
  
  
  
  1.1  
jakarta-log4j/src/java/org/apache/log4j/chainsaw/layout/DefaultLayoutFactory.java
  
  Index: DefaultLayoutFactory.java
  ===
  /*
   * 
   *   The Apache Software License, Version 1.1
   * 
   *
   *Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *
   * 1. Redistributions of  source code must  retain the above copyright  notice,
   *this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce 

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java NoReceiversWarningPanel.java

2003-09-03 Thread psmith
psmith  2003/09/03 00:37:19

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
NoReceiversWarningPanel.java
  Log:
  Updated the dialog displayed when no Receivers are defined.
  
  Can now choose either a SocketReceiver or SocketHubReceiver
  as part of the simple receiver creation process.
  
  These 2 are the most probably receivers to be created by
  new users, so this seems appropriate to have.
  
  Revision  ChangesPath
  1.17  +19 -8 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- LogUI.java3 Sep 2003 05:50:01 -   1.16
  +++ LogUI.java3 Sep 2003 07:37:19 -   1.17
  @@ -105,6 +105,7 @@
   import java.io.ObjectOutputStream;
   import java.io.Serializable;
   
  +import java.lang.reflect.Method;
   import java.net.URL;
   
   import java.text.NumberFormat;
  @@ -687,15 +688,25 @@
   
 if (noReceiversWarningPanel.getModel().isManualMode()) {
   toggleReceiversPanel();
  -  } else if (noReceiversWarningPanel.getModel().isSimpleSocketMode()) {
  +  } else if (noReceiversWarningPanel.getModel().isSimpleReceiverMode()) {
   int port = noReceiversWarningPanel.getModel().getSimplePort();
  -SocketReceiver simpleSocketReceiver = new SocketReceiver(port);
  -simpleSocketReceiver.setName("Simple Socket Receiver");
  -PluginRegistry.startPlugin(simpleSocketReceiver);
  -receiversPanel.updateReceiverTreeInDispatchThread();
  -getStatusBar().setMessage(
  -  "Simple Socket Receiver created, started, and listening on port "
  -  + port);
  +Class receiverClass = 
noReceiversWarningPanel.getModel().getSimpleReceiverClass();
  +try {
  + Receiver simpleReceiver =
  + (Receiver) receiverClass.newInstance();
  + simpleReceiver.setName("Simple Receiver");
  +Method portMethod = simpleReceiver.getClass().getMethod("setPort", 
new Class[] {int.class});
  +portMethod.invoke(simpleReceiver, new Object[] {new Integer(port)});
  +
  + PluginRegistry.startPlugin(simpleReceiver);
  + receiversPanel.updateReceiverTreeInDispatchThread();
  + getStatusBar().setMessage(
  + "Simple Receiver created, started, and 
listening on port  "
  + + port + " (using " + 
receiverClass.getName() + ")");
  + } catch (Exception e) {
  + LogLog.error("Error creating Receiver", e);
  +getStatusBar().setMessage("An error occurred creating your 
Receiver");
  + }
 } else if (noReceiversWarningPanel.getModel().isLoadConfig()) {
   final URL url =
 noReceiversWarningPanel.getModel().getConfigToLoad();
  
  
  
  1.5   +55 -18
jakarta-log4j/src/java/org/apache/log4j/chainsaw/NoReceiversWarningPanel.java
  
  Index: NoReceiversWarningPanel.java
  ===
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/NoReceiversWarningPanel.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NoReceiversWarningPanel.java  2 Sep 2003 01:07:00 -   1.4
  +++ NoReceiversWarningPanel.java  3 Sep 2003 07:37:19 -   1.5
  @@ -51,10 +51,7 @@
*/
   package org.apache.log4j.chainsaw;
   
  -import org.apache.log4j.helpers.LogLog;
  -import org.apache.log4j.net.PortBased;
  -import org.apache.log4j.net.SocketAppender;
  -
  +import java.awt.Component;
   import java.awt.Dimension;
   import java.awt.GridBagConstraints;
   import java.awt.GridBagLayout;
  @@ -63,9 +60,7 @@
   import java.awt.event.ActionListener;
   import java.awt.event.FocusEvent;
   import java.awt.event.FocusListener;
  -
   import java.io.File;
  -
   import java.net.MalformedURLException;
   import java.net.URL;
   
  @@ -74,10 +69,13 @@
   import javax.swing.Box;
   import javax.swing.ButtonGroup;
   import javax.swing.DefaultComboBoxModel;
  +import javax.swing.DefaultListCellRenderer;
   import javax.swing.JButton;
   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.JTextArea;
  @@ -86,6 +84,12 @@
   import javax.swing.event.ListDataListene

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-02 Thread psmith
psmith  2003/09/02 22:50:02

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  * refactored Pause functionality
  
  * Change from Vector -> LoggingEvent
  
  * Event Detail and Tooltip now rendered by a Layout class.
  
  Revision  ChangesPath
  1.16  +151 -63   jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- LogUI.java3 Sep 2003 00:44:55 -   1.15
  +++ LogUI.java3 Sep 2003 05:50:01 -   1.16
  @@ -49,6 +49,8 @@
   
   package org.apache.log4j.chainsaw;
   
  +import org.apache.log4j.HTMLLayout;
  +import org.apache.log4j.Layout;
   import org.apache.log4j.Level;
   import org.apache.log4j.LogManager;
   import org.apache.log4j.Priority;
  @@ -64,6 +66,8 @@
   import org.apache.log4j.net.SocketReceiver;
   import org.apache.log4j.plugins.PluginRegistry;
   import org.apache.log4j.plugins.Receiver;
  +import org.apache.log4j.spi.LocationInfo;
  +import org.apache.log4j.spi.LoggingEvent;
   
   import java.awt.BorderLayout;
   import java.awt.Component;
  @@ -207,7 +211,8 @@
 private ChainsawStatusBar statusBar;
 private final Map tableModelMap = new HashMap();
 private final Map tableMap = new HashMap();
  -  final List pausedList = new Vector();
  +
  +  //  final List pausedList = new Vector();
 private final List filterableColumns = new ArrayList();
 private final Map entryMap = new HashMap();
 private final Map panelMap = new HashMap();
  @@ -307,6 +312,14 @@
  * @param args
  */
 public static void main(String[] args) {
  +
  +//TODO remove this when ready
  +JOptionPane.showMessageDialog(
  +  null,
  +  "Chainsaw v2 is currently going through some refactoring work at 
present.\n\n" +
  +  "Some features, most notably filtering and colouring, may be inoperable at 
this time.\n\n" +
  +  "The Log4J Dev team apologises for this inconvenience, but be assured this 
functionality will be back very shortly.", "Apologise", JOptionPane.WARNING_MESSAGE);
  +
   showSplash();
   
   LogUI logUI = new LogUI();
  @@ -1095,6 +1108,11 @@
   }
 }
   
  +  /**
  +   * notify the status bar we received an event
  +   */
  +  statusBar.receivedEvent();
  +
 if (tableModelMap.containsKey(ident)) {
   /**
* we ignore this since we assume the LogPanel has been registered itself a 
listener
  @@ -1148,6 +1166,7 @@
  */
 class LogPanel extends DockablePanel implements SettingsListener,
   EventBatchListener {
  +private boolean paused = false;
   final ColorFilter colorFilter = new ColorFilter();
   final DisplayFilter displayFilter;
   final EventContainer tableModel;
  @@ -1177,6 +1196,8 @@
   ScrollToBottom scrollToBottom;
   private final LogPanelLoggerTreeModel logTreeModel =
 new LogPanelLoggerTreeModel();
  +private Layout detailPaneLayout = new EventDetailLayout();
  +private Layout toolTipLayout = new EventDetailLayout();
   
   //used for consistency - stays empty - used to allow none set in the 
colordisplay selector and right click
   Set noneSet = new HashSet();
  @@ -1284,7 +1305,7 @@
   thisItem.addActionListener(
 new ActionListener() {
   public void actionPerformed(ActionEvent evt) {
  -  Vector lastSelected = null;
  +  LoggingEvent lastSelected = null;
   
 if (table.getSelectedRow() > -1) {
   lastSelected = tableModel.getRow(table.getSelectedRow());
  @@ -1319,7 +1340,7 @@
   thisItem.addActionListener(
 new ActionListener() {
   public void actionPerformed(ActionEvent evt) {
  -  Vector lastSelected = null;
  +  LoggingEvent lastSelected = null;
   
 if (table.getSelectedRow() > -1) {
   lastSelected = tableModel.getRow(table.getSelectedRow());
  @@ -1368,8 +1389,15 @@
   
 currentRow = row;
   
  -  table.setToolTipText(
  -((EventContainer) table.getModel()).getDetailText(row));
  +  LoggingEvent event = tableModel.getRow(currentRow);
  +  Layout layout = getToolTipLayout();
  +
  +  if (event != null) {
  +StringBuffer buf = new StringBuffer();
  +buf.append(layout.getHeader()).append(layout.format(event))
  +   .append(layout.getFooter());
  +table.setToolTipText(buf.toString());
  +  }
   } else {
 table.setToolTipText(null);
   }
  @@ -1457,7 +1485,7 @@
 override.addActionListener(
   new ActionListe

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-02 Thread psmith
psmith  2003/09/02 17:44:55

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  fix for LogPanel registering itself as a listener for all
  identifiers.  This would have the affect of all Log tabs
  receiving all events.
  
  LogPanel now is just interested in it's own identifier's events.
  
  Revision  ChangesPath
  1.15  +1 -2  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LogUI.java3 Sep 2003 00:39:29 -   1.14
  +++ LogUI.java3 Sep 2003 00:44:55 -   1.15
  @@ -2236,8 +2236,7 @@
* @see org.apache.log4j.chainsaw.EventBatchListener#getInterestedIdentifier()
*/
   public String getInterestedIdentifier() {
  -  // TODO Auto-generated method stub
  -  return null;
  +  return getIdentifier();
   }
   
   /* (non-Javadoc)
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java ChainsawAppenderHandler.java ChainsawEventBatchEntry.java ChainsawEventBatch.java

2003-09-02 Thread psmith
psmith  2003/09/02 17:39:29

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
ChainsawAppenderHandler.java
ChainsawEventBatchEntry.java
ChainsawEventBatch.java
  Log:
  This is a checkpoint commit on the way to converting
  from the use of Vectors for event information, into native LoggingEvent
  objects.
  
  The ChainsawAppenderHandler now does no conversion
  of the incoming events, but bundles them up into batches
  and dispatches them to listeners, leaving it up to the
  listener to do any needed conversion as necessary.
  
  LogUI and LogPanel are now a little more decoupled.  LogUI
  now has an inner helper class that is a batch listener that is
  there purely to listen for new pane identifiers and create
  new LogPanels as necessary.
  
  LogPanel now implements the event batch listener interface
  and gets added as listener on creation time and from that
  point on is responsible for receiving it's own events.
  
  At this point LogPanel still decodes/formats each LoggingEvent
  into a Vector as a final step, but that will change shortly-ish.
  
  Revision  ChangesPath
  1.14  +221 -191  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- LogUI.java2 Sep 2003 06:32:06 -   1.13
  +++ LogUI.java3 Sep 2003 00:39:29 -   1.14
  @@ -183,8 +183,7 @@
* @author Paul Smith <[EMAIL PROTECTED]>
*
*/
  -public class LogUI extends JFrame implements ChainsawViewer, SettingsListener,
  -  EventBatchListener {
  +public class LogUI extends JFrame implements ChainsawViewer, SettingsListener {
 private static final String CONFIG_FILE_TO_USE = "config.file";
 private static final String USE_CYCLIC_BUFFER_PROP_NAME =
   "chainsaw.usecyclicbuffer";
  @@ -313,14 +312,14 @@
   LogUI logUI = new LogUI();
   
   logUI.handler = new ChainsawAppenderHandler();
  -logUI.handler.addEventBatchListener(logUI);
  +logUI.handler.addEventBatchListener(logUI.new NewTabEventBatchReceiver());
   LogManager.getRootLogger().addAppender(logUI.handler);
   logUI.activateViewer();
 }
   
 public void activateViewer(ChainsawAppender appender) {
   handler = new ChainsawAppenderHandler(appender);
  -handler.addEventBatchListener(this);
  +handler.addEventBatchListener(new NewTabEventBatchReceiver());
   activateViewer();
 }
   
  @@ -943,7 +942,6 @@
   }
 }
   
  -
 /**
  * Formats the individual elements of an LoggingEvent by ensuring that
  * there are no null bits, replacing them with EMPTY_STRING
  @@ -1003,183 +1001,6 @@
 }
   
 /**
  -   * Adds a specific row to a specific Tabbed Pane's TableModel.
  -   *
  -   * If there is currently no Tabbed Pane for the identifier, then a new
  -   * one is created and added to this current Frames Tabbed Pane infrastructure
  -   * @param ident
  -   * @param v
  -   */
  -  public void receiveEventBatch(
  -final String ident, final List eventBatchEntrys) {
  -if (eventBatchEntrys.size() == 0) {
  -  return;
  -}
  -
  -EventContainer tableModel;
  -JSortTable table;
  -ScrollToBottom scrollToBottom;
  -HashMap map = null;
  -
  -if (!isGUIFullyInitialized) {
  -  synchronized (initializationLock) {
  -while (!isGUIFullyInitialized) {
  -  System.out.println(
  -"Wanting to add a row, but GUI not initialized, waiting...");
  -
  -  /**
  -   * Lets wait 1 seconds and recheck.
  -   */
  -  try {
  -initializationLock.wait(1000);
  -  } catch (InterruptedException e) {
  -  }
  -}
  -  }
  -}
  -
  -if (tableModelMap.containsKey(ident)) {
  -  tableModel = (EventContainer) tableModelMap.get(ident);
  -  map = (HashMap) entryMap.get(ident);
  -  scrollToBottom = (ScrollToBottom) scrollMap.get(ident);
  -  table = (JSortTable) tableMap.get(ident);
  -} else {
  -  final String eventType =
  -((ChainsawEventBatchEntry) eventBatchEntrys.get(0)).getEventType();
  -
  -  int bufferSize = 500;
  -
  -  //if buffer size not provided, set default buffer size to 500 (only used if 
usecyclicbuffer true)
  -  if (System.getProperty(CYCLIC_BUFFER_SIZE_PROP_NAME) != null) {
  -bufferSize =
  -  Integer.valueOf(System.getProperty(CYCLIC_BUFFER_SIZE_PROP_NAME))
  - .intValue();
  -  }
  -
  -  tableModel =
  -new ChainsawCyclicBufferTableModel(
  -  Boolean.valueOf(System.getProperty(USE_CYCLIC_BUFFER_PROP_NAME))
  - .booleanValue(), bufferSize);
  -
  -  map

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java ChainsawAppenderHandler.java

2003-09-01 Thread psmith
psmith  2003/09/01 23:32:06

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
ChainsawAppenderHandler.java
  Log:
  The beginnings of the refactoring of event reception and dispatching to
  internal LogPanels.
  
  LogUI now implements event batch listener interface.
  
  Eventually this will move to LogPanels implementing
  this interface and receiving the event batch directly, and
  LogUI only needing to deal with "new" panels.
  
  Revision  ChangesPath
  1.13  +22 -128   jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LogUI.java2 Sep 2003 03:39:16 -   1.12
  +++ LogUI.java2 Sep 2003 06:32:06 -   1.13
  @@ -183,7 +183,8 @@
* @author Paul Smith <[EMAIL PROTECTED]>
*
*/
  -public class LogUI extends JFrame implements ChainsawViewer, SettingsListener {
  +public class LogUI extends JFrame implements ChainsawViewer, SettingsListener,
  +  EventBatchListener {
 private static final String CONFIG_FILE_TO_USE = "config.file";
 private static final String USE_CYCLIC_BUFFER_PROP_NAME =
   "chainsaw.usecyclicbuffer";
  @@ -311,13 +312,15 @@
   
   LogUI logUI = new LogUI();
   
  -logUI.handler = new ChainsawAppenderHandler(logUI);
  +logUI.handler = new ChainsawAppenderHandler();
  +logUI.handler.addEventBatchListener(logUI);
   LogManager.getRootLogger().addAppender(logUI.handler);
   logUI.activateViewer();
 }
   
 public void activateViewer(ChainsawAppender appender) {
  -handler = new ChainsawAppenderHandler(this, appender);
  +handler = new ChainsawAppenderHandler(appender);
  +handler.addEventBatchListener(this);
   activateViewer();
 }
   
  @@ -940,128 +943,6 @@
   }
 }
   
  -  /**
  -   * Determines an appropriate title for the Tab for the Tab Pane
  -   * by locating a the log4jmachinename property
  -   * @param v
  -   * @return
  -   */
  -  String getTabIdentifier(Vector v) {
  -int fieldIndex =
  -  ChainsawColumns.getColumnsNames().indexOf(
  -ChainsawConstants.PROPERTIES_COL_NAME);
  -
  -if (fieldIndex < 0) {
  -  return ChainsawConstants.UNKNOWN_TAB_NAME;
  -}
  -
  -String properties = (String) v.get(fieldIndex);
  -
  -String machinekey = ChainsawConstants.LOG4J_MACHINE_KEY + "=";
  -String machinename = null;
  -int machineposition = properties.indexOf(machinekey) + machinekey.length();
  -int machinelength = properties.indexOf(",", machineposition);
  -
  -if (machinelength == -1) {
  -  machinelength = properties.length();
  -}
  -
  -if (machineposition >= machinekey.length()) {
  -  machinename = properties.substring(machineposition, machinelength);
  -
  -  int dotposition = machinename.indexOf(".");
  -  boolean isnumeric = true;
  -
  -  if (dotposition > -1) {
  -char[] firstdotpart =
  -  machinename.substring(0, dotposition).toCharArray();
  -
  -for (int i = 0; i < firstdotpart.length; i++) {
  -  isnumeric = isnumeric && Character.isDigit(firstdotpart[i]);
  -}
  -
  -if (!isnumeric) {
  -  machinename = machinename.substring(0, dotposition);
  -}
  -  }
  -}
  -
  -String appkey = ChainsawConstants.LOG4J_APP_KEY + "=";
  -String appname = null;
  -int appposition = properties.indexOf(appkey) + appkey.length();
  -
  -if (appposition >= appkey.length()) {
  -  int applength = properties.indexOf(",", appposition);
  -
  -  if (applength == -1) {
  -applength = properties.length();
  -  }
  -
  -  appname = properties.substring(appposition, applength);
  -}
  -
  -StringBuffer ident = new StringBuffer();
  -
  -if (machinename != null) {
  -  ident.append(machinename);
  -}
  -
  -if (appname != null) {
  -  ident.append("-");
  -  ident.append(appname);
  -}
  -
  -if (ident.length() == 0) {
  -  /**
  -   * Maybe there's a Remote Host entry?
  -   */
  -  String remoteHostKey = ChainsawConstants.LOG4J_REMOTEHOST_KEY + "=";
  -  String remoteHost = null;
  -  int rhposition =
  -properties.indexOf(remoteHostKey) + remoteHostKey.length();
  -
  -  if (rhposition >= remoteHostKey.length()) {
  -int rhlength = properties.indexOf(":", rhposition);
  -
  -if (rhlength == -1) {
  -  rhlength = properties.length();
  -}
  -
  -remoteHost = properties.substring(rhposition, rhlength);
  -  }
  -
  -  if (remoteHost != null) {
  -ident.append(remoteHost);
  -  }
  -}
  -
  -if (ident.length() == 0) {
  -  ident.append(

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-01 Thread psmith
psmith  2003/08/31 21:00:00

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  added the builder code when the user selects the
  Simple Socket option when no receivers are defined.
  
  A new SocketReceiver is created with the chosen port
  and activated via the PluginRegistry.
  
  Revision  ChangesPath
  1.10  +32 -19jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LogUI.java1 Sep 2003 02:07:14 -   1.9
  +++ LogUI.java1 Sep 2003 04:00:00 -   1.10
  @@ -673,6 +673,15 @@
   
 if (noReceiversWarningPanel.getModel().isManualMode()) {
   toggleReceiversPanel();
  +  } else if (noReceiversWarningPanel.getModel().isSimpleSocketMode()) {
  +int port = noReceiversWarningPanel.getModel().getSimplePort();
  +SocketReceiver simpleSocketReceiver = new SocketReceiver(port);
  +simpleSocketReceiver.setName("Simple Socket Receiver");
  +PluginRegistry.startPlugin(simpleSocketReceiver);
  +receiversPanel.updateReceiverTreeInDispatchThread();
  +getStatusBar().setMessage(
  +  "Simple Socket Receiver created, started, and listening on port "
  +  + port);
 } else if (noReceiversWarningPanel.getModel().isLoadConfig()) {
   final URL url =
 noReceiversWarningPanel.getModel().getConfigToLoad();
  @@ -1222,17 +1231,18 @@
   
 //also add it to the unique values list
 ((Set) map.get(ChainsawConstants.LEVEL_COL_NAME)).add(level);
  -  Object loggerName = v.get(
  -ChainsawColumns.getColumnsNames().indexOf(
  -  ChainsawConstants.LOGGER_COL_NAME));
  +
  +  Object loggerName =
  +v.get(
  +  ChainsawColumns.getColumnsNames().indexOf(
  +ChainsawConstants.LOGGER_COL_NAME));
 ((Set) map.get(ChainsawConstants.LOGGER_COL_NAME)).add(loggerName);
  -  
  -  
  +
 /**
  * EventContainer is a LoggerNameModel imp, use that for notifing
  */
 tableModel.addLoggerName(loggerName.toString());
  -  
  +
 ((Set) map.get(ChainsawConstants.THREAD_COL_NAME)).add(
   v.get(
 ChainsawColumns.getColumnsNames().indexOf(
  @@ -1358,10 +1368,13 @@
   Set fileSet = new HashSet();
   Set levelSet = new HashSet();
   ScrollToBottom scrollToBottom;
  -private final LogPanelLoggerTreeModel logTreeModel = new 
LogPanelLoggerTreeModel();
  +private final LogPanelLoggerTreeModel logTreeModel =
  +  new LogPanelLoggerTreeModel();
  +
   //used for consistency - stays empty - used to allow none set in the 
colordisplay selector and right click
   Set noneSet = new HashSet();
   Point currentPoint;
  +private final JSplitPane nameTreeAndMainPanelSplit;
   
   public LogPanel(
 final String ident, final EventContainer tableModel,
  @@ -1371,9 +1384,9 @@
 this.scrollToBottom = scrollToBottom;
 this.tableModel = tableModel;
 this.table = table;
  -  
  +
 tableModel.addLoggerNameListener(logTreeModel);
  -  
  +
 levelSet = new HashSet((List) levelMap.get(eventType));
 map.put(ChainsawConstants.LEVEL_COL_NAME, levelSet);
   
  @@ -1661,9 +1674,8 @@
 statusLabelPanel.add(upperPanel, BorderLayout.CENTER);
 eventsAndStatusPanel.add(statusLabelPanel, BorderLayout.NORTH);
   
  -  final JTree logTree = new LoggerNameTree(logTreeModel);
  -  final JScrollPane logTreeScroll = new JScrollPane(logTree);
  -  
  +  final JPanel logTreePanel = new LoggerNameTreePanel(logTreeModel);
  +
 final JPanel detailPanel = new JPanel(new BorderLayout());
   
 //set valueisadjusting if holding down a key - don't process setdetail events
  @@ -1707,17 +1719,16 @@
 }
   });
   
  -
  -  JSplitPane nameTreeAndMainPanelSplit = new 
JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  -  nameTreeAndMainPanelSplit.add(logTreeScroll);
  +  nameTreeAndMainPanelSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  +  nameTreeAndMainPanelSplit.add(logTreePanel);
 nameTreeAndMainPanelSplit.add(lowerPanel);
 nameTreeAndMainPanelSplit.setOneTouchExpandable(true);
 nameTreeAndMainPanelSplit.setToolTipText("Still under development");
 nameTreeAndMainPanelSplit.setDividerLocation(120);
  -  
  +
 add(nameTreeAndMainPanelSplit, BorderLayout.CENTER);
  -//  add(lowerPanel, BorderLayout.CENTER);
   
  +  //  add(lowerPanel, BorderLayout.CENTER);
 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   
   

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-09-01 Thread psmith
psmith  2003/08/31 19:07:14

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Table model is notified of new logger/category names arriving in the batch.
  
  LogPanel now contains a new JTree component that
  sits to the West of the Events panel, sizeable via a Split Pane and
  scroll bar.
  
  As of this version the tree does nothing but display
  the Logger hierarchy in tree form, with no functionality
  but Right click popup menu is coming to set levels, filters etc.
  
  Right now I am not 100% certain whether it should stay
  where it is sittingbut regardless the component
  should be used somewhere (another thought is
  in the Preferences area).
  
  IMHO, I think it's useful where it sits, but any feedback appreciated.
  
  Revision  ChangesPath
  1.9   +31 -7 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LogUI.java28 Aug 2003 05:39:04 -  1.8
  +++ LogUI.java1 Sep 2003 02:07:14 -   1.9
  @@ -139,6 +139,7 @@
   import javax.swing.JTable;
   import javax.swing.JTextField;
   import javax.swing.JToolBar;
  +import javax.swing.JTree;
   import javax.swing.JWindow;
   import javax.swing.KeyStroke;
   import javax.swing.ListSelectionModel;
  @@ -153,6 +154,8 @@
   import javax.swing.event.ListSelectionListener;
   import javax.swing.event.TableColumnModelEvent;
   import javax.swing.event.TableColumnModelListener;
  +import javax.swing.event.TreeModelEvent;
  +import javax.swing.event.TreeModelListener;
   import javax.swing.table.AbstractTableModel;
   import javax.swing.table.TableColumn;
   import javax.swing.table.TableColumnModel;
  @@ -1219,10 +1222,17 @@
   
 //also add it to the unique values list
 ((Set) map.get(ChainsawConstants.LEVEL_COL_NAME)).add(level);
  -  ((Set) map.get(ChainsawConstants.LOGGER_COL_NAME)).add(
  -v.get(
  -  ChainsawColumns.getColumnsNames().indexOf(
  -ChainsawConstants.LOGGER_COL_NAME)));
  +  Object loggerName = v.get(
  +ChainsawColumns.getColumnsNames().indexOf(
  +  ChainsawConstants.LOGGER_COL_NAME));
  +  ((Set) map.get(ChainsawConstants.LOGGER_COL_NAME)).add(loggerName);
  +  
  +  
  +  /**
  +   * EventContainer is a LoggerNameModel imp, use that for notifing
  +   */
  +  tableModel.addLoggerName(loggerName.toString());
  +  
 ((Set) map.get(ChainsawConstants.THREAD_COL_NAME)).add(
   v.get(
 ChainsawColumns.getColumnsNames().indexOf(
  @@ -1348,7 +1358,7 @@
   Set fileSet = new HashSet();
   Set levelSet = new HashSet();
   ScrollToBottom scrollToBottom;
  -
  +private final LogPanelLoggerTreeModel logTreeModel = new 
LogPanelLoggerTreeModel();
   //used for consistency - stays empty - used to allow none set in the 
colordisplay selector and right click
   Set noneSet = new HashSet();
   Point currentPoint;
  @@ -1361,6 +1371,9 @@
 this.scrollToBottom = scrollToBottom;
 this.tableModel = tableModel;
 this.table = table;
  +  
  +  tableModel.addLoggerNameListener(logTreeModel);
  +  
 levelSet = new HashSet((List) levelMap.get(eventType));
 map.put(ChainsawConstants.LEVEL_COL_NAME, levelSet);
   
  @@ -1648,6 +1661,9 @@
 statusLabelPanel.add(upperPanel, BorderLayout.CENTER);
 eventsAndStatusPanel.add(statusLabelPanel, BorderLayout.NORTH);
   
  +  final JTree logTree = new LoggerNameTree(logTreeModel);
  +  final JScrollPane logTreeScroll = new JScrollPane(logTree);
  +  
 final JPanel detailPanel = new JPanel(new BorderLayout());
   
 //set valueisadjusting if holding down a key - don't process setdetail events
  @@ -1691,8 +1707,16 @@
 }
   });
   
  -  //  add(upperPanel, BorderLayout.NORTH);
  -  add(lowerPanel, BorderLayout.CENTER);
  +
  +  JSplitPane nameTreeAndMainPanelSplit = new 
JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  +  nameTreeAndMainPanelSplit.add(logTreeScroll);
  +  nameTreeAndMainPanelSplit.add(lowerPanel);
  +  nameTreeAndMainPanelSplit.setOneTouchExpandable(true);
  +  nameTreeAndMainPanelSplit.setToolTipText("Still under development");
  +  nameTreeAndMainPanelSplit.setDividerLocation(120);
  +  
  +  add(nameTreeAndMainPanelSplit, BorderLayout.CENTER);
  +//  add(lowerPanel, BorderLayout.CENTER);
   
 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java NoReceiversWarningPanel.java

2003-08-28 Thread psmith
psmith  2003/08/27 22:39:04

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
NoReceiversWarningPanel.java
  Log:
  Hooked up the new No Receivers warning panel.
  
  I have not had time to hook up the "Remember the
  chosen  config URL" function to this panel, and I would
  like to display a warning icon in the Dialog like
  the JOptionPanel gave us, but that will have to wait
  for next time.
  
  Revision  ChangesPath
  1.8   +165 -128  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LogUI.java7 Aug 2003 07:56:04 -   1.7
  +++ LogUI.java28 Aug 2003 05:39:04 -  1.8
  @@ -123,8 +123,8 @@
   import javax.swing.JCheckBoxMenuItem;
   import javax.swing.JComboBox;
   import javax.swing.JComponent;
  +import javax.swing.JDialog;
   import javax.swing.JEditorPane;
  -import javax.swing.JFileChooser;
   import javax.swing.JFrame;
   import javax.swing.JLabel;
   import javax.swing.JMenu;
  @@ -153,7 +153,6 @@
   import javax.swing.event.ListSelectionListener;
   import javax.swing.event.TableColumnModelEvent;
   import javax.swing.event.TableColumnModelListener;
  -import javax.swing.filechooser.FileFilter;
   import javax.swing.table.AbstractTableModel;
   import javax.swing.table.TableColumn;
   import javax.swing.table.TableColumnModel;
  @@ -217,6 +216,8 @@
 private ChainsawAbout aboutBox;
 private final SettingsManager sm = SettingsManager.getInstance();
 private String lookAndFeelClassName;
  +  private final NoReceiversWarningPanel noReceiversWarningPanel =
  +new NoReceiversWarningPanel();
   
 /**
  * Set to true, if and only if the GUI has completed
  @@ -227,21 +228,20 @@
  */
 private boolean isGUIFullyInitialized = false;
 private Object initializationLock = new Object();
  -  
  +
 /**
  * The shutdownAction is called when the user requests to exit
  * Chainsaw, and by default this exits the VM, but
  * a developer may replace this action with something that better suits
  * their needs
  */
  -  private Action shutdownAction = new AbstractAction() {
  +  private Action shutdownAction =
  +new AbstractAction() {
  +  public void actionPerformed(ActionEvent e) {
  +System.exit(0);
  +  }
  +};
   
  -public void actionPerformed(ActionEvent e)
  -{
  -  System.exit(0);
  -}
  -  };
  -  
 /**
  * Clients can register a ShutdownListener to be notified
  * when the user has requested Chainsaw to exit.
  @@ -280,25 +280,25 @@
   
 /**
  * Registers a ShutdownListener with this calss so that
  -   * it can be notified when the user has requested 
  +   * it can be notified when the user has requested
  * that Chainsaw exit.
  -   * 
  +   *
  * @param l
  */
 public void addShutdownListener(ShutdownListener l) {
  -shutdownListenerList.add(ShutdownListener.class, l);  
  +shutdownListenerList.add(ShutdownListener.class, l);
 }
  -  
  +
 /**
  -   * Removes the registered ShutdownListener so 
  +   * Removes the registered ShutdownListener so
  * that the listener will not be notified on a shutdown.
  -   * 
  +   *
  * @param l
  */
 public void removeShutdownListener(ShutdownListener l) {
   shutdownListenerList.remove(ShutdownListener.class, l);
 }
  -  
  +
 /**
  * Starts Chainsaw by attaching a new instance to the Log4J
  * main root Logger via a ChainsawAppender, and activates itself
  @@ -404,15 +404,19 @@
   
 //if both a config file are defined and a log4j.configuration property 
are set,  
 //don't use configFile's configuration
  -  if ((configFile != null) && !configFile.trim().equals("") && 
System.getProperty("log4j.configuration") == null) {
  +  if (
  +(configFile != null) && !configFile.trim().equals("")
  +  && (System.getProperty("log4j.configuration") == null)) {
   try {
 URL url = new URL(configFile);
 OptionConverter.selectAndConfigure(
   url, null, LogManager.getLoggerRepository());
  -if (LogUI.this.getStatusBar() != null) {
  -   LogUI.this.getStatusBar().setMessage(
  - "Configured Log4j using remembered URL :: " + url);
  -}
  +
  +  if (LogUI.this.getStatusBar() != null) {
  +LogUI.this.getStatusBar().setMessage(
  +  "Configured Log4j using remembered URL :: " + url);
  +  }
  +
 LogUI.this.configURLToUse = url;
   } catch (Exception e) {
 LogLog.error("error

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-08-08 Thread psmith
psmith  2003/08/07 00:56:04

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Added infrastructure for ShutdownListener and the ability
  to register a different Shutdown Action when
  a shutdown is requested.  By default, Chainsaw
  exits the VM, but the developer may choose to override
  this.
  
  Revision  ChangesPath
  1.7   +78 -2 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LogUI.java22 Jul 2003 03:07:47 -  1.6
  +++ LogUI.java7 Aug 2003 07:56:04 -   1.7
  @@ -148,6 +148,7 @@
   import javax.swing.event.ChangeListener;
   import javax.swing.event.DocumentEvent;
   import javax.swing.event.DocumentListener;
  +import javax.swing.event.EventListenerList;
   import javax.swing.event.ListSelectionEvent;
   import javax.swing.event.ListSelectionListener;
   import javax.swing.event.TableColumnModelEvent;
  @@ -226,6 +227,26 @@
  */
 private boolean isGUIFullyInitialized = false;
 private Object initializationLock = new Object();
  +  
  +  /**
  +   * The shutdownAction is called when the user requests to exit
  +   * Chainsaw, and by default this exits the VM, but
  +   * a developer may replace this action with something that better suits
  +   * their needs
  +   */
  +  private Action shutdownAction = new AbstractAction() {
  +
  +public void actionPerformed(ActionEvent e)
  +{
  +  System.exit(0);
  +}
  +  };
  +  
  +  /**
  +   * Clients can register a ShutdownListener to be notified
  +   * when the user has requested Chainsaw to exit.
  +   */
  +  private EventListenerList shutdownListenerList = new EventListenerList();
   
 /**
  * Constructor which builds up all the visual elements of the frame
  @@ -258,6 +279,27 @@
 }
   
 /**
  +   * Registers a ShutdownListener with this calss so that
  +   * it can be notified when the user has requested 
  +   * that Chainsaw exit.
  +   * 
  +   * @param l
  +   */
  +  public void addShutdownListener(ShutdownListener l) {
  +shutdownListenerList.add(ShutdownListener.class, l);  
  +  }
  +  
  +  /**
  +   * Removes the registered ShutdownListener so 
  +   * that the listener will not be notified on a shutdown.
  +   * 
  +   * @param l
  +   */
  +  public void removeShutdownListener(ShutdownListener l) {
  +shutdownListenerList.remove(ShutdownListener.class, l);
  +  }
  +  
  +  /**
  * Starts Chainsaw by attaching a new instance to the Log4J
  * main root Logger via a ChainsawAppender, and activates itself
  * @param args
  @@ -760,12 +802,46 @@
 } catch (Exception e) {
   e.printStackTrace();
 }
  -
  -  System.exit(0);
  +  fireShutdownEvent();
  +  performShutdownAction();
   }
  +
 };
   
   new Thread(runnable).start();
  +  }
  +
  +  /**
  +   * Ensures all the registered ShutdownListeners are notified.
  +   */
  +  private void fireShutdownEvent()
  +  {
  +ShutdownListener[] listeners = (ShutdownListener[]) 
shutdownListenerList.getListeners(ShutdownListener.class);
  +for (int i = 0; i < listeners.length; i++) {
  +  listeners[i].shuttingDown();
  +}
  +  }
  +
  +  /**
  +   * Configures LogUI's with an action to execute when the user
  +   * requests to exit the application, the default action
  +   * is to exit the VM.
  +   * This Action is called AFTER all the ShutdownListeners have been notified
  +   * 
  +   * @param shutdownAction
  +   */
  +  public final void setShutdownAction(Action shutdownAction){
  +this.shutdownAction = shutdownAction;
  +  }
  +
  +  /**
  +   * Using the current thread, calls the registed Shutdown action's
  +   * actionPerformed(...) method.
  +   *
  +   */
  +  private void performShutdownAction(){
  +LogLog.debug("Calling the shutdown Action. Goodbye!");
  +shutdownAction.actionPerformed(new ActionEvent(this, 
ActionEvent.ACTION_PERFORMED, "Shutting Down"));  
 }
   
 /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java ChainsawTabbedPane.java

2003-07-21 Thread sdeboy
sdeboy  2003/07/21 20:07:47

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
ChainsawTabbedPane.java
  Log:
  Added checks to ensure we didn't try to set an icon on a tab that isn't docked or 
isn't being displayed.
  Also updated code that re-selects the last previously selected tab when new tabs 
were added to prevent an outofbounds condition
  PR:
  Obtained from:
  Submitted by: 
  Reviewed by:  
  CVS: --
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  ChangesPath
  1.6   +5 -3  jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LogUI.java20 Jul 2003 15:41:48 -  1.5
  +++ LogUI.java22 Jul 2003 03:07:47 -  1.6
  @@ -456,7 +456,9 @@
   //received a statechange event - selection changed - remove icon from 
selected index
   public void stateChanged(ChangeEvent e) {
 if (tabbedPane.getSelectedComponent() instanceof ChainsawTabbedPane) {
  -tabbedPane.setIconAt(tabbedPane.getSelectedIndex(), null);
  + if (tabbedPane.getSelectedIndex() > -1) {
  + tabbedPane.setIconAt(tabbedPane.getSelectedIndex(), null);
  + }
 }
   }
 });
  @@ -2331,8 +2333,8 @@
 public void run() {
   while (true) {
 //if this tab is active, remove the icon
  -  if (
  -tabbedPane.getSelectedIndex() == tabbedPane.indexOfTab(ident)) {
  +  if ((tabbedPane.getSelectedIndex() > -1) && 
  +(tabbedPane.getSelectedIndex() == tabbedPane.indexOfTab(ident))) {
   tabbedPane.setIconAt(tabbedPane.indexOfTab(ident), null);
   
   //reset fields so no icon will display 
  
  
  
  1.2   +2 -2  
jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawTabbedPane.java
  
  Index: ChainsawTabbedPane.java
  ===
  RCS file: 
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/ChainsawTabbedPane.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChainsawTabbedPane.java   25 Jun 2003 04:05:22 -  1.1
  +++ ChainsawTabbedPane.java   22 Jul 2003 03:07:47 -  1.2
  @@ -117,8 +117,8 @@
 public void addANewTab(String name, JComponent component, Icon icon) {
   int selectedIndex = getSelectedIndex();
   super.insertTab(name, icon, component, null, 0);
  -
  -if (getTabCount() >= (selectedIndex + 1)) {
  + //only select the previously existing tab if there is more than one tab
  +if (getTabCount() > 1) {
 setSelectedIndex(selectedIndex + 1);
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-06-29 Thread psmith
psmith  2003/06/29 15:57:55

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  If there are no receivers defined after Log4j starts up, then
  the user is prompted for a decision.  They can now choose
  to search for a Log4j configuration file, be taken to the Receivers
  panel to enter them manually, or do nothing.
  
  If the user chooses to search for a config file, and the configuration
  succeeds, the user is also prompted if they wish to remember this
  URL for subsequent runs of Chainsaw.  This url is stored in the users
  preferences.
  
  We may need a "Forget remembered URL" action or something.
  
  Revision  ChangesPath
  1.3   +122 -34   jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LogUI.java26 Jun 2003 23:02:10 -  1.2
  +++ LogUI.java29 Jun 2003 22:57:55 -  1.3
  @@ -59,6 +59,7 @@
   import org.apache.log4j.chainsaw.prefs.SettingsListener;
   import org.apache.log4j.chainsaw.prefs.SettingsManager;
   import org.apache.log4j.helpers.LogLog;
  +import org.apache.log4j.helpers.OptionConverter;
   import org.apache.log4j.net.SocketNodeEventListener;
   import org.apache.log4j.net.SocketReceiver;
   import org.apache.log4j.plugins.PluginRegistry;
  @@ -66,13 +67,10 @@
   
   import java.awt.BorderLayout;
   import java.awt.Component;
  -import java.awt.Container;
   import java.awt.Dimension;
   import java.awt.Event;
   import java.awt.FlowLayout;
   import java.awt.Font;
  -import java.awt.GridBagConstraints;
  -import java.awt.GridBagLayout;
   import java.awt.Point;
   import java.awt.Toolkit;
   import java.awt.event.ActionEvent;
  @@ -100,6 +98,7 @@
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
   import java.io.Serializable;
  +
   import java.net.URL;
   
   import java.text.NumberFormat;
  @@ -120,12 +119,12 @@
   import javax.swing.BorderFactory;
   import javax.swing.ButtonGroup;
   import javax.swing.ImageIcon;
  -import javax.swing.JButton;
   import javax.swing.JCheckBox;
   import javax.swing.JCheckBoxMenuItem;
   import javax.swing.JComboBox;
   import javax.swing.JComponent;
   import javax.swing.JEditorPane;
  +import javax.swing.JFileChooser;
   import javax.swing.JFrame;
   import javax.swing.JLabel;
   import javax.swing.JMenu;
  @@ -140,7 +139,6 @@
   import javax.swing.JTable;
   import javax.swing.JTextField;
   import javax.swing.JToolBar;
  -import javax.swing.JTree;
   import javax.swing.JWindow;
   import javax.swing.KeyStroke;
   import javax.swing.ListSelectionModel;
  @@ -154,13 +152,11 @@
   import javax.swing.event.ListSelectionListener;
   import javax.swing.event.TableColumnModelEvent;
   import javax.swing.event.TableColumnModelListener;
  -import javax.swing.event.TreeSelectionEvent;
  -import javax.swing.event.TreeSelectionListener;
  +import javax.swing.filechooser.FileFilter;
   import javax.swing.table.AbstractTableModel;
   import javax.swing.table.TableColumn;
   import javax.swing.table.TableColumnModel;
   import javax.swing.table.TableModel;
  -import javax.swing.tree.DefaultMutableTreeNode;
   
   
   /**
  @@ -186,6 +182,7 @@
*
*/
   public class LogUI extends JFrame implements ChainsawViewer, SettingsListener {
  +  private static final String CONFIG_FILE_TO_USE = "config.file";
 private static final String USE_CYCLIC_BUFFER_PROP_NAME =
   "chainsaw.usecyclicbuffer";
 private static final String CYCLIC_BUFFER_SIZE_PROP_NAME =
  @@ -200,8 +197,9 @@
 private static final String STATUS_BAR = "StatusBar";
 private static final String COLUMNS_EXTENSION = ".columns";
 private static ChainsawSplash splash;
  +  private URL configURLToUse;
 private boolean noReceiversDefined;
  -  private JPanel receiversPanel;
  +  private ReceiversPanel receiversPanel;
 ChainsawTabbedPane tabbedPane;
 private JToolBar toolbar;
 private ChainsawStatusBar statusBar;
  @@ -330,6 +328,10 @@
   
   event.saveSetting(
 LogUI.STATUS_BAR, isStatusBarVisible() ? Boolean.TRUE : Boolean.FALSE);
  +
  +if (configURLToUse != null) {
  +  event.saveSetting(LogUI.CONFIG_FILE_TO_USE, configURLToUse.toString());
  +}
 }
   
 /**
  @@ -353,6 +355,30 @@
   }
 });
   
  +sm.configure(
  +  new SettingsListener() {
  +public void loadSettings(LoadSettingsEvent event) {
  +  String configFile = event.getSetting(LogUI.CONFIG_FILE_TO_USE);
  +
  +  if ((configFile != null) && !configFile.trim().equals("")) {
  +try {
  +  URL url = new URL(configFile);
  +  OptionConverter.selectAndConfigure(
  +url, null, LogManager.getLoggerRepository());
  +  Log

cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogUI.java

2003-06-26 Thread psmith
psmith  2003/06/26 16:02:10

  Modified:src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  Changes because WelcomePanel is now a singleton.
  
  Fix for a JDK 1.4 specific method that was being used.
  
  Also added a convenience method to show a Help url, that
  ensures the Welcome Panel is made visible and the URl set for display.
  
  Revision  ChangesPath
  1.2   +19 -2 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LogUI.java25 Jun 2003 04:05:22 -  1.1
  +++ LogUI.java26 Jun 2003 23:02:10 -  1.2
  @@ -100,6 +100,7 @@
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
   import java.io.Serializable;
  +import java.net.URL;
   
   import java.text.NumberFormat;
   
  @@ -570,7 +571,7 @@
   
 void addWelcomePanel() {
   tabbedPane.addANewTab(
  -  "Welcome", new WelcomePanel(), new ImageIcon(ChainsawIcons.ABOUT),
  +  "Welcome", WelcomePanel.getInstance(), new ImageIcon(ChainsawIcons.ABOUT),
 "Welcome/Help");
 }
   
  @@ -621,7 +622,10 @@
   final ProgressPanel panel = new ProgressPanel(1, 3, "Shutting down");
   progress.getContentPane().add(panel);
   progress.pack();
  -progress.setLocationRelativeTo(this);
  +
  +Point p = new Point(getLocation());
  +p.move((int)getSize().getWidth()>>1, (int)getSize().getHeight()>>1);
  +progress.setLocation(p);
   progress.setVisible(true);
   
   Runnable runnable =
  @@ -2332,5 +2336,18 @@
   
   public void columnSelectionChanged(ListSelectionEvent e) {
   }
  +  }
  +
  +  /**
  +   * Causes the Welcome Panel to become visible, and shows the URL
  +   * specified as it's contents
  +   * @param url for content to show
  +   */
  +  void showHelp(URL url) {
  +removeWelcomePanel();
  +addWelcomePanel();
  +//TODO ensure the Welcome Panel is the selected tab
  +WelcomePanel.getInstance().setURL(url);
  +
 }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]