Example usage for com.google.common.css.compiler.ast CssFunctionNode setArguments

List of usage examples for com.google.common.css.compiler.ast CssFunctionNode setArguments

Introduction

In this page you can find the example usage for com.google.common.css.compiler.ast CssFunctionNode setArguments.

Prototype

public void setArguments(CssFunctionArgumentsNode arguments) 

Source Link

Usage

From source file:com.google.gwt.resources.gss.ResourceUrlFunction.java

private CssFunctionNode buildUrlNode(String javaExpression, SourceCodeLocation location) {
    CssFunctionNode urlNode = GssFunctions.createUrlNode("", location);
    CssJavaExpressionNode cssJavaExpressionNode = new CssJavaExpressionNode(javaExpression);
    CssFunctionArgumentsNode arguments = new CssFunctionArgumentsNode(
            ImmutableList.<CssValueNode>of(cssJavaExpressionNode));
    urlNode.setArguments(arguments);

    return urlNode;
}

From source file:com.google.gwt.resources.gss.ImageSpriteCreator.java

private CssDeclarationNode buildBackgroundDeclaration(String imageResource, String repeatText,
        SourceCodeLocation location) {//w ww .j a v  a  2s.  co  m
    // build the url function
    CssFunctionNode urlFunction = new CssFunctionNode(Function.byName("url"), location);
    CssDotPathNode imageUrl = new CssDotPathNode(resourceThisPrefix,
            imageResource + ".getSafeUri" + ".asString", null, null, location);
    CssFunctionArgumentsNode urlFunctionArguments = new CssFunctionArgumentsNode();
    urlFunctionArguments.addChildToBack(imageUrl);
    urlFunction.setArguments(urlFunctionArguments);

    // build left offset
    CssDotPathNode left = new CssDotPathNode(resourceThisPrefix, imageResource + ".getLeft", "-", "px",
            location);

    // build top offset
    CssDotPathNode top = new CssDotPathNode(resourceThisPrefix, imageResource + ".getTop", "-", "px", location);

    // build repeat
    CssLiteralNode repeat = new CssLiteralNode(repeatText, location);

    CssPropertyNode propertyNode = new CssPropertyNode("background", location);
    CssPropertyValueNode propertyValueNode = new CssPropertyValueNode(
            ImmutableList.of(urlFunction, left, top, repeat));
    propertyValueNode.setSourceCodeLocation(location);

    return createDeclarationNode(propertyNode, propertyValueNode, location, true);
}