Package com.google.gwt.thirdparty.common.css.compiler.ast

Examples of com.google.gwt.thirdparty.common.css.compiler.ast.GssError


  private void createSprite(CssDeclarationNode declaration) {
    List<CssValueNode> valuesNodes = declaration.getPropertyValue().getChildren();

    if (valuesNodes.size() != 1) {
      errorManager.report(new GssError(SPRITE_PROPERTY_NAME + " must have exactly one value",
          declaration.getSourceCodeLocation()));
      return;
    }

    String imageResource = valuesNodes.get(0).getValue();

    JMethod imageMethod;
    try {
      imageMethod = methodByPathHelper.getMethodByPath(context, getPathElement(imageResource),
          imageResourceType);
    } catch (NotFoundException e) {
      errorManager.report(new GssError("Unable to find ImageResource method "
          + imageResource + " in " + context.getClientBundleType().getQualifiedSourceName() + " : "
          + e.getMessage(), declaration.getSourceCodeLocation()));
      return;
    }

    ImageOptions options = imageMethod.getAnnotation(ImageOptions.class);
    RepeatStyle repeatStyle = options != null ? options.repeatStyle() : RepeatStyle.None;

    Builder<CssDeclarationNode> listBuilder = ImmutableList.builder();
    SourceCodeLocation sourceCodeLocation = declaration.getSourceCodeLocation();

    String repeatText;
    switch (repeatStyle) {
      case None:
        repeatText = " no-repeat";
        listBuilder.add(buildHeightDeclaration(imageResource, sourceCodeLocation));
        listBuilder.add(buildWidthDeclaration(imageResource, sourceCodeLocation));
        break;
      case Horizontal:
        repeatText = " repeat-x";
        listBuilder.add(buildHeightDeclaration(imageResource, sourceCodeLocation));
        break;
      case Vertical:
        repeatText = " repeat-y";
        listBuilder.add(buildWidthDeclaration(imageResource, sourceCodeLocation));
        break;
      case Both:
        repeatText = " repeat";
        break;
      default:
        errorManager.report(new GssError("Unknown repeatStyle " + repeatStyle,
            sourceCodeLocation));
        return;
    }

    listBuilder.add(buildOverflowDeclaration(sourceCodeLocation));
View Full Code Here


  @Override
  public boolean enterDefinition(CssDefinitionNode node) {
    if (inConditionalRule()) {
      if (lenient) {
        errorManager.reportWarning(new GssError("You should not define a constant inside a " +
            "ConditionalNode that will be evaluated at runtime. This will be disallowed in " +
            "the next version of GWT.", node.getSourceCodeLocation()));
      } else {
        errorManager.report(new GssError("You cannot define a constant inside a ConditionalNode " +
            "that will be evaluated at runtime.", node.getSourceCodeLocation()));
      }
    }
    return false;
  }
View Full Code Here

  @Override
  public boolean enterUnknownAtRule(CssUnknownAtRuleNode node) {
    if (inConditionalRule() && "external".equals(node.getName().getValue())) {
      if (lenient) {
        errorManager.reportWarning(new GssError("You should not define a external at-rule inside" +
            " a  ConditionalNode that will be evaluated at runtime. This will be disallowed in " +
            "the next version of GWT.", node.getSourceCodeLocation()));
      } else {
        errorManager.report(new GssError("You cannot define a external at-rule inside a " +
            "ConditionalNode that will be evaluated at runtime.", node.getSourceCodeLocation()));
      }
    }
    return super.enterUnknownAtRule(node);
  }
View Full Code Here

    try {
      methodType = methodByPathHelper.getReturnType(context, pathElements);
    } catch (NotFoundException e) {
      String message = e.getMessage() != null ? e.getMessage() : "Invalid path";
      errorManager.report(new GssError(message, location));
      throw new GssFunctionException(message, e);
    }

    if (!dataResourceType.isAssignableFrom((JClassType) methodType) &&
        !imageResourceType.isAssignableFrom((JClassType) methodType)) {
      String message = "Invalid method type for url substitution: " + methodType + ". " +
          "Only DataResource and ImageResource are supported.";
      errorManager.report(new GssError(message, location));
      throw new GssFunctionException(message);
    }
  }
View Full Code Here

          externalClassNames.add(selector);
        }
      } else if (value instanceof CssLiteralNode) {
        externalClassNames.add(value.getValue());
      } else {
        errorManager.report(new GssError("External at-rule invalid. The following terms is not " +
            "accepted in an external at-rule [" + value.getValue() + "]", sourceCodeLocation));
      }
    }
  }
View Full Code Here

        if (!permutationAxesSet.contains(permutationName)) {
          permutationAxesSet.add(permutationName);
        }
      } else {
        GssError error = new GssError("The expression [" + booleanExpressionNode.getValue() +
            "] is not valid condition.",
            booleanExpressionNode.getSourceCodeLocation());
        errorManager.report(error);
      }
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.thirdparty.common.css.compiler.ast.GssError

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.