Class WebAttribute

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable

    public class WebAttribute
    extends StringAttribute
    Class containing information and methods for properties for web content, for example, an HTML attribute that is part of an HTML element, as in the "href" attribute of <a href="http://www.w3schools.com">This is a link</a> The _elementName is used as the name of the attribute, e.g. "href" in <a href="http://www.w3schools.com">This is a link</a>. An object is not allowed to have two attributes with the same _elementName, since it is assumed that these attributes will belong to the same web element. For example, an HTML tag with two href elements should not be allowed, since it is unclear what behavior occurs (first takes precedence? second? both?) <a href="http://site1.com" href="http://site2.com">This is a link</a>
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Elizabeth Latronico
    Pt.AcceptedRating:
    Red (ltrnc)
    Pt.ProposedRating:
    Red (ltrnc)
    • Method Detail

      • appendToWebAttribute

        public static WebAttribute appendToWebAttribute​(NamedObj container,
                                                        java.lang.String id,
                                                        java.lang.String webName,
                                                        java.lang.String content)
                                                 throws IllegalActionException
        Factory method for creating WebAttributes that appends to the attribute if it already exists and does not have the specified content. Return the modified or new WebAttribute. Set persistent to false. This is static so that any WebExportable may call it.
        Parameters:
        container - The container object for the WebAttribute
        id - The Ptolemy name for the WebAttribute (needed to ensure a unique Ptolemy name)
        webName - The web name of this WebAttribute.
        content - The value of this WebAttribute.
        Returns:
        The WebAttribute that was created (or that previously existed) with persistent set to false
        Throws:
        IllegalActionException - if the WebAttribute cannot be created (perhaps another Attribute exists with the requested name)
      • getWebName

        public java.lang.String getWebName()
        Return the web name of this element; for example, "myElement" in <div name="myElement"> </div> in HTML.
        Returns:
        The web name of this element; for example, "myElement" in <div name="myElement"> </div> in HTML.
        See Also:
        setWebName(String)
      • setWebName

        public void setWebName​(java.lang.String webName)
        Set the web name of this element; for example, "myElement" in <div name="myElement"> </div> in HTML.
        Parameters:
        webName - The web name of this element; for example, "myElement" in <div name="myElement"> </div> in HTML.
        See Also:
        getWebName()
      • createWebAttribute

        public static WebAttribute createWebAttribute​(NamedObj container,
                                                      java.lang.String id,
                                                      java.lang.String webName)
                                               throws IllegalActionException
        Factory method for creating WebAttributes. Checks if there is an existing WebAttribute with the same name. If so, return it; if not create a new one. Sets persistent to false. Static so that any WebExportable may call it.
        Parameters:
        container - The container object for the WebAttribute
        id - The Ptolemy name for the WebAttribute (needed to ensure a unique Ptolemy name)
        webName - The web name of this WebAttribute
        Returns:
        The WebAttribute that was created (or that previously existed) with persistent set to false
        Throws:
        IllegalActionException - if the WebAttribute cannot be created (perhaps another Attribute exists with the requested name)