You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by st...@apache.org on 2003/06/19 06:45:30 UTC

cvs commit: xml-axis/java/src/org/apache/axis/utils tcpmon.java

stevel      2003/06/18 21:45:30

  Modified:    java     tcpmon.xml
               java/src/org/apache/axis/utils tcpmon.java
  Log:
  pluggable look and feel support; add it to the lib dir, set the property tcpmon.laf to the appropriate classname and voila, better looking tcpmon
  
  Revision  Changes    Path
  1.2       +5 -1      xml-axis/java/tcpmon.xml
  
  Index: tcpmon.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/tcpmon.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- tcpmon.xml	17 Jan 2003 01:12:43 -0000	1.1
  +++ tcpmon.xml	19 Jun 2003 04:45:29 -0000	1.2
  @@ -13,13 +13,17 @@
   
       &properties;
   
  +    <property file="tcpmon.properties" />
  +
       <target name="run" description="run tcpmon" >
  +        <property name="tcpmon.laf" value="" />
           <java
               classname="org.apache.axis.utils.tcpmon"
               fork="true"
               failonerror="true">
  +            <sysproperty key="tcpmon.laf" value="${tcpmon.laf}"/>
               <classpath>
  -                <fileset dir="${build.lib}" includes="*.jar" />
  +                <fileset dir="${build.lib}" includes="**/*.jar" />
               </classpath>
               </java>
   
  
  
  
  1.49      +22 -4     xml-axis/java/src/org/apache/axis/utils/tcpmon.java
  
  Index: tcpmon.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/tcpmon.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- tcpmon.java	28 Feb 2003 05:39:46 -0000	1.48
  +++ tcpmon.java	19 Jun 2003 04:45:29 -0000	1.49
  @@ -75,6 +75,7 @@
   import javax.swing.ListSelectionModel;
   import javax.swing.SwingConstants;
   import javax.swing.UIManager;
  +import javax.swing.UnsupportedLookAndFeelException;
   import javax.swing.border.TitledBorder;
   import javax.swing.event.ChangeEvent;
   import javax.swing.event.ListSelectionEvent;
  @@ -116,6 +117,8 @@
   
   /**
    * TCP monitor to log http messages and responses, both SOAP and plain HTTP.
  + * If you want to choose a different Swing look and feel, set the property
  + * tcpmon.laf to the classname of the new look and feel
    * @author Doug Davis (dug@us.ibm.com)
    * @author Steve Loughran
    */
  @@ -1885,10 +1888,25 @@
        * set up the L&F
        */
       private static void setupLookAndFeel(boolean nativeLookAndFeel) throws Exception {
  -        UIManager.setLookAndFeel(
  -                nativeLookAndFeel ? UIManager.getSystemLookAndFeelClassName()
  -                    : UIManager.getCrossPlatformLookAndFeelClassName());
  -        //JFrame.setDefaultLookAndFeelDecorated(true);
  +        String classname= UIManager.getCrossPlatformLookAndFeelClassName();
  +        if(nativeLookAndFeel) {
  +            classname= UIManager.getSystemLookAndFeelClassName();
  +        }
  +        String lafProperty= System.getProperty("tcpmon.laf", "");
  +        if(lafProperty.length()>0) {
  +            classname=lafProperty;
  +        }
  +        try {
  +            UIManager.setLookAndFeel(classname);
  +        } catch (ClassNotFoundException e) {
  +            e.printStackTrace();
  +        } catch (InstantiationException e) {
  +            e.printStackTrace();
  +        } catch (IllegalAccessException e) {
  +            e.printStackTrace();
  +        } catch (UnsupportedLookAndFeelException e) {
  +            e.printStackTrace();
  +        }
       }
       /**
        * this is our main method