Examples of FXGNode


Examples of com.adobe.fxg.dom.FXGNode

        // Record starting position
        startLine = locator.getLineNumber();
        startColumn = locator.getColumnNumber();

        // Check the current parent
        FXGNode parent = null;
        if (stack.size() > 0)
            parent = stack.peek();

        // Switch to special GroupDefinitionNode for Definition child
        if (isFXGNamespace(uri))
        {
            if (parent instanceof DefinitionNode && FXG_GROUP_ELEMENT.equals(localName))
                localName = FXG_GROUP_DEFINITION_ELEMENT;
        }

        // Create a node for this element
        FXGNode node = createNode(uri, localName);
       
        if (node == null)
        {
            if (root != null)
            {
                if (root.isVersionGreaterThanCompiler())
                {
                    // Warning: Minor version of this FXG file is greater than minor
                    // version supported by this compiler. Log a warning for an
                    // unknown element.
                    FXGLog.getLogger().log(FXGLogger.WARN, "UnknownElement", null, documentName, startLine, startColumn, localName, versionHandler.getVersion().asString());
                    unknownElement = localName;
                    return;
                }else
                {
                    throw new FXGException(startLine, startColumn, "UnknownElementInVersion", root.getFileVersion().asString(), localName);                   
                }
            }
            else
            {
                throw new FXGException(startLine, startColumn, "InvalidFXGRootNode");
            }
        }

        // Provide access to the root document node used for querying version
        // for non-root elements
        if (root != null)
        {
            node.setDocumentNode(root);
        }
       
        // Set node name if it is a delegate node. This allows proper error
        // message to be reported.
        if (node instanceof DelegateNode)
        {
            DelegateNode propertyNode = (DelegateNode)node;
            propertyNode.setName(localName);
        }
       
        // Set attributes on the current node
        for (int i = 0; i < attributes.getLength(); i++)
        {
            String attributeURI = attributes.getURI(i);
            if (attributeURI == null || attributeURI == "" || isFXGNamespace(attributeURI))
            {
                String attributeName = attributes.getLocalName(i);
                String attributeValue = attributes.getValue(i);
                node.setAttribute(attributeName, attributeValue);
            }
        }

        // Associate child with parent node (and handle any special
        // relationships)
        if (parent != null)
        {
            if (node instanceof DelegateNode)
            {
                DelegateNode propertyNode = (DelegateNode)node;
                propertyNode.setDelegate(parent);
            }
            else
            {
                parent.addChild(node);
            }
        }
        else if (node instanceof GraphicNode)
        {
            root = (GraphicNode)node;
            // Provide access to the root document node
            node.setDocumentNode(root);
            if (root.getVersion() == null)
            {
                // Exception: <Graphic> doesn't have the required attribute
                // "version".
                throw new FXGException(startLine, startColumn, "MissingVersionAttribute");
View Full Code Here

Examples of com.adobe.fxg.dom.FXGNode

    public void characters(char[] ch, int start, int length)
            throws SAXException
    {
        if (stack != null && stack.size() > 0 && !inSkippedElement() && (unknownElement == null))
        {
            FXGNode node = stack.peek();
            String content = new String(ch, start, length);

            if (!(node instanceof PreserveWhiteSpaceNode))
            {
                content = content.trim();
            }
           
            if (content.length() > 0)
            {
                CDATANode cdata = new CDATANode();
                cdata.content = content;
                assignNodeLocation(cdata);
                node.addChild(cdata);
            }
        }

        // Reset starting position
        startLine = locator.getLineNumber();
View Full Code Here

Examples of com.adobe.fxg.dom.FXGNode

     * @param localName - the name of the element
     * @return FXGNode instance if
     */
    protected FXGNode createNode(String uri, String localName)
    {
        FXGNode node = null;

        try
        {
            Map<String, Class<? extends FXGNode>> elementNodes = getElementNodes(uri);
            if (elementNodes != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.