You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dl...@locus.apache.org on 2000/02/25 18:41:41 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xslt/client XSLTProcessorApplet.java

dleslie     00/02/25 09:41:41

  Modified:    src/org/apache/xalan/xslt/client XSLTProcessorApplet.java
  Log:
  javadoc cleanup. SPR #DMAN4FYSFJ
  
  Revision  Changes    Path
  1.9       +74 -72    xml-xalan/src/org/apache/xalan/xslt/client/XSLTProcessorApplet.java
  
  Index: XSLTProcessorApplet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/client/XSLTProcessorApplet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XSLTProcessorApplet.java	2000/01/05 23:05:37	1.8
  +++ XSLTProcessorApplet.java	2000/02/25 17:41:41	1.9
  @@ -68,7 +68,14 @@
   import org.w3c.dom.*;
   
   /**
  - * Class for XSLTProcessorApplet applet.
  + * Provides applet host for the XSLT processor. To perform transformations on an HTML client:
  + * <ol>
  + * <li>Use an &lt;applet&gt; tag to embed this applet in the HTML client.</li>
  + * <li>Use the DocumentURL and StyleURL PARAM tags or the {@link #setDocumentURL} and
  + * {@link #setStyleURL} methods to specify the XML source document and XSL stylesheet.</li>
  + * <li>Call the {@link #transformToHTML} method to perform the transformation and return
  + * the result as a String.</li>
  + * </ol>
    */
   public class XSLTProcessorApplet extends Applet
   {
  @@ -170,29 +177,28 @@
      */
     transient private String m_attrValueToSet = null;
   
  -  // XSLTProcessorApplet Class Constructor
  -  //--------------------------------------------------------------------------
  +  /**
  +   * The XSLTProcessorApplet constructor takes no arguments.
  +   */
     public XSLTProcessorApplet()
     {
     }
   
  -  // APPLET INFO SUPPORT:
  -  //		The getAppletInfo() method returns a string describing the applet's
  -  // author, copyright date, or miscellaneous information.
  -  //--------------------------------------------------------------------------
  +  /**
  +   * Gets basic information about the applet
  +   * @return A String with the applet name and author.
  +   */
     public String getAppletInfo()
     {
       return "Name: XSLTProcessorApplet\r\n" +
         "Author: Scott Boag";
     }
   
  -  // PARAMETER SUPPORT
  -  //		The getParameterInfo() method returns an array of strings describing
  -  // the parameters understood by this applet.
  -  //
  -  // XSLTProcessorApplet Parameter Information:
  -  //  { "Name", "Type", "Description" },
  -  //--------------------------------------------------------------------------
  +  /**
  +   * Gets descriptions of the applet parameters.
  +   * @return A two-dimensional array of Strings with Name, Type, and Description
  +   * for each parameter.
  +   */
     public String[][] getParameterInfo()
     {
       String[][] info =
  @@ -217,7 +223,7 @@
       String param;
       param = getParameter(PARAM_parser);
       whichParser = (param != null) ? param : "ANY";
  -    
  +
       // styleURL: Parameter description
       //----------------------------------------------------------------------
       param = getParameter(PARAM_styleURL);
  @@ -229,7 +235,7 @@
       if (param != null)
         setDocumentURL(param);
       m_codeBase = this.getCodeBase();
  -    m_documentBase = this.getDocumentBase();    
  +    m_documentBase = this.getDocumentBase();
   
       // If you use a ResourceWizard-generated "control creator" class to
       // arrange controls in your applet, you may want to call its
  @@ -238,9 +244,9 @@
       // CreateControls() does its own resizing.
       //----------------------------------------------------------------------
       resize(320, 240);
  -    
  +
       initLiaison();
  -    
  +
     }
   
     /**
  @@ -253,7 +259,7 @@
       try
       {
         Class parserLiaisonClass = Class.forName(parserName);
  -       
  +
         Constructor parserLiaisonCtor = parserLiaisonClass.getConstructor(null);
         m_liaison = (XMLParserLiaison)parserLiaisonCtor.newInstance(null);
       }
  @@ -262,13 +268,13 @@
         e.printStackTrace();
           //System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_CREATE_XML_PROC_LIAISON, new Object[] {parserLiaisonClassName})); //"Could not create XML Processor Liaison: "+parserLiaisonClassName);
           return;
  -    }    
  +    }
       try
       {
         m_processor = XSLTProcessorFactory.getProcessor();
         m_processor.setDiagnosticsOutput(System.out);
  -      
  -    }  
  +
  +    }
       catch(org.xml.sax.SAXException se)
       {
         se.printStackTrace();
  @@ -277,9 +283,9 @@
   
     }
   
  -  // Place additional applet clean up code here.  destroy() is called when
  -  // when you applet is terminating and being unloaded.
  -  //-------------------------------------------------------------------------
  +  /**
  +   * Cleanup; called when applet is terminated and unloaded.
  +   */
     public void destroy()
     {
       if(null != m_trustedWorker)
  @@ -292,16 +298,18 @@
       m_documentURLOfCached = null;
     }
   
  -  // XSLTProcessorApplet Paint Handler
  -  //--------------------------------------------------------------------------
  +  /**
  +   * Do not call; this applet contains no UI or visual components.
  +   */
  +
     public void paint(Graphics g)
     {
     }
   
  -  //		The start() method is called when the page containing the applet
  -  // first appears on the screen. The AppletWizard's initial implementation
  -  // of this method starts execution of the applet's thread.
  -  //--------------------------------------------------------------------------
  +  /**
  +   *  Automatically called when the HTML client containing the applet loads.
  +   *  This method starts execution of the applet thread.
  +   */
     public void start()
     {
       m_trustedAgent = new TrustedAgent();
  @@ -327,17 +335,17 @@
         this.showStatus("Ready to click!");
       }
       catch(Exception e)
  -    {     
  -      this.showStatus("Could not prime the pump!"); 
  -      System.out.println("Could not prime the pump!"); 
  +    {
  +      this.showStatus("Could not prime the pump!");
  +      System.out.println("Could not prime the pump!");
         e.printStackTrace();
       }
     }
   
  -  // The stop() method is called when the page containing the applet is
  -  // no longer on the screen. The AppletWizard's initial implementation of
  -  // this method stops execution of the applet's thread.
  -  //--------------------------------------------------------------------------
  +  /**
  +   * Automatically called when the HTML page containing the applet is no longer
  +   * on the screen. Stops execution of the applet thread.
  +   */
     public void stop()
     {
       if(null != m_trustedWorker)
  @@ -351,9 +359,9 @@
     }
   
     /**
  -   * Set the URI to the XSL stylesheet that will be used
  -   * to display the input XML.  No processing is done yet.
  -   * @param valid URI string.
  +   * Sets the URL to the XSL stylesheet that will be used
  +   * to transform the input XML.  No processing is done yet.
  +   * @param valid URL string.
      */
     public void setStyleURL(String urlString)
     {
  @@ -361,9 +369,9 @@
     }
   
     /**
  -   * Set the URI to the XML document that will be displayed
  -   * via the XSL stylesheet.  No processing is done yet.
  -   * @param valid URI string.
  +   * Set the URL to the XML document that will be transformed
  +   * with the XSL stylesheet.  No processing is done yet.
  +   * @param valid URL string.
      */
     public void setDocumentURL(String urlString)
     {
  @@ -372,9 +380,8 @@
   
     /**
      * The processor keeps a cache of the source and
  -   * style trees around, so the caller has to call
  -   * freeCache() if they changed something, or if
  -   * they want them garbage collected.
  +   * style trees, so call this method if they have changed
  +   * or you want to do garbage collection.
      */
     public void freeCache()
     {
  @@ -383,7 +390,7 @@
     }
   
     /**
  -   * Set an attribute in the stylesheet, which gives the ability
  +   * Sets an attribute in the stylesheet, which gives the ability
      * to have some dynamic selection control.
      * @param nameOfIDAttrOfElemToModify The name of an attribute to search for a unique id.
      * @param elemId The unique ID to look for.
  @@ -405,9 +412,9 @@
     transient String m_expression;
   
     /**
  -   * Push a param for the stylesheet.  For the moment, only one param is supported.
  -   * @param key The name of the param.
  -   * @param expr The expression to be evaluated.
  +   * Submits a stylesheet parameter.
  +   * @param expr The parameter expression to be submitted.
  +   * @see org.apache.xalan.xslt.XSLTProcessor#setStylesheetParam(String, String)
      */
     public void setStylesheetParam(String key, String expr)
     {
  @@ -416,7 +423,7 @@
     }
   
     /**
  -   * Given a string with markup in it, escape the markup so it
  +   * Given a String containing markup, escapes the markup so it
      * can be displayed in the browser.
      */
     public String escapeString(String s)
  @@ -470,13 +477,8 @@
   
   
     /**
  -   * Having set the stylesheet URI and the input XML URI,
  -   * parse both XML into DOM trees, produce the result DOM
  -   * tree, and return the result in the form of a string.
  -   * This calls a trusted thread created when the applet
  -   * was instantiated, because the thread that calls this
  -   * function is not trusted and therefore can not access
  -   * data via the URLs.
  +   * Assuming the stylesheet URL and the input XML URL have been set,
  +   * performs the transformation and returns the result as a String.
      */
     public String getHtmlText()
     {
  @@ -497,20 +499,20 @@
     }
   
     /**
  -   * Get a DOM tree as escaped text, suitable for display
  +   * Gets a DOM tree as escaped text, suitable for display
      * in the browser.
      */
     public String getTreeAsText(String treeURL)
       throws IOException
     {
       String text = "";
  -    byte[] buffer = new byte[50000];    
  -   
  +    byte[] buffer = new byte[50000];
  +
       try
   		{
         URL docURL = new URL(m_documentBase, treeURL);
         InputStream in = docURL.openStream();
  -    
  +
   			int nun_chars;
   			while ( ( nun_chars = in.read( buffer, 0, buffer.length ) ) != -1 )
   			{
  @@ -524,7 +526,7 @@
     }
   
     /**
  -   * Get the XML source Tree as a text string suiteable
  +   * Gets the XML source Tree as a text string suiteable
      * for display in a browser.  Note that this is for display of the
      * XML itself, not for rendering of HTML by the browser.
      * @exception Exception thrown if tree can not be converted.
  @@ -536,7 +538,7 @@
     }
   
     /**
  -   * Get the XSL style Tree as a text string suiteable
  +   * Gets the XSL style Tree as a text string suiteable
      * for display in a browser.  Note that this is for display of the
      * XML itself, not for rendering of HTML by the browser.
      * @exception Exception thrown if tree can not be converted.
  @@ -548,7 +550,7 @@
     }
   
     /**
  -   * Get the HTML result Tree as a text string suiteable
  +   * Gets the HTML result Tree as a text string suiteable
      * for display in a browser.  Note that this is for display of the
      * XML itself, not for rendering of HTML by the browser.
      * @exception Exception thrown if tree can not be converted.
  @@ -560,9 +562,9 @@
     }
   
     /**
  -   * Process a document and a stylesheet and return
  -   * the text.  If one of these is null, the given
  -   * existing value won't be effected.
  +   * Processes a document and a stylesheet and returns
  +   * the transformation result.  If one of these is null, the
  +   * existing value (of a previous transformation) is not affected.
      */
     public String transformToHtml(String doc, String style)
     {
  @@ -578,8 +580,8 @@
     }
   
     /**
  -   * Process a document and a stylesheet and return
  -   * the text.  Use the xsl:stylesheet PI to find the
  +   * Processes a document and a stylesheet and returns
  +   * the transformation result. Use the xsl:stylesheet PI to find the
      * document, if one exists.
      */
     public String transformToHtml(String doc)
  @@ -651,7 +653,7 @@
     }
   
     /**
  -   * Process the transformation.
  +   * Processes the transformation.
      */
     private String processTransformation()
       throws XSLProcessorException, MalformedURLException,