Class DefaultIconScript

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

    public class DefaultIconScript
    extends IconScript
    A parameter specifying default JavaScript actions to associate with icons in model. Putting this attribute into a model causes the icons of entities, attributes, or both, to be assigned a default action of type given by eventType, where the action is defined by the value of this parameter. This will replace any configuration default that targets the same event type, includes the same objects, and targets the same instanceOf possibilities.

    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 web page.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Field Detail

      • instancesOf

        public StringParameter instancesOf
        If non-empty (the default), specifies a class name. Only entities or attributes (depending on include) implementing the specified class will be assigned the control defined by this DefaultIconScript parameter.
      • include

        public StringParameter include
        Specification of whether to provide the default behavior for Attributes, Entities, or both. This is either "Entities" (the default), "Attributes", or "All".
    • Method Detail

      • _provideAttributes

        protected void _provideAttributes​(WebExporter exporter)
                                   throws IllegalActionException
        Provide content to the specified web exporter to be included in a web page for the container of this object. This class provides default content for each object as specified by include and instancesOf.
        Overrides:
        _provideAttributes in class IconScript
        Parameters:
        exporter - The web exporter to add content to
        Throws:
        IllegalActionException - If a subclass throws it.
      • _provideDefaultAttributes

        protected void _provideDefaultAttributes​(NamedObj object,
                                                 WebExporter exporter)
                                          throws IllegalActionException
        Return attributes for default events, e.g. onmouseover(). If an attribute is already defined for this event, do nothing. Returns null in this class. Derived classes should override.
        Parameters:
        exporter - The WebExporter to add content to
        object - The NamedObj to generate default events for
        Throws:
        IllegalActionException - If there is a problem creating the content or if there is a name duplication with the created attributes