Up to cover page | Back to Conformance | On to Appendixes

CGM Open specification - WebCGM 2.0 - ECMAScript binding


8. ECMAScript binding

This section is normative.

Prototype Object WebCGMException
    The WebCGMException class has the following constants:
        WebCGMException.INDEX_SIZE_ERR
            This constant is of type Number and its value is 1.
        WebCGMException.WEBCGMSTRING_SIZE_ERR
            This constant is of type Number and its value is 2.
        WebCGMException.INVALID_CHARACTER_ERR
            This constant is of type Number and its value is 3.
        WebCGMException.NO_DATA_ALLOWED_ERR
            This constant is of type Number and its value is 4.
        WebCGMException.NO_MODIFICATION_ALLOWED_ERR
            This constant is of type Number and its value is 5.
        WebCGMException.NOT_SUPPORTED_ERR
            This constant is of type Number and its value is 6.
        WebCGMException.INVALID_ACCESS_ERR
            This constant is of type Number and its value is 7.
        WebCGMException.FILE_NOT_FOUND_ERR
            This constant is of type Number and its value is 8.
        WebCGMException.FILE_INVALID_ERR
            This constant is of type Number and its value is 9.

Object WebCGMException
    The WebCGMException object has the following properties:
        code
            This property is of type Number.

Object GetWebCGMDocument
    The GetWebCGMDocument object has the following methods:
        getWebCGMDocument()
            This method returns a WebCGMMetafile.
    getAppName()
            This method returns a String.
    getAppVersion()
            This method returns a String.

Object WebCGMMetafile
    The WebCGMMetafile object has the following properties:
        metafileDescription
            This read-only property is of type String.
        firstPicture
            This read-only property is a WebCGMPicture object.
        metafileID
            This read-only property is of type String.
        metafileVersion
            This read-only property is of type Number.
        src
            This property is of type String.

    The WebCGMMetafile object has the following methods:
        addEventListener(type,listener);
            The type parameter is of type String.
            The listener parameter is a WebCGMEventListener object.
        removeEventListener(type,listener);
            The type parameter is of type String.
            The listener parameter is a WebCGMEventListener object.

Prototype Object WebCGMNode
    The WebCGMNode class has the following constants:
        WebCGMNode.PICTURE_NODE
            This constant is of type Number and its value is 1.
        WebCGMNode.APP_STRUCTURE_NODE
            This constant is of type Number and its value is 2.
        WebCGMNode.XML_METADATA_NODE
            This constant is of type Number and its value is 3.
        WebCGMNode.TEXT_NODE
            This constant is of type Number and its value is 4.
        WebCGMNode.ATTR_NODE
            This constant is of type Number and its value is 5.

Object WebCGMNode
    The WebCGMNode object has the following properties:
        nodeName
            This read-only property is of type String.
        nodeValue
            This read-only property is of type String, can raise a WebCGMException object on retrieval.
        nodeType
            This read-only property is of type Number.
        parentNode
            This read-only property is a WebCGMNode object.
        childNodes
            This read-only property is a WebCGMNodeList object.
        firstChild
            This read-only property is a WebCGMNode object.
        lastChild
            This read-only property is a WebCGMNode object.
        previousSibling
            This read-only property is a WebCGMNode object.
        nextSibling
            This read-only property is a WebCGMNode object.
        attributes
            This read-only property is a WebCGMNodeList object.
        ownerPicture
            This read-only property is a WebCGMPicture object.
        namespaceURI
            This read-only property is of type String.
        prefix
            This read-only property is of type String.
        localName
            This read-only property is of type String.

    The WebCGMNode object has the following methods:
        hasChildNodes()
            This method returns a Boolean.
        hasAttributes()
            This method returns a Boolean.
        getAttributeNS(namespaceURI, localName)
            This method returns a String.
            The namespaceURI parameter is of type String.
            The localName parameter is of type String.
        setAttributeNS(namespaceURI, qualifiedName, value)
            This method has no return value.
            The namespaceURI parameter is of type String.
            The qualifiedName parameter is of type String.
            The value parameter is of type String.
        getElementsByTagNameNS(namespaceURI, localName)
            This method returns a WebCGMNodeList object.
        The namespaceURI parameter is of type String.
            The localName parameter is of type String.

Object WebCGMPicture
    WebCGMPicture has all the properties and methods of the WebCGMNode object as well as the 
    properties and methods defined below.

    The WebCGMPicture object has the following properties:
        width
            This read-only property is of type Number.
        height
            This read-only property is of type Number.
        pictid
            This read-only property is of type String.

    The WebCGMPicture object has the following methods:
        applyCompanionFile(fileURI)
            This method returns a Boolean.
            The fileURI parameter is of type String.
        getAppStructureById(apsId)
            This method retuns a WebCGMNode.
            The apsId parameter is of type String.
        getAppStructuresByName(apsName)
            This method retuns a WebCGMNodeList.
            The apsName parameter is of type String.
        highlight(nodes,state)
            This method has no return value.
            The nodes parameter is a WebCGMNodeList object.
            The state parameter is of type Boolean.
        setPictureVisibility(visibility)
            This method has no return value.
            The visibility parameter is of type String.
        setStyleProperty(style,value)
            This method has no return value.
            The style parameter is of type String.
            The value parameter is of type String.
        reloadPicture()
            This method has no return value.

Object WebCGMAppStructure
    WebCGMAppStructure has all the properties and methods of the WebCGMNode object as well as the 
    properties and methods defined below.

    The WebCGMAppStructure object has the following properties: 
        apsId
            This read-only property is of type String.
        nameCount
            This read-only property is of type Number.
        linkuriCount
            This read-only property is of type Number.

    The WebCGMAppStructure object has the following methods:
        getAppStructureAttr(name)
            This method returns a String.
            The name parameter is of type String.
        setAppStructureAttr(name,value)
            This method has no return value.
            The name parameter is of type String.
            The value parameter is of type String.
        removeAppStructureAttr(name)
            This method has no return value.
            The name parameter is of type String.
        setStyleProperty(style,value)
            This method has no return value.
            The style parameter is of type String.
            The value parameter is of type String.

Object WebCGMNodeList
    The WebCGMNodeList object has the following properties: 
        count
            This read-only property is of type Number.

    The WebCGMNodeList object has the following methods:
        item(index)
            This method returns a WebCGMNode object.
            The index parameter is of type Number.
        removeItem(index) // should this raise an exception?
            This method returns a WebCGMNode object.
            The index parameter is of type Number.
        appendItem(newItem) // should this raise an exception?
            This method returns a WebCGMNode object.
            The newItem parameter is a WebCGMNode object.


Object WebCGMAttr
    WebCGMAttr has all the properties and methods of the WebCGMNode object as well as the 
    properties and methods defined below.

    The WebCGMAttr object has the following properties: 
        name
            This read-only property is of type String.
        value
            This property is of type String.
        ownerNode
            This read-only property is a WebCGMNode object.

Object WebCGMEventListener
    This is an ECMAScript function reference. This method has no return value. The parameter 
    is a WebCGMEvent object.

Object WebCGMEvent
    The WebCGMEvent object has the following properties:
        type
            This read-only property is of type String.
        target
            This read-only property is a WebCGMNode object.
        button
            This read-only property is of type Number.
        numPressed
            This read-only property is of type Number.
        clientX
            This read-only property is of type Number.
        clientY
            This read-only property is of type Number.
        ctrlKey
            This read-only property is of type Boolean.
        shiftKey
            This read-only property is of type Boolean.
        altKey
            This read-only property is of type Boolean.
        metaKey
            This read-only property is of type Boolean.

    The WebCGMEvent object has the following methods:
        preventDefault()
            This method has no return value.

Back to top of chapter