Package com.google.gxp.compiler.schema

Examples of com.google.gxp.compiler.schema.AttributeValidator


      if (attrs.isEmpty()) {
        return Collections.emptyList();
      } else {
        List<Attribute> result = Lists.newArrayList();
        for (Attribute attr : attrs) {
          AttributeValidator attrValidator =
              elementValidator.getAttributeValidator(attr.getName());
          if (attrValidator == null) {
            alertSink.add(new UnknownAttributeError(forNode, attr));
          } else {
            Expression attrValue = attr.getValue();
            if (attrValue instanceof StringConstant) {
              String value = ((StringConstant) attrValue).evaluate();
              if (!attrValidator.isValidValue(value)) {
                alertSink.add(new InvalidAttributeValueError(attr));
              }
            }

            // if the attribute validator indicates an inner content type then
            // set this on the attribute
            String innerContentTypeString = attrValidator.getContentType();
            if (innerContentTypeString != null) {
              Schema innerSchema = schemaFactory.fromContentTypeName(innerContentTypeString);
              attr = attr.withInnerSchema(innerSchema);
            }
View Full Code Here


          includeAttrs.add(JAVA.toStringLiteral(includeAttr));
        }
        COMMA_JOINER.appendTo(sb, includeAttrs);
        sb.append(')');
        for (Map.Entry<AttributeValidator, Attribute> entry : bundle.getAttrs().entrySet()) {
          AttributeValidator validator = entry.getKey();
          Expression condition = entry.getValue().getCondition();
          Expression value = entry.getValue().getValue();

          sb.append(".attr(");
          sb.append(JAVA.toStringLiteral(validator.getName()));
          sb.append(", ");
          sb.append(validator.isFlagSet(AttributeValidator.Flag.BOOLEAN)
                      ? value.acceptVisitor(this)
                      : toAnonymousClosure(value));
          if (condition != null) {
            sb.append(", ");
            sb.append(condition.acceptVisitor(this));
View Full Code Here

          includeAttrs.add(SCALA.toStringLiteral(includeAttr));
        }
        COMMA_JOINER.appendTo(sb, includeAttrs);
        sb.append(')');
        for (Map.Entry<AttributeValidator, Attribute> entry : bundle.getAttrs().entrySet()) {
          AttributeValidator validator = entry.getKey();
          Expression condition = entry.getValue().getCondition();
          Expression value = entry.getValue().getValue();

          sb.append(".attr(");
          sb.append(SCALA.toStringLiteral(validator.getName()));
          sb.append(", ");
          sb.append(validator.isFlagSet(AttributeValidator.Flag.BOOLEAN)
                      ? value.acceptVisitor(this)
                      : toAnonymousClosure(value));
          if (condition != null) {
            sb.append(", ");
            sb.append(condition.acceptVisitor(this));
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.schema.AttributeValidator

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.