Examples of DotPathValue


Examples of com.google.gwt.libideas.resources.css.ast.CssProperty.DotPathValue

          Value dotPathValue = params.get(0);
          String dotPath = maybeUnquote(((StringValue) dotPathValue).getValue());
          String suffix = params.size() == 3
              ? maybeUnquote(((StringValue) params.get(2)).getValue()) : "";

          return new DotPathValue(dotPath, suffix);
        } else if (value.getFunctionName().equals(LITERAL_FUNCTION_NAME)) {
          // This is a call to value()
          List<Value> params = new ArrayList<Value>();
          extractValueOf(params, value.getParameters());
View Full Code Here

Examples of com.google.gwt.libideas.resources.css.ast.CssProperty.DotPathValue

        validateValue(logger, resourceBundleType, v);
      }
      return;
    }

    DotPathValue dot = value.isDotPathValue();
    if (dot != null) {
      String[] elements = dot.getPath().split("\\.");
      if (elements.length == 0) {
        logger.log(TreeLogger.ERROR, "value() functions must specify a path");
        throw new UnableToCompleteException();
      }
View Full Code Here

Examples of com.google.gwt.resources.css.ast.CssProperty.DotPathValue

        validateValue(logger, resourceBundleType, v);
      }
      return;
    }

    DotPathValue dot = value.isDotPathValue();
    if (dot != null) {
      try {
        // This will either succeed or throw an exception
        ResourceGeneratorUtil.getMethodByPath(resourceBundleType,
            dot.getParts(), null);
      } catch (NotFoundException e) {
        logger.log(TreeLogger.ERROR, e.getMessage());
        throw new UnableToCompleteException();
      }
    }
View Full Code Here

Examples of com.google.gwt.resources.css.ast.CssProperty.DotPathValue

      // Allow the user to use both raw idents and quoted strings
      if (s.startsWith("\"")) {
        s = s.substring(1, s.length() - 1);
      }

      resourceFunction = new DotPathValue(s);

    } else if ((listValue = value.isListValue()) != null) {
      List<Value> values = listValue.getValues();
      if (values.size() == 1) {
        setImageProperty(values.get(0));
View Full Code Here

Examples of com.google.gwt.resources.css.ast.CssProperty.DotPathValue

          Value dotPathValue = params.get(0);
          String dotPath = maybeUnquote(((StringValue) dotPathValue).getValue());
          String suffix = params.size() == 3
              ? maybeUnquote(((StringValue) params.get(2)).getValue()) : "";

          return new DotPathValue(dotPath, suffix);
        } else if (value.getFunctionName().equals(LITERAL_FUNCTION_NAME)) {
          // This is a call to value()
          List<Value> params = new ArrayList<Value>();
          extractValueOf(params, value.getParameters());
View Full Code Here

Examples of com.google.gwt.resources.css.ast.CssProperty.DotPathValue

      if (value.isIdentValue() != null && cssToGssConstantMapping.containsKey(expression)) {
        expression = cssToGssConstantMapping.get(expression);
      } else if (value.isExpressionValue() != null) {
        expression = value.getExpression();
      } else if (value.isDotPathValue() != null) {
        DotPathValue dotPathValue = value.isDotPathValue();
        if (insideUrlNode) {
          expression = dotPathValue.getPath();
        } else {
          if (Strings.isNullOrEmpty(dotPathValue.getSuffix())) {
            expression = String.format(VALUE, dotPathValue.getPath());
          } else {
            expression =
                String.format(VALUE_WITH_SUFFIX, dotPathValue.getPath(), dotPathValue.getSuffix());
          }
        }
      } else if (value.isFunctionValue() != null) {
        FunctionValue functionValue = value.isFunctionValue();
View Full Code Here

Examples of com.google.gwt.resources.css.ast.CssProperty.DotPathValue

        validateValue(logger, resourceBundleType, v);
      }
      return;
    }

    DotPathValue dot = value.isDotPathValue();
    if (dot != null) {
      try {
        // This will either succeed or throw an exception
        ResourceGeneratorUtil.getMethodByPath(resourceBundleType,
            dot.getParts(), null);
      } catch (NotFoundException e) {
        logger.log(TreeLogger.ERROR, e.getMessage());
        throw new UnableToCompleteException();
      }
    }
View Full Code Here

Examples of com.google.gwt.resources.css.ast.CssProperty.DotPathValue

  }

  @Override
  public void endVisit(CssSprite x, Context ctx) {
    JClassType bundleType = context.getClientBundleType();
    DotPathValue functionName = x.getResourceFunction();

    if (functionName == null) {
      logger.log(TreeLogger.ERROR, "The @sprite rule " + x.getSelectors()
          + " must specify the " + CssSprite.IMAGE_PROPERTY_NAME + " property");
      throw new CssCompilerException("No image property specified");
    }

    JClassType imageResourceType = context.getGeneratorContext().getTypeOracle().findType(
        ImageResource.class.getName());
    assert imageResourceType != null;

    // Find the image accessor method
    JMethod imageMethod;
    try {
      imageMethod = ResourceGeneratorUtil.getMethodByPath(bundleType,
          functionName.getParts(), imageResourceType);
    } catch (NotFoundException e) {
      logger.log(TreeLogger.ERROR, "Unable to find ImageResource method "
          + functionName + " in " + bundleType.getQualifiedSourceName() + " : "
          + e.getMessage());
      throw new CssCompilerException("Cannot find image function");
    }

    ImageOptions options = imageMethod.getAnnotation(ImageOptions.class);
    RepeatStyle repeatStyle;
    if (options != null) {
      repeatStyle = options.repeatStyle();
    } else {
      repeatStyle = RepeatStyle.None;
    }

    String instance = "(" + context.getImplementationSimpleSourceName()
        + ".this." + functionName.getExpression() + ")";

    CssRule replacement = new CssRule();
    replacement.getSelectors().addAll(x.getSelectors());
    List<CssProperty> properties = replacement.getProperties();
View Full Code Here

Examples of com.google.gwt.resources.css.ast.CssProperty.DotPathValue

          Value dotPathValue = params.get(0);
          String dotPath = maybeUnquote(((StringValue) dotPathValue).getValue());
          String suffix = params.size() == 3
              ? maybeUnquote(((StringValue) params.get(2)).getValue()) : "";

          return new DotPathValue(dotPath, suffix);
        } else if (value.getFunctionName().equals(LITERAL_FUNCTION_NAME)) {
          // This is a call to value()
          List<Value> params = new ArrayList<Value>();
          extractValueOf(params, value.getParameters());
View Full Code Here

Examples of com.google.gwt.resources.css.ast.CssProperty.DotPathValue

        result.add(val);
        continue;
      } else if (def instanceof CssUrl) {
        assert def.getValues().size() == 1;
        assert def.getValues().get(0).isDotPathValue() != null;
        DotPathValue functionName = def.getValues().get(0).isDotPathValue();

        JType methodType = null;
        try {
          methodType = ResourceGeneratorUtil.getMethodByPath(context.getClientBundleType(),
              functionName.getParts(), null).getReturnType();
        } catch (NotFoundException e) {
          logger.log(TreeLogger.ERROR, e.getMessage());
          throw new CssCompilerException("Cannot find data method");
        }

        if (!(methodType instanceof JClassType) ||
            (!dataResourceType.isAssignableFrom((JClassType) methodType) &&
            !imageResourceType.isAssignableFrom((JClassType) methodType))) {
          String message = "Invalid method type for url substitution: " + methodType + ". " +
              "Only DataResource and ImageResource are supported.";
          logger.log(TreeLogger.ERROR, message);
          throw new CssCompilerException(message);
        }

        StringBuilder expression = new StringBuilder();
        expression.append("\"url('\" + ");
        expression.append(context.getImplementationSimpleSourceName());
        expression.append(".this.");
        expression.append(functionName.getExpression());
        expression.append(".getSafeUri().asString()");
        expression.append(" + \"')\"");
        result.add(new ExpressionValue(expression.toString()));
      } else {
        for (Value defValue : def.getValues()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.