Class ExportParameters


  • public class ExportParameters
    extends java.lang.Object
    A data structure containing parameters for exporting a Ptolemy model to a web page. This data structure will typically be provided by an instance of WebExportParameters, which is an Attribute that can be stored in a model.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Christopher Brooks and Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected NamedObj _jsCopier
      Directory into which JavaScript and related files have been written, or null if they are not being copied.
      java.awt.Color backgroundColor
      Background color.
      boolean copyJavaScriptFiles
      If true, then make an exported web page stand alone.
      boolean deleteFilesOnExit
      If true, files generated will be deleted when the JVM terminates.
      java.io.File directoryToExportTo
      The directory to export to.
      java.lang.String HTMLPathForFiles
      The path to use for accessing the file in the HTML code.
      java.lang.String imageFormat
      The image format to use, which can be one of "gif" (the default), "png", or "jpg".
      boolean openCompositesBeforeExport
      If true, hierarchically open all composite actors in the model before exporting (so that these also get exported, and hyperlinks to them are created).
      boolean runBeforeExport
      If true, run the model before exporting (to open plotter or other display windows that get exported).
      boolean showInBrowser
      If true, open a web browser to display the resulting export.
      boolean usePtWebsite
      If true, use the server-side includes of the Ptolemy website.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExportParameters()
      Construct an instance of this data structure with default values, which are null for backgroundColor, false for copyJavaScriptFiles, null for directoryToExportTo, false for openCompositesBeforeExport, false for runBeforeExport, and true for showInBrowser.
      ExportParameters​(java.io.File directoryToExportTo)
      Construct an instance of this data structure with default values, which are null for backgroundColor, false for copyJavaScriptFiles, false for deleteFilesOnExit, false for openCompositesBeforeExport, false for runBeforeExport, true for showInBrowser, and empty String for HTMLPathForFiles.
      ExportParameters​(java.io.File directoryToExportTo, ExportParameters template)
      Construct an instance of this data structure that is identical to the one given except for directoryToExportTo, which is as specified.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      NamedObj getJSCopier()
      Get the composite entity that is copying JavaScript and related files; return null if they are not being copied.
      void setJSCopier​(NamedObj copier)
      Specify the composite entity responsible for copying JavaScript and related files.
      • Methods inherited from class java.lang.Object

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

      • backgroundColor

        public java.awt.Color backgroundColor
        Background color. A null value indicates to use the background color of the model.
      • copyJavaScriptFiles

        public boolean copyJavaScriptFiles
        If true, then make an exported web page stand alone. Instead of referencing JavaScript and image files on the ptolemy.org website, if this parameter is true, then the required files will be copied into the target directory. This is a boolean that defaults to false.
      • deleteFilesOnExit

        public boolean deleteFilesOnExit
        If true, files generated will be deleted when the JVM terminates.
      • directoryToExportTo

        public java.io.File directoryToExportTo
        The directory to export to.
      • HTMLPathForFiles

        public java.lang.String HTMLPathForFiles
        The path to use for accessing the file in the HTML code. This can differ from the physical location of the file in the file system depending on how the exporter accesses the files. For example, an HttpService uses a URL as a path since the WebServer has a resource handler to serve files. The HTML to include e.g. an image would be:
          <img src="/files/imagename.gif"/>
          
        even though the image is stored in $PTT/org/ptolemy/ptango/temp, since the resource handler is mapped to http://hostname:port/servicename/files.
      • imageFormat

        public java.lang.String imageFormat
        The image format to use, which can be one of "gif" (the default), "png", or "jpg".
      • openCompositesBeforeExport

        public boolean openCompositesBeforeExport
        If true, hierarchically open all composite actors in the model before exporting (so that these also get exported, and hyperlinks to them are created).
      • runBeforeExport

        public boolean runBeforeExport
        If true, run the model before exporting (to open plotter or other display windows that get exported). Note that it is important the model have a finite run.
      • showInBrowser

        public boolean showInBrowser
        If true, open a web browser to display the resulting export.
      • usePtWebsite

        public boolean usePtWebsite
        If true, use the server-side includes of the Ptolemy website.
      • _jsCopier

        protected NamedObj _jsCopier
        Directory into which JavaScript and related files have been written, or null if they are not being copied.
    • Constructor Detail

      • ExportParameters

        public ExportParameters()
        Construct an instance of this data structure with default values, which are null for backgroundColor, false for copyJavaScriptFiles, null for directoryToExportTo, false for openCompositesBeforeExport, false for runBeforeExport, and true for showInBrowser.
      • ExportParameters

        public ExportParameters​(java.io.File directoryToExportTo)
        Construct an instance of this data structure with default values, which are null for backgroundColor, false for copyJavaScriptFiles, false for deleteFilesOnExit, false for openCompositesBeforeExport, false for runBeforeExport, true for showInBrowser, and empty String for HTMLPathForFiles.
        Parameters:
        directoryToExportTo - The directory to export to.
      • ExportParameters

        public ExportParameters​(java.io.File directoryToExportTo,
                                ExportParameters template)
        Construct an instance of this data structure that is identical to the one given except for directoryToExportTo, which is as specified.
        Parameters:
        directoryToExportTo - The directory to export to.
        template - The template parameters.
    • Method Detail

      • getJSCopier

        public NamedObj getJSCopier()
        Get the composite entity that is copying JavaScript and related files; return null if they are not being copied. Note that this would ideally be protected, as it is used only by ExportHTMLAction, but to avoid package dependencies, we have to make it public.
        Returns:
        The composite entity that is set to copy JavaScript and related files, or null if they are not being copied.
        See Also:
        setJSCopier(NamedObj)
      • setJSCopier

        public void setJSCopier​(NamedObj copier)
        Specify the composite entity responsible for copying JavaScript and related files. Set to null if they are not being copied. This will normally be the same as the model for which these parameters apply, its container, or a container above that in the hierarchy. Note that this would ideally be protected, as it is used only by ExportHTMLAction, but to avoid package dependencies, we have to make it public.
        Parameters:
        copier - The composite entity responsible for copying JavaScript and related files.
        See Also:
        getJSCopier()