Package com.google.gxp.compiler.parser

Examples of com.google.gxp.compiler.parser.ParsedElement


    AlertSetBuilder alertSetBuilder = new AlertSetBuilder(parseTree.getAlerts());

    // make sure root element is a template
    List<ParsedElement> children = parseTree.getChildren();
    if (!children.isEmpty()) {
      ParsedElement first = children.get(0);
      if (!first.canBeRoot()) {
        alertSetBuilder.add(new InvalidRootError(first));
      } else {
        // determine the schema of this gxp
        String contentType = DEFAULT_CONTENT_TYPE;
        for (ParsedAttribute attr : first.getAttributes()) {
          if (attr.getName().equals("content-type")
              && attr.getNamespace() == NullNamespace.INSTANCE) {
            contentType = attr.getValue();
          }
        }
View Full Code Here


               root instanceof Template);
    return (Template)root;
  }

  public void testEmptyNamelessTemplate() throws Exception {
    ParsedElement template = template(NO_ATTRS);
    expectedAlerts.add(new MissingAttributeError(template, "name"));
    IfExpandedTree parseTree = tree(template);
    ReparentedTree output = reparent(parseTree);
    assertOneRoot(output);
    Template root = getTemplate(output.getRoot());
View Full Code Here

    assertEmptyValue(root.getContent());
  }

  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());
View Full Code Here

    assertEmptyValue(root.getContent());
  }

  public void testImportWithText() throws Exception {
    TextElement textNode = text("gremlin");
    ParsedElement badImp = imp(list(attr("class", "com.google.Foo")),
                               textNode);
    IfExpandedTree parseTree =
        tree(template(list(attr("name", "pkg.Test")),
                      badImp,
                      imp(list(attr("package", "com.google.bar"))),
View Full Code Here

    AlertSetBuilder alertSetBuilder = new AlertSetBuilder(parseTree.getAlerts());

    // make sure root element is a template
    List<ParsedElement> children = parseTree.getChildren();
    if (!children.isEmpty()) {
      ParsedElement first = children.get(0);
      if (!first.canBeRoot()) {
        alertSetBuilder.add(new InvalidRootError(first));
      } else {
        // determine the schema of this gxp
        String contentType = DEFAULT_CONTENT_TYPE;
        for (ParsedAttribute attr : first.getAttributes()) {
          if (attr.getName().equals("content-type")
              && attr.getNamespace() == NullNamespace.INSTANCE) {
            contentType = attr.getValue();
          }
        }
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.parser.ParsedElement

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.