Package com.adobe.fxg

Examples of com.adobe.fxg.FXGException


            {
                if (definesScaleGrid())
                {
                    // Exception:A child Group cannot exist in a Group that
                    // defines the scale grid
                    throw new FXGException(child.getStartLine(), child.getStartColumn(), "InvalidScaleGridGroupChild");
                }
            }
        }
        else
        {
View Full Code Here


                    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) ||
                isApacheFlexNamespace(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");
            }
            else
            {
                if (!isMajorVersionMatch(root))
                {
                    FXGVersionHandler newVHandler = FXGVersionHandlerRegistry.getVersionHandler(root.getVersion());
                  
                    if (newVHandler == null)
                    {
                        if  (REJECT_MAJOR_VERSION_MISMATCH)
                        {
                            // Exception:Major version of this FXG file is greater than
                            // major version supported by this compiler. Cannot process
                            // the file.
                            throw new FXGException(startLine, startColumn, "InvalidFXGVersion", root.getVersion().asString());
                        }
                        else
                        {
                            // Warning: Major version of this FXG file is greater than
                            // major version supported by this compiler.
                            FXGLog.getLogger().log(FXGLogger.WARN, "MajorVersionMismatch", null, getDocumentName(), startLine, startColumn);

                            //use the latest version handler
                            versionHandler = FXGVersionHandlerRegistry.getLatestVersionHandler();
                            if (versionHandler == null)
                            {  
                                throw new FXGException("FXGVersionHandlerNotRegistered", root.getVersion().asString());                             
                            }                          
                        }
                    }
                    else
                    {
                        versionHandler = newVHandler;                       
                    }
                }
            }
            // Provide reference to the handler for querying version of the
            // current document processed.
            root.setDocumentName(documentName);
            root.setVersionGreaterThanCompiler(root.getVersion().greaterThan(versionHandler.getVersion()));
            root.setReservedNodes(versionHandler.getElementNodes(uri));
            root.setCompilerVersion(versionHandler.getVersion());
            root.setProfile(profile);
        }
        else
        {
            // Exception:<Graphic> must be the root node of an FXG document.
            throw new FXGException(startLine, startColumn, "InvalidFXGRootNode");
        }

        stack.push(node);

    }
View Full Code Here

            definesScaleGrid = true;
        }
        else if (FXG_ID_ATTRIBUTE.equals(name))
        {
          //Exception:The id attribute is not allowed on the Group child a Definition.
            throw new FXGException(getStartLine(), getStartColumn(), "InvalidGroupIDAttribute");
        }
        else
        {
            super.setAttribute(name, value);
        }
View Full Code Here

            skippedElements.add(localName);
            versionHandler.registerSkippedElements(uri, skippedElements);           
        }
        else
        {
            throw new FXGException("FXGVersionHandlerNotRegistered", version);
        }

    }
View Full Code Here

                }
            }
        }
        catch (Throwable t)
        {
            throw new FXGException(startLine, startColumn, "ErrorScanningFXG", t);
        }

        if (node != null)
        {
            assignNodeLocation(node);
View Full Code Here

            elementNodes.put(localName, nodeClass);
            vHandler.registerElementNodes(uri, elementNodes);
       
        else
        {
            throw new FXGException("FXGVersionHandlerNotRegistered", version);
        }
    }
View Full Code Here

        if (localName.equals(FXGConstants.FXG_PRIVATE_ELEMENT))
        {
            if (seenPrivateElement)
            {
                throw new FXGException("PrivateElementMultipleOccurrences", startLine, startColumn);
            }
            else
            {
                if ((!inSkippedElement()) && stack.size() == 1)
                    seenPrivateElement = true;
                else
                    throw new FXGException("PrivateElementNotChildOfGraphic", startLine, startColumn);
            }
        }
        else
        {
            if (seenPrivateElement && (!inSkippedElement()))
            {
                if ((!inMaskAfterPrivateElement) && (localName.equals(FXGConstants.FXG_MASK_ELEMENT)))
                {
                    inMaskAfterPrivateElement = true;
                }
                else
                {
                    if (!inMaskAfterPrivateElement)
                        throw new FXGException("PrivateElementNotLast", startLine, startColumn);
                }
            }
        }
    }
View Full Code Here

    {
        if (child instanceof GroupDefinitionNode)
        {
            if (groupDefinition != null)
              //Exception:Definitions must define a single Group child node.
                throw new FXGException(child.getStartLine(), child.getStartColumn(), "MissingGroupChildNode");

            groupDefinition = (GroupDefinitionNode)child;
        }
        else
        {
View Full Code Here

    {
        if (FXG_NAME_ATTRIBUTE.equals(name))
        {
            this.name = DOMParserHelper.parseIdentifier(this, value, name, this.name);
            if (((GraphicNode)this.getDocumentNode()).reservedNodes.containsKey(value))
                throw new FXGException(getStartLine(), getStartColumn(), "InvalidDefinitionName", value);
        }
        else
        {
            super.setAttribute(name, value);
        }
View Full Code Here

    public void addChild(FXGNode child)
    {
      //Exception:Child node {0} is not supported by node {1}.
        if (child == null)
        {
            throw new FXGException("InvalidChildNode",   null, getNodeName());
        }
        else
        {
            throw new FXGException(child.getStartLine(), child.getStartColumn(), "InvalidChildNode",  child.getNodeName(), getNodeName());           
        }
    }
View Full Code Here

TOP

Related Classes of com.adobe.fxg.FXGException

Copyright © 2018 www.massapicom. 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.