Package com.google.gxp.compiler.base

Examples of com.google.gxp.compiler.base.ContentType


  public Schema schema(String contentType) {
    return new BuiltinSchemaFactory().fromContentTypeName(contentType);
  }

  public ContentType htmlContentType() {
    return new ContentType(pos(), "html", htmlSchema());
  }
View Full Code Here


    map.put(attribute, schema.getElementValidator(element).getAttributeValidator(attribute));
    return new BundleType(pos, "BundleType", schema, map);
  }

  protected ContentType contentType(SourcePosition pos, Schema schema) {
    return new ContentType(pos, "ContentType", schema);
  }
View Full Code Here

        }
        if (!outsideClass) {
          sb.append("static ");
        }
      }
      sb.append(toCppType(new ContentType(template.getSchema())));
      sb.append(" ");
      if (outsideClass) {
        sb.append(getQualifiedClassName(template.getName()));
        sb.append("::");
      }
View Full Code Here

          alertSink, node.getSourcePosition(), className);
    }

    public Void visitInterfaceElement(GxpNamespace.GxpElement node) {
      TemplateName.FullyQualified name = createRootName(node);
      ContentType contentType = createContentType(node, DEFAULT_CONTENT_TYPE);

      // add a "this" parameter to the list of Parameters
      List<Parameter> parameters = Lists.newArrayList(nodeParts.getParameters());
      FormalParameter formal = new FormalParameter(node.getSourcePosition(),
                                                   Implementable.INSTANCE_PARAM_NAME,
                                                   Implementable.INSTANCE_PARAM_NAME,
                                                   new TemplateType(node.getSourcePosition(),
                                                                    name.toString(), name));
      parameters.add(new Parameter(formal));

      List<JavaAnnotation> javaAnnotations =
          getJavaAnnotations(node, JavaAnnotation.Element.INTERFACE);
      List<Import> imports = nodeParts.getImports();
      List<ThrowsDeclaration> throwsDeclarations = nodeParts.getThrowsDeclarations();
      List<FormalTypeParameter> formalTypeParameters = nodeParts.getFormalTypeParameters();

      if (contentType != null) {
        output.accumulate(new Interface(node,
                                        name,
                                        contentType.getSchema(),
                                        javaAnnotations,
                                        imports,
                                        throwsDeclarations,
                                        parameters,
                                        formalTypeParameters));
View Full Code Here

        alertSink.add(new UnknownContentTypeError(node, contentType));
      }

      return (schema == null)
          ? null
          : new ContentType(node.getSourcePosition(),
                            node.getDisplayName(),
                            schema);
    }
View Full Code Here

      if (consumesContent) {
        if (!"*".equals(content)) {
          alertSink.add(new InvalidAttributeValueError(attrMap.getAttribute("content")));
        }
        if (rootSchema != null) {
          defaultType = new ContentType(node.getSourcePosition(),
                                        node.getDisplayName(),
                                        rootSchema);
        }
      }

View Full Code Here

    public Void visitTemplateElement(GxpNamespace.GxpElement node) {
      TemplateName.FullyQualified name = createRootName(node);

      AttributeMap attrMap = nodeParts.getAttributes();

      ContentType contentType = createContentType(node, DEFAULT_CONTENT_TYPE);

      List<Constructor> constructors = nodeParts.getConstructors();
      Constructor constructor = constructors.isEmpty()
          ? Constructor.empty(node) : constructors.get(0);

      if (constructors.size() > 1) {
        alertSink.add(new MoreThanOneConstructorError(constructors.get(1)));
      }

      List<JavaAnnotation> javaAnnotations = getJavaAnnotations(node,
                                                                JavaAnnotation.Element.CLASS,
                                                                JavaAnnotation.Element.INSTANCE,
                                                                JavaAnnotation.Element.INTERFACE);

      List<Import> imports = nodeParts.getImports();
      List<ImplementsDeclaration> implementsDeclarations = nodeParts.getImplementsDeclarations();
      List<ThrowsDeclaration> throwsDeclarations = nodeParts.getThrowsDeclarations();
      List<Parameter> parameters = nodeParts.getParameters();
      List<FormalTypeParameter> formalTypeParameters = nodeParts.getFormalTypeParameters();
      Expression content = getCollapsableContent(attrMap);

      if (contentType != null) {
        output.accumulate(new Template(node,
                                       name,
                                       contentType.getSchema(),
                                       javaAnnotations,
                                       constructor,
                                       imports,
                                       implementsDeclarations,
                                       throwsDeclarations,
View Full Code Here

      String comment = attrMap.getOptional("comment", null);
      boolean hidden = attrMap.getBooleanValue("hidden");
      // TODO(laurence): coerce content to HTML
      Expression content = getCollapsableContent(attrMap);

      ContentType contentType = createContentType(node, null);
      Schema schema = (contentType == null) ? null : contentType.getSchema();

      output.accumulate(
          new UnextractedMessage(node, schema, name, meaning, comment, hidden, content));
      return null;
    }
View Full Code Here

          alertSink, node.getSourcePosition(), className);
    }

    public Void visitInterfaceElement(GxpNamespace.GxpElement node) {
      TemplateName.FullyQualified name = createRootName(node);
      ContentType contentType = createContentType(node, DEFAULT_CONTENT_TYPE);

      // add a "this" parameter to the list of Parameters
      List<Parameter> parameters = Lists.newArrayList(nodeParts.getParameters());
      FormalParameter formal = new FormalParameter(node.getSourcePosition(),
                                                   Implementable.INSTANCE_PARAM_NAME,
                                                   Implementable.INSTANCE_PARAM_NAME,
                                                   new TemplateType(node.getSourcePosition(),
                                                                    name.toString(), name));
      parameters.add(new Parameter(formal));

      List<JavaAnnotation> javaAnnotations =
          getJavaAnnotations(node, JavaAnnotation.Element.INTERFACE);
      List<Import> imports = nodeParts.getImports();
      List<ThrowsDeclaration> throwsDeclarations = nodeParts.getThrowsDeclarations();
      List<FormalTypeParameter> formalTypeParameters = nodeParts.getFormalTypeParameters();

      if (contentType != null) {
        output.accumulate(new Interface(node,
                                        name,
                                        contentType.getSchema(),
                                        javaAnnotations,
                                        imports,
                                        throwsDeclarations,
                                        parameters,
                                        formalTypeParameters));
View Full Code Here

        alertSink.add(new UnknownContentTypeError(node, contentType));
      }

      return (schema == null)
          ? null
          : new ContentType(node.getSourcePosition(),
                            node.getDisplayName(),
                            schema);
    }
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.base.ContentType

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.