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

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


    assertNoUnexpectedAlerts();
  }

  public void testParam_badHasConstructor() throws Exception {
    compileInterface("<gxp:param name='foo' type='int' has-constructor='yes' />");
    assertAlert(new InvalidAttributeValueError(pos(2,1), "'has-constructor' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here


    assertNoUnexpectedAlerts();
  }

  public void testParam_badHasDefault() throws Exception {
    compileInterface("<gxp:param name='foo' type='int' has-default='yes' />");
    assertAlert(new InvalidAttributeValueError(pos(2,1), "'has-default' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

    assertNoUnexpectedAlerts();
  }

  public void testMsg_badHiddenAttribute() throws Exception {
    compile("<gxp:msg hidden='no'>foo</gxp:msg>");
    assertAlert(new InvalidAttributeValueError(pos(2,1), "'hidden' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

    assertNoUnexpectedAlerts();
  }

  public void testNamedMsg_badHiddenAttribute() throws Exception {
    compile("<gxp:msg name='NAME' hidden='no'>foo</gxp:msg>");
    assertAlert(new InvalidAttributeValueError(pos(2,1), "'hidden' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

    compile("<gxp:msg>",
            "<gxp:ph example='' name='foo'/>",
            "<gxp:eval expr='x'/>",
            "<gxp:eph/>",
            "</gxp:msg>");
    assertAlert(new InvalidAttributeValueError(pos(3, 1),
                                               "'example' attribute"));
    assertNoUnexpectedAlerts();
  }
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

    assertNoUnexpectedAlerts();
  }

  public void testParam_invalidContent() throws Exception {
    compile("<gxp:param name='foo' content='bar' />");
    assertAlert(new InvalidAttributeValueError(pos(2,1),
                                               "'content' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

      String content = attrMap.getOptional("content", null);
      Type defaultType = null;
      boolean consumesContent = content != null;
      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

      String name = attrMap.get("name", null);
      String example = attrMap.getOptional("example", null);
      if (example != null) {
        if (example.trim().length() == 0) {
          alertSink.add(
              new InvalidAttributeValueError(attrMap.getAttribute("example")));
          example = "<var>" + name + "</var>";
        }
      }
      if (name != null) {
        output.accumulate(new PlaceholderStart(node, null, name, example));
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.