Class IconScript

  • All Implemented Interfaces:
    java.lang.Cloneable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, ValueListener, WebExportable
    Direct Known Subclasses:
    DefaultIconScript

    public class IconScript
    extends Script
    implements WebExportable
    A parameter associating a JavaScript with an icon in model. This class assumes that the icon becomes an area in an image map on an HTML page. This parameter provides a way to specify a script to execute when that area in the image map is the target of some UI event, such as mouse movement or clicking or keyboard action. A typical use of this would be to set its string value to something like "foo(args)" where foo is a JavaScript function defined in the script parameter. You can also provide HTML text to insert into the start or end sections of the container's container's web page.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Field Detail

      • endText

        public StringParameter endText
        Text to insert in the end section of the web page. This text will be inserted exactly once.
      • startText

        public StringParameter startText
        Text to insert in the start section of the web page. This text will be inserted exactly once.
      • jQueryLibraries

        public StringParameter jQueryLibraries
        jQuery libraries to be included in the HEAD section of the html file The path to the libraries will be copied in the same order as given.
    • Method Detail

      • _provideElements

        protected void _provideElements​(WebExporter exporter)
                                 throws IllegalActionException
        Provide content to the specified web exporter to be included in a web page. This class provides an area attribute, and also the value of script, startText, and endText, if any has been provided. These value get inserted into the container's container's corresponding HTML sections, where the script is inserted inside a JavaScript HTML element.
        Overrides:
        _provideElements in class WebContent
        Parameters:
        exporter - The web exporter to add content to
        Throws:
        IllegalActionException - If evaluating the value of this parameter fails.
      • _provideAttributes

        protected void _provideAttributes​(WebExporter exporter)
                                   throws IllegalActionException
        Provide method call to invoke script that can be included as an attribute of an HTML tag, e.g. onclick="runFunction()" in <button onclick="runFunction()"/>
        Overrides:
        _provideAttributes in class WebContent
        Parameters:
        exporter - The web exporter to which to write content.
        Throws:
        IllegalActionException - If the eventType cannot be obtained, the web attribute cannot be created or set.