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

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


      String elementStr = attrMap.getOptional("element", null);
      if (elementStr != null) {
        try {
          element = JavaAnnotation.Element.valueOf(elementStr.toUpperCase());
        } catch (IllegalArgumentException e) {
          alertSink.add(new InvalidAttributeValueError(attrMap.getValue("element", null)));
          with = null;
        }
      }

      if (with != null) {
View Full Code Here


          } 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
View Full Code Here

    assertNoUnexpectedAlerts();
  }

  public void testOutputElement_invalidAttrValue() throws Exception {
    compile("<div align='foo'></div>");
    assertAlert(new InvalidAttributeValueError(pos(2,1), "'align' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

        "<gxp:loop var='x' type='", "' iterable='list' >content</gxp:loop>");
  }

  public void testLoop_invalidGxpType() throws Exception {
    compile("<gxp:loop var='x' gxp:type='bad' iterable='list'>content</gxp:loop>");
    assertAlert(new InvalidAttributeValueError(pos(2,1), "'gxp:type' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

    if (str == null || str.equals("false")) {
      return false;
    } else if (str.equals("true")) {
      return true;
    } else {
      alertSink.add(new InvalidAttributeValueError(getAttribute(name)));
      return false;
    }
  }
View Full Code Here

    assertEquals(true,  attrMap.getBooleanValue("foo"));
    assertEquals(false, attrMap.getBooleanValue("bar"));
    assertEquals(false, attrMap.getBooleanValue("baz"));
    assertEquals(false, attrMap.getBooleanValue("buz"));

    expectedAlerts.add(new InvalidAttributeValueError(badAttr));

    attrMap.reportUnusedAttributes();
  }
View Full Code Here

* to annotations.
*/
public class AnnotateErrorTest extends BaseTestCase {
  public void testInvalidElement() throws Exception {
    compile("<java:annotate element='bad' with='@Foo' />");
    assertAlert(new InvalidAttributeValueError(pos(2,1), "'element' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

                                        ObjectConstant oc,
                                        AlertSink alertSink) {

    AttributeValidator validator = getValidator(paramName);
    if (!validator.isValidValue(oc.getValue())) {
      alertSink.add(new InvalidAttributeValueError(oc));
    }

    return (validator.isFlagSet(AttributeValidator.Flag.BOOLEAN))
        ? new BooleanConstant(oc, true)
        : new StringConstant(oc, null, oc.getValue());
View Full Code Here

      if (value != null) {
        SpaceOperator result =
            SpaceOperator.valueOf(value.trim().toUpperCase());
        if (result == null) {
          alertSink.add(
              new InvalidAttributeValueError(attrMap.getAttribute(ns, name)));
        }
        return result;
      } else {
        return null;
      }
View Full Code Here

    private Type createGxpType(Node node, AttributeMap attrMap, Attribute gxpType) {
      String kind = gxpType.getValue().getStaticString(alertSink, null);

      GxpType type = GxpType.parse(kind);
      if (type == null) {
        alertSink.add(new InvalidAttributeValueError(gxpType));
        return null;
      }
      switch (type) {
        case BOOL:
          return new BooleanType(node);
        case BUNDLE:
          String from = attrMap.get("from-element", null);
          if (from == null || rootSchema == null) {
            return null;
          }

          Map<String, AttributeValidator> subAttrMap = Maps.newHashMap(
              rootSchema.getElementValidator(from).getAttributeValidatorMap());

          // remove items from the exclude list
          String exclude = attrMap.getOptional("exclude", null);
          if (exclude != null) {
            for (String eItem : exclude.split(",")) {
              // TODO(harryh): make sure items in exclude list
              //               actually remove elements
              subAttrMap.remove(eItem.trim());
            }
          }

          return new BundleType(node, rootSchema, subAttrMap);
        default:
          alertSink.add(new InvalidAttributeValueError(gxpType));
          return null;
      }
    }
View Full Code Here

TOP

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

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.