Package org.apache.flex.compiler.mxml

Examples of org.apache.flex.compiler.mxml.IMXMLTagData


    }

    @Override
    public IMXMLTagData getFirstChild(boolean includeEmptyTags)
    {
        IMXMLTagData nextTag = null;
        if (isEmptyTag())
            return null;
        if (isOpenTag())
        {
            nextTag = getNextTag();
        }
        else
        {
            // This is a close tag.  Start at the corresponding open tag.
            IMXMLTagData openTag = getContainingTag(getAbsoluteStart());
            nextTag = openTag.getNextTag();
        }
        // Skip any text blocks to find the next actual tag.  If it's an open tag,
        // that is our first child.  Otherwise it's a close tag, return null.
        while (true)
        {
View Full Code Here


    }

    @Override
    public IMXMLTagData getNextSibling(boolean includeEmptyTags)
    {
        IMXMLTagData nextTag = null;
        // Be sure we're starting at the close tag, then get the next tag.
        if (isCloseTag() || isEmptyTag())
        {
            nextTag = getNextTag();
        }
        else
        {
            IMXMLTagData endTag = findMatchingEndTag();
            if (endTag == null)
                return null;
            nextTag = endTag.getNextTag();
        }
        while (true)
        {
            if (nextTag == null || nextTag.isCloseTag())
                return null;
View Full Code Here

     * @return Array of children.
     */
    public IMXMLTagData[] getChildren(boolean includeEmptyTags)
    {
        ArrayList<IMXMLTagData> children = new ArrayList<IMXMLTagData>();
        IMXMLTagData child = getFirstChild(includeEmptyTags);
        while (child != null)
        {
            children.add(child);
            child = child.getNextSibling(includeEmptyTags);
        }
        return children.toArray(new IMXMLTagData[0]);
    }
View Full Code Here

    ensureOrder();
    final int size = openTags.size();
    boolean didNonPayloadRepair = false;
   
    for(int i = 0; i < size; i++) {
      IMXMLTagData openTag = openTags.get(i);
      if(!closeTags.isEmpty()) {
        final IMXMLTagData closeTag = closeTags.peek();
        if(closeTag.getName().compareTo(openTag.getName()) != 0) {
          //let's determine where to end, and then move all of our tags to our parent
          int insertOffset = -1;
          while(!closeTags.isEmpty()) {
            final IMXMLTagData pop = closeTags.pop();
            if(pop.getName().compareTo(openTag.getName()) != 0) {
              insertOffset = pop.getIndex();
              if(parent != null) {
                parent.addCloseTag(pop);
              } else {
                //since the parent cannot handle this, we should insert an open tag for this close tag
                  FakeMXMLTagData tagData = new FakeMXMLTagData(pop.getName(), false, false);
                                tagData.setOffsets(pop.getAbsoluteEnd(), pop.getAbsoluteEnd());
                                tagData.setLine(pop.getLine());
                                tagData.setColumn(pop.getColumn());
                  payload.add(new MXMLTagDataPayload(tagData, insertOffset - 1));
                problems.add(produceProblemFromToken(tagData, fileSpec));
                if(i + 1 < size)
                    openTag = openTags.get(++i);
               
View Full Code Here

            //walk up our chain to find the correct uri for our namespace.  first one wins
            String prefix = getPrefix();
            if (prefix == null)
                return null;

            IMXMLTagData lookingAt = parent;

            // For attributes with prefix, parent's parent can be null if
            // parent is the root tag
            while (lookingAt != null && lookingAt.getParent() != null)
            {
                PrefixMap depth = lookingAt.getParent().getPrefixMapForData(lookingAt);
                if (depth != null && depth.containsPrefix(prefix))
                {
                    uri = depth.getNamespaceForPrefix(prefix);
                    break;
                }

                lookingAt = lookingAt.getParentTag();
            }
        }

        return uri;
    }
View Full Code Here

    @Override
    public final IMXMLTagData getContainingTag(int offset)
    {
        FastStack<String> tagNames = new FastStack<String>();
        IMXMLUnitData current = getPrevious();
        IMXMLTagData containingTag = null;

        if (containsOffset(offset) && isCloseTag())
        {
            IMXMLTagData tag = (IMXMLTagData)this;
            tagNames.push(tag.getName());
        }

        while (current != null && containingTag == null)
        {
            if (current.isTag())
            {
                IMXMLTagData currentTag = (IMXMLTagData)current;

                if (currentTag.isCloseTag())
                {
                    tagNames.push(currentTag.getName());
                }
                else if (currentTag.isOpenTag() && !currentTag.isEmptyTag())
                {
                    String stackName = "";
                    while (stackName.compareTo(currentTag.getName()) != 0 && !tagNames.isEmpty())
                    {
                        stackName = tagNames.pop();
                    }
                    if (stackName.compareTo(currentTag.getName()) != 0)
                        containingTag = currentTag;
                }
            }

            current = current.getPrevious();
View Full Code Here

        PrefixMap result = nsMap.get(data);
        if (result != null)
            return result;
        if (data.isCloseTag())
        {
            IMXMLTagData openTagData = data.getParent().findTagOrSurroundingTagContainingOffset(data.getAbsoluteStart());
            if (openTagData != null)
                return nsMap.get(openTagData);
        }
        return null;
    }
View Full Code Here

     *
     * @return a {@link PrefixMap} or null
     */
    public PrefixMap getRootTagPrefixMap()
    {
        IMXMLTagData rootTag = getRootTag();
        if (rootTag != null)
        {
            return nsMap.get(rootTag);
        }
        return null;
View Full Code Here

        depth.push(-1);
        for (int i = 0; i < units.length; i++)
        {
            if (units[i] instanceof IMXMLTagData)
            {
                IMXMLTagData currentTag = (IMXMLTagData)units[i];
                if (currentTag.isCloseTag())
                {
                    if (!currentTag.isEmptyTag())
                        depth.pop();
                }
                ((MXMLTagData)currentTag).setParentUnitDataIndex(depth.peek());
                ((MXMLTagData)currentTag).setLocation(this, i);
                if (currentTag.isOpenTag())
                {
                    if (!currentTag.isEmptyTag())
                    {
                        depth.push(i);
                    }
                }
            }
View Full Code Here

            {
                return (IMXMLTagData)unit;
            }
            else if (unit.isText())
            {
                IMXMLTagData containingTag = unit.getContainingTag(unit.getAbsoluteStart());
                return containingTag;
            }
        }

        return null;
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.mxml.IMXMLTagData

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.