logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw WelcomePanel.java
Date Fri, 19 Sep 2003 08:15:33 GMT
psmith      2003/09/19 01:15:33

  Modified:    src/java/org/apache/log4j/chainsaw WelcomePanel.java
  Added:       src/java/org/apache/log4j/chainsaw/help tutorial.html
  Log:
  Modified the WelcomePanel's toolbar to be, well, a real JToolbar.
  
  Added inital plumbing to support the Tutorial within the Help system, and added
  an inital shell HTML file for the Tutorial.
  
  Revision  Changes    Path
  1.1                  jakarta-log4j/src/java/org/apache/log4j/chainsaw/help/tutorial.html
  
  Index: tutorial.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  <HTML>
  <HEAD>
  <link rel="stylesheet" href="../stylesheet.css" type="text/css">
  </HEAD>
  
  <BODY>
  <table width="100%">
  <tr><td class="TableTitle" bgcolor="#000089"><font color="white">Tutorial</font></td></tr>
  </table>
  <p>Welcome to the Chainsaw v2 Tutorial.  Here you will learn how to effectively utilise
the many features of Chainsaw</p>
  </p>
  <h2>What you will need</h2>
  <ol>
  <li>1 cup of your favourite brew</li>
  </ol>
  <h2>Outline</h2>
  <p>The built-in tutorial installs several "pretend" Receiver plugins that generate
some example LoggingEvents and post
  them into Log4j just like a real Receiver.  If you would like to read more about Receivers
first, then <!--<a href="Receivers.html">-->click here.<!--</a>-->
(TODO)</p>
  <p>When you are ready to begin the tutorial, <a href="StartTutorial">click here.</a>
  </body>
  </html>
  
  
  
  1.4       +24 -24    jakarta-log4j/src/java/org/apache/log4j/chainsaw/WelcomePanel.java
  
  Index: WelcomePanel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/WelcomePanel.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WelcomePanel.java	2 Sep 2003 01:07:00 -0000	1.3
  +++ WelcomePanel.java	19 Sep 2003 08:15:33 -0000	1.4
  @@ -49,6 +49,7 @@
   
   package org.apache.log4j.chainsaw;
   
  +import org.apache.log4j.chainsaw.help.Tutorial;
   import org.apache.log4j.chainsaw.icons.ChainsawIcons;
   
   import java.awt.BorderLayout;
  @@ -73,6 +74,7 @@
   import javax.swing.JPanel;
   import javax.swing.JScrollPane;
   import javax.swing.JSeparator;
  +import javax.swing.JToolBar;
   import javax.swing.SwingUtilities;
   import javax.swing.event.HyperlinkEvent;
   import javax.swing.event.HyperlinkListener;
  @@ -93,6 +95,7 @@
     private final URLToolbar urlToolbar =  new URLToolbar();
     private final URL helpURL;
     private final URL exampleConfigURL;
  +  private final URL tutorialURL;
     
     private WelcomePanel() {
       setLayout(new BorderLayout());
  @@ -107,6 +110,9 @@
       getClass().getClassLoader().getResource(
         "org/apache/log4j/chainsaw/log4j-receiver-sample.xml");
   
  +	tutorialURL =    getClass().getClassLoader().getResource(
  +	"org/apache/log4j/chainsaw/help/tutorial.html");
  + 
       if (helpURL != null) {
         textInfo.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
         textInfo.setEditable(false);
  @@ -122,6 +128,9 @@
             new HyperlinkListener() {
               public void hyperlinkUpdate(HyperlinkEvent e) {
                 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
  +				if(e.getDescription().equals("StartTutorial")){
  +					new Thread(new Tutorial()).start();	
  +				}else{
                   urlStack.add(textInfo.getPage());
   
                   try {
  @@ -130,6 +139,7 @@
                   } catch (IOException e1) {
                     e1.printStackTrace();
                   }
  +				}
                 }
               }
             });
  @@ -155,7 +165,7 @@
       
     }
   
  -  private class URLToolbar extends JPanel {
  +  private class URLToolbar extends JToolBar {
       private final Action previousAction =
         new AbstractAction(null, new ImageIcon(ChainsawIcons.ICON_BACK)) {
           public void actionPerformed(ActionEvent e) {
  @@ -176,35 +186,27 @@
         };
   
       private URLToolbar() {
  -      setLayout(new GridBagLayout());
  +    	setFloatable(false);
         updateToolbar();
         previousAction.putValue(Action.SHORT_DESCRIPTION, "Back");
         homeAction.putValue(Action.SHORT_DESCRIPTION, "Home");
   
  -      GridBagConstraints c = new GridBagConstraints();
  -      c.weightx = 0.0;
  -      c.weighty = 0.0;
  -      c.ipadx = 1;
  -      c.ipady = 1;
  -//      c.gridx = 0;
  -//      c.gridy = 0;
  -      
  -      c.fill = GridBagConstraints.NONE;
  -      c.anchor = GridBagConstraints.WEST;
  -      
         JButton home = new SmallButton(homeAction);
  -      add(home, c);
  -      
  -      add(new JSeparator(), c);
  +      add(home);
         
  -//      c.gridx = 1;
  +	  addSeparator();      
         JButton previous = new SmallButton(previousAction);
         previous.setEnabled(false);
  -      add(previous, c);
  +      add(previous);
         
  -      add(new JSeparator(), c);
  +      addSeparator();
  +      add(new SmallButton(new AbstractAction("Tutorial"){
   
  -//      c.gridx = 2;
  +		public void actionPerformed(ActionEvent e) {
  +			setURL(tutorialURL);
  +			
  +		}}));
  +	addSeparator();
         final Action exampleConfigAction = new AbstractAction("View example Receiver configuration"){
   
           public void actionPerformed(ActionEvent e) {
  @@ -214,12 +216,10 @@
         exampleConfigAction.putValue(Action.SHORT_DESCRIPTION, "Displays an example Log4j
configuration file with several Receivers defined.");
         
         JButton exampleButton = new SmallButton(exampleConfigAction);
  -      add(exampleButton, c);
  +      add(exampleButton);
   
  -//      c.gridx = 3;
  -      c.weightx = 1;
         JPanel p = new JPanel();
  -      add(p, c);
  +      add(p);
       }
   
       void updateToolbar() {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org


Mime
View raw message