Package com.google.gxp.compiler.base

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


        Schema msgSchema = msg.getSchema();
        if (msgSchema == null) {
          msgSchema = schema.getMsgSchema();
        }

        Expression result = msg.withContentAndSchema(
            msg.getContent().acceptVisitor(visitor(msgSchema)),
            msgSchema);

        if (!result.getSchema().isTranslatable()) {
          alertSink.add(new UntranslatableMsgError(result));
        }

        return postProcess(
            result.getSchema().equals(schema)
              ? result
              : new EscapeExpression(schema, result));
      }
View Full Code Here


              .acceptTypeVisitor(typeVisitor);
          Attribute value = visitor.visitAttribute(p.getValue());
          newParams.put(key, value);
        }

        Expression result = call.withParams(newParams.build());

        // If we are inside of an attribute with a content-type that matches the
        // content-type of the call, we'll need to escape the results into the
        // content-type of the element
        if (!attrStack.isEmpty()
            && !result.getSchema().equals(schema)
            && result.getSchema().equals(attrStack.peek().getInnerSchema())) {
          result = new EscapeExpression(schema, result);
        }

        return result;
      }
View Full Code Here

    @Override
    public Expression visitCollapseExpression(CollapseExpression value) {
      SpaceOperatorSet newSpaceOperators =
          value.getSpaceOperators().inheritFrom(spaceOperators);
      SearchingVisitor subVisitor = this.with(newSpaceOperators);
      Expression subExpression =
          value.getSubexpression().acceptVisitor(subVisitor);
      CollapsingVisitor collapsingVisitor =
          new CollapsingVisitor(newSpaceOperators);
      return subExpression.acceptVisitor(collapsingVisitor);
    }
View Full Code Here

      // useSpecialAttrCollapsing is used here to decide if ispace should
      // (by default) be normalized.  We do this for Attributes of OutputElements
      // and Attribute Bundles (which are essentially for OutputElements) because
      // we generally don't want \ns in these cases.  We do NOT use alternate
      // collapsing rules for Attributes that belong to calls.
      Expression newValue = useSpecialAttrCollapsing
          ? this.with(ATTR_SPACE_OPERATORS).apply(attr.getValue())
          : apply(attr.getValue());
      Expression newCondition = attr.getCondition();
      if (newCondition != null) {
        newCondition = apply(newCondition);
      }

      return attr.withValue(newValue).withCondition(newCondition);
View Full Code Here

      ElementValidator validator = element.getValidator();
      SearchingVisitor contentVisitor =
          validator.isFlagSet(ElementValidator.Flag.PRESERVESPACES)
            ? this.with(PRESERVING_SPACE_OPERATORS)
            : this;
      Expression result = element.withAttributesAndContent(
          Util.map(element.getAttributes(), getAttributeFunction()),
          element.getContent().acceptVisitor(contentVisitor));
      useSpecialAttrCollapsing = oldUseSpecialAttrCollapsing;
      return result;
    }
View Full Code Here

    @Override
    public Expression visitAttrBundleParam(AttrBundleParam bundle) {
      boolean oldUseSpecialAttrCollapsing = useSpecialAttrCollapsing;
      useSpecialAttrCollapsing = true;
      Expression result = super.visitAttrBundleParam(bundle);
      useSpecialAttrCollapsing = oldUseSpecialAttrCollapsing;
      return result;
    }
View Full Code Here

    @Override
    public Expression visitCall(Call call) {
      boolean oldUseSpecialAttrCollapsing = useSpecialAttrCollapsing;
      useSpecialAttrCollapsing = false;
      Expression result = super.visitCall(call);
      useSpecialAttrCollapsing = oldUseSpecialAttrCollapsing;
      return result;
    }
View Full Code Here

                 ((NativeType) params.get(0).getType()).getNativeType(OutputLanguage.JAVA));
    assertEquals(null, params.get(0).getDefaultValue());
    assertEquals("s", params.get(1).getPrimaryName());
    assertEquals("String",
                 ((NativeType) params.get(1).getType()).getNativeType(OutputLanguage.JAVA));
    Expression defValue = params.get(1).getDefaultValue();
    assertEquals("\"xyzzy\"", ((NativeExpression) defValue).getDefaultNativeCode());
    assertEmptyValue(root.getContent());
  }
View Full Code Here

    assertEquals(expectedAlerts.buildAndClear(),
                 actualAlerts.buildAndClear());
  }

  public void testBaseCase() {
    Expression content = parts.getContent();
    assertEquals("", ((StringConstant) content).evaluate());
    assertTrue(parts.getImports().isEmpty());
    assertTrue(parts.getParameters().isEmpty());
  }
View Full Code Here

  // used to make each injected value unique
  private static int currentValue = 0;

  private Expression injectValue() {
    Expression value = new StringConstant(NODE_POS, null,
                                          "[" + (currentValue++) + "]");
    parts.accumulate(value);
    return value;
  }
View Full Code Here

TOP

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

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.