Class Script

    • Field Detail

      • evaluateScript

        public Parameter evaluateScript
        Parameter indicating whether the script text's expression should be evaluated or not. Ptolemy interprets the dollar sign to indicate that the value of a parameter should be inserted; for example, $pi and a variable pi=3.14 would evaluate to 3.14. However, many scripting languages such as jQuery use a dollar sign as part of the script itself (to refer to jQuery variables). In this case, we want to insert the exact plain text into the web page, not the evaluated text.
      • eventType

        public AreaEventType eventType
        Event type to respond to by executing the command given by the value of this Script parameter. The script will be run when the icon corresponding to the container of this parameter gets one of the following events:
        • onblur: Command to be run when an element loses focus.
        • onclick: Command to be run on a mouse click.
        • ondblclick: Command to be run on a mouse double-click.
        • onfocus: Command to be run when an element gets focus.
        • onmousedown: Command to be run when mouse button is pressed.
        • onmousemove: Command to be run when mouse pointer moves.
        • onmouseout: Command to be run when mouse pointer moves out of an element.
        • onmouseover: Command to be run when mouse pointer moves over an element.
        • onmouseup: Command to be run when mouse button is released.
        • onkeydown: Command to be run when a key is pressed.
        • onkeypress: Command to be run when a key is pressed and released.
        • onkeyup: Command to be run when a key is released.
        These are the events supported by the HTML area tag. The default is "onmouseover".
      • script

        public StringParameter script
        Script to insert in the head section of the web page. This will normally define a JavaScript function that will be invoked when the UI event specified by eventType occurs. By default, this is blank. For example, if the value of this parameter is the string
            function writeText(text) {
            document.getElementById("xyz").innerHTML = text;
            };
            
        and the value of this parameter is "writeText('hello world')", then the HTML element with ID xyz will be populated with the string 'hello world' when the UI action eventType occurs.
    • Method Detail

      • getMimeType

        public java.lang.String getMimeType()
        Script is of type text/javascript for backwards compatibility. return string text/javascript
        Specified by:
        getMimeType in interface WebExportable
        Returns:
        The Mime type of the content (for example, text/html)
      • isOverwriteable

        public boolean isOverwriteable()
        Return true, since new scripts and method calls should overwrite old.
        Specified by:
        isOverwriteable in interface WebExportable
        Returns:
        True, since new scripts and method calls should overwrite old