Class HTMLAbout


  • public class HTMLAbout
    extends java.lang.Object
    This class contains static methods that are called by when HTMLViewer.hyperlinkUpdate() is invoked on a hyperlink that starts with about:. This facility is primarily used for testing.
    Since:
    Ptolemy II 3.0
    Version:
    $Id$
    Author:
    Christopher Hylands
    See Also:
    HTMLViewer.hyperlinkUpdate(HyperlinkEvent)
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Constructor Summary

      Constructors 
      Constructor Description
      HTMLAbout()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.net.URL _expandLibrary​(java.lang.String regexp, Configuration configuration)
      Expand the left hand library pane.
      static java.lang.String about​(Configuration configuration)
      Return a string containing HTML that describes the about: features.
      static java.lang.String checkCompleteDemos​(java.lang.String completeDemos)
      Check that all the demos in otherDemos are in completeDemos.
      static java.net.URL generateLinks​(java.lang.String demosFileName, java.lang.String regexp, Configuration configuration)
      Call Configuration.openModel() on relative URLs that match a regexp.
      static java.net.URL hyperlinkUpdate​(javax.swing.event.HyperlinkEvent event, Configuration configuration)
      Process an "about:" HyperlinkEvent.
      static void main​(java.lang.String[] args)
      Generate a file that contains urls of models.
      static java.net.URL runAllDemos​(java.lang.String demosFileName, Configuration configuration)
      Run all the local .xml files that are linked to from an HTML file.
      static void writeDemoURLs​(java.lang.String demosFileName, java.lang.String outputFileName)
      Write the urls of the demo urls.
      static void writeLiveLinks​(java.io.FileWriter fileWriter, java.lang.String demo, java.lang.String ptII)
      Open the model, look for any LiveLinks and write their names.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HTMLAbout

        public HTMLAbout()
    • Method Detail

      • about

        public static java.lang.String about​(Configuration configuration)
        Return a string containing HTML that describes the about: features.

        If the configuration contains an _applicationName attribute then that attribute is used as the name of the application in the generated text. If _applicationName is not present, then the default name is "Ptolemy II".

        If the configuration contains an _applicationDemos Parameter then that parameter is assumed to be an array of strings name naming HTML files that should be searched for demos and expanded.

        Parameters:
        configuration - The configuration to look for the _applicationName attribute in
        Returns:
        A string containing HTML that describes the about: features.
      • checkCompleteDemos

        public static java.lang.String checkCompleteDemos​(java.lang.String completeDemos)
                                                   throws java.io.IOException
        Check that all the demos in otherDemos are in completeDemos. Be sure to call about(Configuration) before calling this method.
        Parameters:
        completeDemos - A URL pointing to the completeDemos.htm file
        Returns:
        HTML listing demos in otherDemos that are not in completeDemos.
        Throws:
        java.io.IOException - If there is a problem reading the completeDemos.htm file.
      • generateLinks

        public static java.net.URL generateLinks​(java.lang.String demosFileName,
                                                 java.lang.String regexp,
                                                 Configuration configuration)
                                          throws java.lang.Exception
        Call Configuration.openModel() on relative URLs that match a regexp. files are linked to from an HTML file.
        Parameters:
        demosFileName - The name of the HTML file that contains links to the .xml, .htm and .html files. If this argument is the empty string, then "ptolemy/configs/doc/completeDemos.htm" is used.
        regexp - The regular expression of the links we are interested in.
        configuration - The configuration to open the files in.
        Returns:
        the URL of the HTML file that was searched or null if demosFileName does not exist.
        Throws:
        java.lang.Exception - If there is a problem opening a model.
      • hyperlinkUpdate

        public static java.net.URL hyperlinkUpdate​(javax.swing.event.HyperlinkEvent event,
                                                   Configuration configuration)
                                            throws java.lang.Throwable
        Process an "about:" HyperlinkEvent.
        Parameters:
        event - The HyperlinkEvent to process. The description of the event should start with "about:". If there are no specific matches for the description, then a general usage message is returned.
        configuration - The configuration in which we are operating.
        Returns:
        A URL that points to the results.
        Throws:
        java.lang.Throwable - If there is a problem invoking the about task.
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Generate a file that contains urls of models.
        Parameters:
        args - The optional name of the file containing the demos followed by the optional name of the output file. The default demo file is ptolemy/configs/doc/completeDemos.htm, the default output file is models.txt.
        Throws:
        java.io.IOException - If there is a problem reading the demo file or writing the model file.
      • runAllDemos

        public static java.net.URL runAllDemos​(java.lang.String demosFileName,
                                               Configuration configuration)
                                        throws java.lang.Exception
        Run all the local .xml files that are linked to from an HTML file.
        Parameters:
        demosFileName - The name of the HTML file that contains links to the .xml files. If this argument is the empty string, then "ptolemy/configs/doc/completeDemos.htm" is used.
        configuration - The configuration to run the files in.
        Returns:
        the URL of the HTML file that was searched.
        Throws:
        java.lang.Exception - If there is a problem running a demo.
      • writeDemoURLs

        public static void writeDemoURLs​(java.lang.String demosFileName,
                                         java.lang.String outputFileName)
                                  throws java.io.IOException
        Write the urls of the demo urls. The HTML file referred to by demoURLName is scanned for links to .xml files and for links to other .htm* files. The children of demoURLName are scanned, but not the grandchildren. The names of the demos will have $CLASSPATH/ prepended. This method is used to generate a list of all demos in ptolemy/configs/doc/models.txt.
        Parameters:
        demosFileName - The name of the demo file.
        outputFileName - The name of the file that is generated.
        Throws:
        java.io.IOException - If there is a problem reading the demo file or writing the output file.
      • writeLiveLinks

        public static void writeLiveLinks​(java.io.FileWriter fileWriter,
                                          java.lang.String demo,
                                          java.lang.String ptII)
                                   throws java.lang.Throwable
        Open the model, look for any LiveLinks and write their names.
        Parameters:
        fileWriter - The FileWriter to write the file names to..
        demo - The string path to the demo to be searched for live links.
        ptII - The Ptolemy II home directory.
        Throws:
        java.lang.Throwable - If there is a problem opening the demo.
      • _expandLibrary

        public static java.net.URL _expandLibrary​(java.lang.String regexp,
                                                  Configuration configuration)
                                           throws java.lang.Exception
        Expand the left hand library pane. We search for a model, first in the intro.htm file, then the complete demos page and then on the Ptolemy website. The model is opened and then the left hand library pane is expanded. This test is useful for looking for problem with icons, such as icons that cause ChangeRequests.
        Parameters:
        regexp - The regular expression of the links we are interested in.
        configuration - The configuration to open the files in.
        Returns:
        the URL of the HTML file that was searched.
        Throws:
        java.lang.Exception - If there is a problem opening a model.