Package org.apache.flex.compiler.tree.mxml

Examples of org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode


        // The codegen for a state-dependent instance node will require
        // an autogenerated id if that node doesn't have a specified id.
        // The codegen for a state-dependent property/style/event node
        // will require an autogenerated id for the target instance node
        // if the instance node doesn't have a specified id.
        IMXMLInstanceNode instanceNode = null;
        if (node instanceof IMXMLInstanceNode)
            instanceNode = (IMXMLInstanceNode)node;
        // in case of root node, parent won't be IMXMLInstanceNode
        else if (node instanceof IMXMLSpecifierNode && node.getParent() instanceof IMXMLInstanceNode)
            instanceNode = (IMXMLInstanceNode)node.getParent();
View Full Code Here


            return null;
        }

        // The id must be unique within the class.
        // Otherwise it will be null.
        IMXMLInstanceNode previousNodeWithSameID =
                ((MXMLClassDefinitionNode)getClassDefinitionNode()).addNodeWithID(value, this);

        if (previousNodeWithSameID != null && !isEqual(previousNodeWithSameID))
        {
            ICompilerProblem problem = new MXMLDuplicateIDProblem(attribute);
View Full Code Here

     * <p>
     * For other nodes, it does nothing.
     */
    private Context beginContext(IASNode node, Context parentContext)
    {
            IMXMLInstanceNode instanceNode = (IMXMLInstanceNode)node;
           
            // try to determine if this is the children of an MX Container
            boolean isMXMLDisplayObjectChild = node.getNodeID() == ASTNodeID.MXMLInstanceID &&
                                                (node.getParent().getNodeID() == ASTNodeID.MXMLInstanceID ||
                                                    node.getParent().getNodeID() == ASTNodeID.MXMLDocumentID);
            if (isMXMLDisplayObjectChild)
            {
                // if it is, build up the children in this instruction list
                parentContext.startUsing(IL.MXML_CONTENT_FACTORY);
                parentContext.isContentFactory = true;
            }

            final Context childContext = new Context(instanceNode, parentContext.currentInstructionList);
            childContext.parentContext = parentContext;
            if (isMXMLDisplayObjectChild)
                parentContext.stopUsing(IL.MXML_CONTENT_FACTORY, 0);
           
            // Remember the Name for the instance's Class,
            // so that processMXMLInstance() can use it to construct the instance
            // and so that endNode() can use it to generate the reference variable
            // autogenerated for the id and to generate an initializer method
            // if appropriate.
            ICompilerProject project = getProject();
            IClassDefinition instanceClassReference = instanceNode.getClassReference(project);
            childContext.instanceClassName =
                instanceClassReference != null ?
                ((DefinitionBase)instanceClassReference).getMName(project) :
                null;

View Full Code Here

                node instanceof IMXMLRemoteObjectMethodNode)
            {
                transferWebServiceOperationsOrRemoteObjectMethods((IMXMLInstanceNode)node, childContext, parentContext);
            }
       
            IMXMLInstanceNode instanceNode = (IMXMLInstanceNode)childContext.node;          
            Name instanceClassName = childContext.instanceClassName;
           
            if (!getProject().getTargetSettings().getMxmlChildrenAsData() && generateNonDescriptorCode)
            {
                callInitialized(instanceNode, childContext);
                setDocument(instanceNode, true, childContext);
                setDocumentDescriptorForInstance(instanceNode, childContext);
            }
           
            String id = instanceNode.getEffectiveID();
            if (id != null)
            {
                Name idName = new Name(id);
               
                // Create a reference variable in the class whose name is the id.
                // For example, for <s:Button id="b1"/>, create
                // public var b1:spark.components.Button;
                if( instanceNode.getID() != null )
                {
                    IDefinition d = instanceNode.resolveID();
                    // Only create reference var if it isn't already declared on base class
                    // Look for a property with the same name as this function in the base class
                    // the lookup will search up the inheritance chain, so we don't have to worry about
                    // walking up the inheritance chain here.
                    ClassDefinition base = (ClassDefinition)classDefinition.resolveBaseClass(getProject());
View Full Code Here

                        callAddLayer(node, context, designLayerChildNode);
                }
                else if (child instanceof IMXMLInstanceNode)
                {
                    // Set directInstanceChild.designLayer = designLayer.
                    final IMXMLInstanceNode instanceChildNode = (IMXMLInstanceNode)child;
                    setDesignLayer(node, context, instanceChildNode);
                }
            }
        }
        else
View Full Code Here

            {
                // Push the value of the element we're setting.
                // Note: Here we call processNode() on each child,
                // rather than calling traverse(), because we need to emit
                // code before and after each element value push.
                IMXMLInstanceNode elementNode = (IMXMLInstanceNode)vectorNode.getChild(i);
                processNode(elementNode, context);
               
            }
            // the type hint and conversion function add 2
            context.addInstruction(OP_newarray, context.numArrayValues + 2);     
            context.makingArrayValues = false;
        }
        else
        {
            // Synthesize the class Vector.<T>.
            context.addInstruction(OP_getlex, vectorName);
            context.addInstruction(OP_getlex, typeName);
            context.addInstruction(OP_applytype, 1);
           
            // Call the Vector.<T> constructor with 1 or two arguments.
            // The first is the number of elements.
            // The second is 'fixed', which defaults to false.
            context.pushNumericConstant(n);
            if (fixed)
                context.addInstruction(OP_pushtrue);
            context.addInstruction(OP_construct, fixed ? 2 : 1);
       
            // Set each element of the vector.
            for (int i = 0; i < n; i++)
            {
                // Push the vector instance whose element we're setting.
                context.addInstruction(OP_dup);
               
                // Push the index of the element we're setting.
                context.pushNumericConstant(i);
               
                // Push the value of the element we're setting.
                // Note: Here we call processNode() on each child,
                // rather than calling traverse(), because we need to emit
                // code before and after each element value push.
                IMXMLInstanceNode elementNode = (IMXMLInstanceNode)vectorNode.getChild(i);
                processNode(elementNode, context);
               
                // Set the element to the value.
                // This will pop the previous three values.
                context.addInstruction(OP_setproperty, indexName);
View Full Code Here

                        tempContext.addInstruction(OP_setproperty, n);
                    }
                }
                else
                {
                    IMXMLInstanceNode instanceNode = propertyNode.getInstanceNode();
                    if (instanceNode instanceof IMXMLSingleDataBindingNode)
                        processMXMLDataBinding((IMXMLSingleDataBindingNode)instanceNode, context);
                    else if (instanceNode instanceof IMXMLConcatenatedDataBindingNode)
                        processMXMLConcatenatedDataBinding((IMXMLConcatenatedDataBindingNode)instanceNode, context);
                }
            }
            return;
        }
       
        boolean isDb = isDataboundProp(propertyNode);

        if (generateDescriptorCode(propertyNode, context))
        {
            if (!isDb)
            {
                context.startUsing(IL.DESCRIPTOR_PROPERTIES);
               
                context.addInstruction(OP_pushstring, propertyName);
               
                traverse(propertyNode, context);
               
                context.stopUsing(IL.DESCRIPTOR_PROPERTIES, 1);
            }
            else
            {
                IMXMLInstanceNode instanceNode = propertyNode.getInstanceNode();
                if (instanceNode instanceof IMXMLSingleDataBindingNode)
                    processMXMLDataBinding((IMXMLSingleDataBindingNode)instanceNode, context);
                else if (instanceNode instanceof IMXMLConcatenatedDataBindingNode)
                    processMXMLConcatenatedDataBinding((IMXMLConcatenatedDataBindingNode)instanceNode, context);
            }
View Full Code Here

        // State-dependent nodes are handled by processMXMLState().
        if (isStateDependent(styleNode))
            return;
       
        // Data bound styles don't need this processing either
        IMXMLInstanceNode value = styleNode.getInstanceNode();
        if (isDataBindingNode(value))
        {
            return;
        }
       
View Full Code Here

        // State-dependent nodes are handled by processMXMLState().
        if (isStateDependent(effectNode))
            return;
       
        // Data bound styles don't need this processing either
        IMXMLInstanceNode value = effectNode.getInstanceNode();
        if (isDataBindingNode(value))
        {
            return;
        }
View Full Code Here

                    ((IMXMLInstanceNode)parentNode).getEffectiveID() :
                    "";
       
        String name = propertyOrStyleNode.getName();       
       
        IMXMLInstanceNode propertyOrStyleValueNode = propertyOrStyleNode.getInstanceNode();
       
        if (getProject().getTargetSettings().getMxmlChildrenAsData())
        {
            // Construct the SetProperty or SetStyle object.
            context.addInstruction(OP_findpropstrict, overrideName);
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode

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.