Package macromedia.asc.parser

Examples of macromedia.asc.parser.MetaDataNode


                {
                    int numItems = comment.def.metaData.items.size();
                    for (int x = 0; x < numItems; x++)
                    {
                        Node md = comment.def.metaData.items.at(x);
                        MetaDataNode mdi = (md instanceof MetaDataNode) ? (MetaDataNode)(md) : null;
                       
                        // cn: why not just dump all the metaData ???
                        if (mdi != null && mdi.getId() != null)
                        {
                            // these metaData types can have their own DocComment associated with them, though they might also have no comment.
                            if (mdi.getId().equals(StandardDefs.MD_STYLE) || mdi.getId().equals(StandardDefs.MD_EVENT) || mdi.getId().equals(StandardDefs.MD_EFFECT)
                                    || mdi.getId().equals(StandardDefs.MD_SKINSTATE) || mdi.getId().equals(StandardDefs.MD_ALTERNATIVE)
                                    || mdi.getId().equals(StandardDefs.MD_DISCOURAGEDFORPROFILE))
                            {
                                if (x+1 < numItems// if it has a comment, it will be the sequentially next DocCommentNode
                                {
                                    Node next = comment.def.metaData.items.at(x+1);
                                    DocCommentNode metaDataComment = (next instanceof DocCommentNode) ? (DocCommentNode)next : null;

                                    if (metaDataComment != null)
                                    {
                                        createMetaDataComment(fullname, mdi, false, metaDataComment);
                                        x++;
                                    }
                                    else  // emit it even if it doesn't have a comment.
                                    {
                                        createMetaDataComment(fullname, mdi, true, null);
                                    }
                                }
                                else
                                {
                                    createMetaDataComment(fullname, mdi, true, null);
                                }
                            }
                            else if (mdi.getId().equals(StandardDefs.MD_BINDABLE) || mdi.getId().equals(StandardDefs.MD_DEPRECATED) || mdi.getId().equals(StandardDefs.MD_EXCLUDE))
                            {
                                createMetaDataComment(fullname, mdi, true, null);
                            }
                            else if (mdi.getId().equals(StandardDefs.MD_DEFAULTPROPERTY))
                            {
                                hasDefaultProperty = true;
                                createMetaDataComment(fullname, mdi, true, null);
                            }
                            else if (mdi.getId().equals(StandardDefs.MD_SKINPART))
                            {
                                String className = fullname.substring(0, fullname.indexOf("/"));
                                if(comment.getId() != null)
                                {
                                    createSkinPartMetaDataComment(className, mdi, false, comment);
View Full Code Here


  public void parse1(CompilationUnit unit, TypeTable typeTable) {
    Context cx = unit.getContext().getAscContext();
    for (Iterator iter = unit.metadata.iterator(); iter.hasNext(); )
    {
      MetaDataNode metaDataNode = (MetaDataNode)iter.next();
      if (StandardDefs.MD_MANAGED.equals(metaDataNode.getId()))
      {
        LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();
        cx.localizedError2(metaDataNode.pos(), new ManagedOnMXMLComponentError());
      }
    }
  }
View Full Code Here

      }     
    });
    ((ContextStatics) perCompileData).handler = context.getHandler();

    Parser parser = new Parser(context, stringBuffer.toString(), file.getName());
    MetaDataNode metaDataNode = parser.parseMetaData();
    macromedia.asc.parser.MetaDataEvaluator metaDataEvaluator = new macromedia.asc.parser.MetaDataEvaluator();
    metaDataNode.evaluate(context, metaDataEvaluator);

    return context.errorCount() > 0 ? null : new MetaData(metaDataNode);
  }
View Full Code Here

     * Generate a strongly typed variable 'hostComponent' on the current
     * class instance with type specified by the HostComponent metadata.
     */
    private void generateHostComponentVariable(Context cx, CompilationUnit unit, TypeAnalyzer typeAnalyzer)
    {
        MetaDataNode node = unit.hostComponentMetaData;

        if (node.count() == 1)
        {
            Node def = node.def;

            if (def instanceof ClassDefinitionNode)
            {
                unit.expressions.add(NameFormatter.toMultiName(node.getValue(0)));
                ClassDefinitionNode classDef = (ClassDefinitionNode) def;

                if (!classDeclaresIdentifier(cx, classDef, typeAnalyzer, SKINHOSTCOMPONENT))
                {
                    NodeFactory nodeFactory = cx.getNodeFactory();
                    MetaDataNode bindingMetaData = AbstractSyntaxTreeUtil.generateMetaData(nodeFactory, BINDABLE);
                    bindingMetaData.setId(BINDABLE);
                    StatementListNode statementList = nodeFactory.statementList(classDef.statements, bindingMetaData);

                    int listSize = node.def.metaData.items.size();
                    // if the HostComponent metadata node has more than one items.
                    // then look for the associated comment and stick it to the variable.
                    if (listSize > 1)
                    {
                        for (int ix = 0; ix < listSize; ix++)
                        {
                            // check if the node is of type MetaDataNode.
                            Node tempMeta = node.def.metaData.items.get(ix);

                            if (tempMeta instanceof MetaDataNode)
                            {
                                MetaDataNode tempMetaData = (MetaDataNode) tempMeta;

                                if ("HostComponent".equals(tempMetaData.getId()) && (ix < listSize - 1))
                                {
                                    // if the node has the comment, it would be the next one.
                                    Node temp = node.def.metaData.items.get(ix + 1);

                                    // if the last one is a DocCommentnode, we can run it through the evaluator.
View Full Code Here

        }
    }

    private void validateRequiredSkinPartsAndStates(Context cx, CompilationUnit unit, TypeTable typeTable)
    {
      MetaDataNode metaData = unit.hostComponentMetaData;
        String hostComponentClassName = metaData.getValue(0);
        AbcClass hostComponentClass = typeTable.getClass(NameFormatter.toColon(hostComponentClassName));

        if (hostComponentClass == null)
        {
            cx.localizedError2(cx.input.origin, metaData.pos(),
                               new HostComponentClassNotFound(hostComponentClassName));
        }
        else if (unit.hostComponentOwnerClass != null)
        {
            AbcClass skinClass = typeTable.getClass(unit.hostComponentOwnerClass);
            validateRequiredSkinParts(hostComponentClass, skinClass, cx, metaData.pos(), typeTable);
            validateRequiredSkinStates(hostComponentClass, skinClass, cx, metaData.pos());
        }
    }
View Full Code Here

        if ((getter != null) && (getter.metaData != null))
        {
            for (Node node : getter.metaData.items)
            {
                MetaDataNode metaData = (MetaDataNode) node;

                if ((metaData.getId() != null) &&
                    metaData.getId().equals(StandardDefs.MD_BINDABLE) &&
                    metaData.count() == 0)
                {
                    processBindableMetaData(nodeFactory, metaData);
                    processedBindableMetaData = true;
                }
            }
View Full Code Here

  {
    if (node.metaData != null && node.metaData.items != null)
    {
      for (Iterator iter = node.metaData.items.iterator(); iter.hasNext(); )
      {
        MetaDataNode md = (MetaDataNode)iter.next();
        if (StandardDefs.MD_BINDABLE.equals(md.getId()) && md.count() == 0)
        {
          iter.remove();
        }
      }
    }
View Full Code Here

        else if (unit.metadata != null)
        {

            for (Iterator iterator = unit.metadata.iterator(); iterator.hasNext();)
            {
                MetaDataNode metaDataNode = (MetaDataNode)iterator.next();
                if (EXCLUDE_CLASS.equals(metaDataNode.getId()))
                {
                    exclude = true;
                    break;
                }
            }
View Full Code Here

        if ((fromDefinition != null) && (fromDefinition.metaData != null))
        {
            for (Node node : fromDefinition.metaData.items)
            {
                MetaDataNode metaData = (MetaDataNode) node;

                if ((metaData.getId() != null) &&
                    metaData.getId().equals(StandardDefs.MD_BINDABLE) &&
                    metaData.count() == 0)
                {
                    processBindableMetaData(nodeFactory, metaData);
                    processedBindableMetaData = true;
                }

                metaData.def = toDefinition;
                classDefinitionStatementList.items.remove(metaData);
                nodeFactory.statementList(classDefinitionStatementList, metaData);
                toDefinition.metaData = nodeFactory.statementList(toDefinition.metaData, metaData);
            }

            fromDefinition.metaData = null;
        }

        if (addBindableMetaData && !processedBindableMetaData)
        {
            MetaDataNode bindableMetaData =
                AbstractSyntaxTreeUtil.generateMetaData(nodeFactory, BINDABLE,
                                                        EVENT_VAR, PROPERTY_CHANGE);
            nodeFactory.statementList(classDefinitionStatementList, bindableMetaData);           
            prepMetaDataNode(nodeFactory.getContext(), bindableMetaData);
        }
View Full Code Here

                {
                    int numItems = comment.def.metaData.items.size();
                    for (int x = 0; x < numItems; x++)
                    {
                        Node md = comment.def.metaData.items.at(x);
                        MetaDataNode mdi = (md instanceof MetaDataNode) ? (MetaDataNode)(md) : null;
                       
                        // cn: why not just dump all the metaData ???
                        if (mdi != null && mdi.getId() != null)
                        {
                            // these metaData types can have their own DocComment associated with them, though they might also have no comment.
                            if (mdi.getId().equals(StandardDefs.MD_STYLE) || mdi.getId().equals(StandardDefs.MD_EVENT) || mdi.getId().equals(StandardDefs.MD_EFFECT)
                                    || mdi.getId().equals(StandardDefs.MD_SKINSTATE) || mdi.getId().equals(StandardDefs.MD_ALTERNATIVE)
                                    || mdi.getId().equals(StandardDefs.MD_DISCOURAGEDFORPROFILE)
                                    ||  mdi.getId().equals(StandardDefs.MD_EXPERIMENTAL))
                            {
                                if (x+1 < numItems// if it has a comment, it will be the sequentially next DocCommentNode
                                {
                                    Node next = comment.def.metaData.items.at(x+1);
                                    DocCommentNode metaDataComment = (next instanceof DocCommentNode) ? (DocCommentNode)next : null;

                                    if (metaDataComment != null)
                                    {
                                        createMetaDataComment(fullname, mdi, false, metaDataComment);
                                        x++;
                                    }
                                    else  // emit it even if it doesn't have a comment.
                                    {
                                        createMetaDataComment(fullname, mdi, true, null);
                                    }
                                }
                                else
                                {
                                    createMetaDataComment(fullname, mdi, true, null);
                                }
                            }
                            else if (mdi.getId().equals(StandardDefs.MD_BINDABLE) || mdi.getId().equals(StandardDefs.MD_DEPRECATED) || mdi.getId().equals(StandardDefs.MD_EXCLUDE))
                            {
                                createMetaDataComment(fullname, mdi, true, null);
                            }
                            else if (mdi.getId().equals(StandardDefs.MD_DEFAULTPROPERTY))
                            {
                                hasDefaultProperty = true;
                                createMetaDataComment(fullname, mdi, true, null);
                            }
                            else if (mdi.getId().equals(StandardDefs.MD_SKINPART))
                            {
                                String className = fullname.substring(0, fullname.indexOf("/"));
                                if(comment.getId() != null)
                                {
                                    createSkinPartMetaDataComment(className, mdi, false, comment);
View Full Code Here

TOP

Related Classes of macromedia.asc.parser.MetaDataNode

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.