Package com.google.gxp.compiler.alerts.common

Examples of com.google.gxp.compiler.alerts.common.UnknownAttributeError


            "    <gxp:attr name='style'>",
            "      font-weight:bold",
            "    </gxp:attr>",
            "  </gxp:if>",
            "</div>");
    assertAlert(new UnknownAttributeError("<gxp:if>", pos(4,5), "'style' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here


  }

  public void testOutputElement_unknownAttr() throws Exception {
    // no namespace
    compile("<div foo='bar'></div>");
    assertAlert(new UnknownAttributeError("<div>", pos(2,1), "'foo' attribute"));
    assertNoUnexpectedAlerts();

    // gxp: namespace
    compile("<div gxp:foo='bar'></div>");
    assertAlert(new UnknownAttributeError("<div>", pos(2,1), "'gxp:foo' attribute"));
    assertNoUnexpectedAlerts();

    // expr: namespace
    compile("<div expr:foo='bar'></div>");
    assertAlert(new UnknownAttributeError("<div>", pos(2,1), "'foo' attribute"));
    assertNoUnexpectedAlerts();

    // <gxp:attr>
    compile("<div>",
            "  <gxp:attr name='foo'>",
            "    bar",
            "  </gxp:attr>",
            "</div>");
    assertAlert(new UnknownAttributeError("<div>", pos(3,3), "'foo' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

   * AlertSink} registered at construction.
   */
  public void reportUnusedAttributes() {
    for (Map.Entry<AttributeName, Attribute> entry : namesToAttrs.entrySet()) {
      if (!used.contains(entry.getKey())) {
        alertSink.add(new UnknownAttributeError(forNode, entry.getValue()));
      }
    }
  }
View Full Code Here

  }

  public void testTemplateWithBadAttr() throws Exception {
    ParsedAttribute spaz = attr("spaz", "I don't exist!");
    ParsedElement template = template(list(attr("name", "pkg.Test"), spaz));
    expectedAlerts.add(new UnknownAttributeError(template, spaz));
    IfExpandedTree parseTree = tree(template);
    ReparentedTree output = reparent(parseTree);
    assertOneRoot(output);
    Template root = getTemplate(output.getRoot());
    assertEquals(TEMPLATE_NAME, root.getName());
View Full Code Here

    attrMap.reportUnusedAttributes();
  }

  public void testUnused() throws Exception {
    Attribute attr = attr(NullNamespace.INSTANCE, "foo", str("quux"));
    expectedAlerts.add(new UnknownAttributeError(fromNode, attr));

    attrMap.add(attr);
    attrMap.reportUnusedAttributes();
  }
View Full Code Here

    assertEquals(attrValue, attrMap.get("foo", null));
  }

  public void testUnusedAttributes() {
    Attribute attr = injectAttribute();
    expectedAlerts.add(new UnknownAttributeError(FROM_NODE, attr));
  }
View Full Code Here

                                     List<ParsedElement> children) {
    // <expr:s /> -> <gxp:eval expr='s' />
    List<ParsedAttribute> newAttrs = Lists.newArrayList();
    for (ParsedAttribute attr : attrs) {
      if (attr.getName().equals("expr")) {
        alertSink.add(new UnknownAttributeError(displayName, sourcePosition,
                                                attr.getDisplayName()));
      } else {
        newAttrs.add(attr);
      }
    }
View Full Code Here

   * AlertSink} registered at construction.
   */
  public void reportUnusedAttributes() {
    for (Map.Entry<AttributeName, Attribute> entry : namesToAttrs.entrySet()) {
      if (!used.contains(entry.getKey())) {
        alertSink.add(new UnknownAttributeError(forNode, entry.getValue()));
      }
    }
  }
View Full Code Here

      // special case to disallow JavaScript iterator attribute this
      // isn't in JavaScriptCodeGenerator, because we want to generate an
      // alert for this even if we aren't generating JS code
      Attribute jsIterator = attrMap.getAttribute(JavaScriptNamespace.INSTANCE, "iterator");
      if (jsIterator != null) {
        alertSink.add(new UnknownAttributeError(node, jsIterator));
        return null;
      }

      if ((type != null) && (var != null) && !foundConflict) {
        output.accumulate(new LoopExpression(node, type, key, var, iterable, iterator,
View Full Code Here

          if (value instanceof StringConstant) {
            attr = attr.withValue(new ObjectConstant((StringConstant) value));
          }
          attrBuilder.put(attr.getName(), attr);
        } else {
          alertSink.add(new UnknownAttributeError(node, attr));
        }
      }

      TemplateName callee = TemplateName.parseDottedName(alertSink,
                                                         node.getSourcePosition(),
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.alerts.common.UnknownAttributeError

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.