Package flex2.compiler.mxml.rep

Examples of flex2.compiler.mxml.rep.BindingExpression


        if (!inCDATA(flags))
        {
            //  binding?
            if (!ignoreBinding(flags))
            {
                BindingExpression result = parseBindingExpression(text);
                if (result != null)
                {
                    return result;
                }
                else
View Full Code Here


        ArgumentListNode argumentList = null;
        Iterator<BindingExpression> iterator = propertyWatcher.getBindingExpressions().iterator();

        while (iterator.hasNext())
        {
            BindingExpression bindingExpression = iterator.next();
            MemberExpressionNode base =
                AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, BINDINGS, false);
            GetExpressionNode selector = generateArrayIndex(nodeFactory, bindingExpression.getId());
            selector.setMode(Tokens.LEFTBRACKET_TOKEN);
            MemberExpressionNode memberExpression = nodeFactory.memberExpression(base, selector);
            argumentList = nodeFactory.argumentList(argumentList, memberExpression);
        }
View Full Code Here

        {
            CDATANode cdata = (CDATANode) node.getChildAt(0);

            if (cdata.image.length() > 0)
            {
                BindingExpression be = textParser.parseBindingExpression(cdata.image, cdata.beginLine);

                if (be != null)
                {
                    if (allowTopLevelBinding)
                    {
                        be.setDestination(xmlList);
                        writer.write("null");
                    }
                    else
                    {
                        log(cdata, new AbstractBuilder.BindingNotAllowed());                       
View Full Code Here

                else
                {
                    attrExpr = e4xElementsByLocalName + ".@" + attrName.getLocalPart();
                }

                BindingExpression be = attributeBindings.get(attrName);
               
                be.setDestinationLValue(attrExpr);
                be.setDestinationProperty(destinationProperty + "[" + node.getIndex() + "]");
                be.setDestination(xmlList);
                be.setDestinationXMLAttribute(true);
               
                // So be.getDestination() will use LValue.  The destinationProperty is wrong.               
                be.setDestinationE4X(true);
               
                //System.out.println("cdata: LValue=" + e4xElementsByLocalName + " prop=" + be.getDestinationProperty()));

                xmlList.setHasBindings(true);

                PrefixMapping.pushNamespaces(be, namespaces);
                if (nsUri.length() > 0)
                {
                    be.addNamespace(nsUri, nsId);
                }
            }
        }

        node.toStartElement(serializer);

        if (node.getChildCount() == 1 && node.getChildAt(0) instanceof CDATANode)
        {
            CDATANode cdata = (CDATANode) node.getChildAt(0);
            if (cdata.image.length() > 0)
            {
                BindingExpression be = textParser.parseBindingExpression(cdata.image, cdata.beginLine);
                if (be != null)
                {
                    //[Matt] I think this value is wrong but I can't see where it's used so we'll leave it for now.
                    String destinationProperty = createExpression(destinationPropertyStack);

                    be.setDestinationLValue(e4xElementsByLocalName);
                    be.setDestinationProperty(destinationProperty + "[" + node.getIndex() + "]");
                    be.setDestination(xmlList);
                    be.setDestinationXMLNode(true);
                   
                    // So be.getDestination() will use LValue.  The destinationProperty is wrong.
                    be.setDestinationE4X(true);

                    //System.out.println("cdata: LValue=" + e4xElementsByLocalName + " prop=" + be.getDestinationProperty()));
                   
                    xmlList.setHasBindings(true);
View Full Code Here

        for (Iterator<QName> i = node.getAttributeNames(); i != null && i.hasNext();)
        {
            QName qname = i.next();
            String value = (String) node.getAttributeValue(qname);
           
            BindingExpression be = textParser.parseBindingExpression(value, node.beginLine);

            if (be != null)
            {
                if (attributeBindings == null)
                {
View Full Code Here

        Iterator<BindingExpression> iterator = mxmlDocument.getBindingExpressions().iterator();

        while (iterator.hasNext())
        {
            BindingExpression bindingExpression = iterator.next();

            if (bindingExpression.isRepeatable())
            {
                ExpressionStatementNode expressionStatement = generateRepeatableBinding(bindingExpression);
                functionStatementList = nodeFactory.statementList(functionStatementList, expressionStatement);
            }
            else
            {
                ExpressionStatementNode expressionStatement = generateBinding(bindingExpression);
                functionStatementList = nodeFactory.statementList(functionStatementList, expressionStatement);
            }

            if (bindingExpression.getTwoWayCounterpart() != null)
            {
                if (bindingExpression.isTwoWayPrimary())
                {
                    // result[${bindingExpression.id}].isTwoWayPrimary = true;
                    ExpressionStatementNode expressionStatement =
                        generateIsTwoWayPrimaryAssignment(bindingExpression.getId());
                    functionStatementList = nodeFactory.statementList(functionStatementList, expressionStatement);
                }

                {
                    // result[${bindingExpression.id}].twoWayCounterpart = result[${bindingExpression.twoWayCounterpart.id}];
                    ExpressionStatementNode expressionStatement =
                        generateTwoWayCounterpartAssignment(bindingExpression.getId(),
                                                            bindingExpression.getTwoWayCounterpart().getId());
                    functionStatementList = nodeFactory.statementList(functionStatementList, expressionStatement);
                }

                if (bindingExpression.getTwoWayCounterpart().isTwoWayPrimary())
                {
                    // result[${bindingExpression.twoWayCounterpart.id}].isTwoWayPrimary = true;
                    ExpressionStatementNode expressionStatement =
                        generateIsTwoWayPrimaryAssignment(bindingExpression.getTwoWayCounterpart().getId());
                    functionStatementList = nodeFactory.statementList(functionStatementList, expressionStatement);
                }

                {
                    //result[${bindingExpression.twoWayCounterpart.id}].twoWayCounterpart = result[${bindingExpression.id}];
                    ExpressionStatementNode expressionStatement =
                        generateTwoWayCounterpartAssignment(bindingExpression.getTwoWayCounterpart().getId(),
                                                            bindingExpression.getId());
                    functionStatementList = nodeFactory.statementList(functionStatementList, expressionStatement);
                }
            }
        }
View Full Code Here

    if (node.getChildCount() == 1 && node.getChildAt(0) instanceof CDATANode)
    {
      CDATANode cdata = (CDATANode) node.getChildAt(0);
      if (cdata.image.length() > 0)
      {
          BindingExpression be = textParser.parseBindingExpression(cdata.image, cdata.beginLine);
          if (be != null)
          {
                    /**
                     * <mx:Model>{binding_expression}</mx:Model>
                     * or
                     * <mx:Model>@{binding_expression}</mx:Model>
                     */
                    be.setDestination(graph);
                    be.setDestinationObjectProxy(true);
          }
                else
                {
                    /**
                     * <mx:Model>some string</mx:Model>
View Full Code Here

             */
            CDATANode cdata = (CDATANode)node.getChildAt(0);

            if (cdata.image.length() > 0)
            {
                BindingExpression be = textParser.parseBindingExpression(cdata.image, cdata.beginLine);

                if (be != null)
                {
                    if (allowTopLevelBinding)
                    {
                        if (!be.isTwoWayPrimary() || allowTwoWayBind)
                        {
                            be.setDestination(xml);
                            writer.write("null");
                        }
                        else
                        {
                            log(cdata, new AbstractBuilder.TwoWayBindingNotAllowed());
View Full Code Here

                else
                {
                    attrExpr = getElementsByLocalName + ".attributes[\"" + attrName.getLocalPart() + "\"]";
                }

                BindingExpression be = attributeBindings.get(attrName);

                be.setDestinationE4X(e4x);
                be.setDestinationXMLAttribute(true);
                be.setDestinationLValue(attrExpr);
                be.setDestinationProperty(destinationProperty + "[" + node.getIndex() + "]");
                be.setDestination(xml);

                xml.setHasBindings(true);

                if (e4x)
                {
                    PrefixMapping.pushNamespaces(be, namespaces);
                    if (nsUri.length() > 0)
                    {
                        be.addNamespace(nsUri, nsId);
                    }
                }
            }
        }

        try
        {
            if (e4x)
            {
                node.toStartElement((StringWriter) serializer);
            }
            else
            {
                QName qname = new QName(node.getNamespace(), node.getLocalPart(), node.getPrefix());
                ((XMLStringSerializer) serializer).startElement(qname, new AttributesHelper(node));
            }

            if (node.getChildCount() == 1 && node.getChildAt(0) instanceof CDATANode)
            {
                CDATANode cdata = (CDATANode) node.getChildAt(0);
                if (cdata.image.length() > 0)
                {
                    if (cdata.inCDATA)
                    {
                        //in CDATA Section, leave exactly as is
                        if (e4x)
                        {
                            ((StringWriter) serializer).write("<![CDATA[" + cdata.image + "]]>");
                        }
                        else
                        {
                            ((XMLStringSerializer) serializer).writeString(cdata.image);
                        }                       
                    }
                    else
                    {
                        //not in CDATA section so extract bindings and cleanup binding escapes
                        BindingExpression be = textParser.parseBindingExpression(cdata.image, cdata.beginLine);
                        if (be != null)
                        {
                            if (be.isTwoWayPrimary() && !allowTwoWayBind)
                            {
                                log(cdata, new AbstractBuilder.TwoWayBindingNotAllowed());
                            }
                            else
                            {
                                String destinationProperty = createExpression(destinationPropertyStack);

                                be.setDestinationLValue(getElementsByLocalName);
                                be.setDestinationProperty(destinationProperty + "[" + node.getIndex() + "]");
                                be.setDestination(xml);
                                be.setDestinationXMLNode(true);

                                xml.setHasBindings(true);

                                if (e4x)
                                {
                                    be.setDestinationE4X(true);
                                    PrefixMapping.pushNamespaces(be, namespaces);
                                }
                            }
                        }
                        else if (e4x)
View Full Code Here

                        }                       
                    }
                    else
                    {
                        // We're not in CDATA section so extract bindings and cleanup binding escapes
                        BindingExpression be = textParser.parseBindingExpression(cdata.image, cdata.beginLine);
                        if (be != null)
                        {
                            if (be.isTwoWayPrimary() && !allowTwoWayBind)
                            {
                                log(cdata, new AbstractBuilder.TwoWayBindingNotAllowed());
                            }
                            else
                            {
                                be.setDestinationLValue(getElementsByLocalName + ".text()[" + (numCData - 1) + "]");
                                be.setDestinationProperty(destinationProperty + "[" + node.getIndex() + "]" + ".text()[" + i + "]" );
                                be.setDestination(xml);
                                be.setDestinationXMLNode(true);

                                xml.setHasBindings(true);

                                if (e4x)
                                {
                                    be.setDestinationE4X(true);
                                    PrefixMapping.pushNamespaces(be, namespaces);
                                }
                               
                                // Inject placeholder cdata child so we can target it
                                // with binding.
View Full Code Here

TOP

Related Classes of flex2.compiler.mxml.rep.BindingExpression

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.