Example usage for com.google.common.css.compiler.ast CssPropertyNode CssPropertyNode

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

Introduction

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

Prototype

public CssPropertyNode(String value, @Nullable SourceCodeLocation sourceCodeLocation) 

Source Link

Document

Creates a property node with the specified value and source code location.

Usage

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

private CssDeclarationNode buildBackgroundDeclaration(String imageResource, String repeatText,
        SourceCodeLocation location) {/*from  ww w.  j a  v a2s  . c o 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);
}

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

private CssDeclarationNode buildHeightDeclaration(String imageResource, SourceCodeLocation location) {
    CssPropertyNode propertyNode = new CssPropertyNode("height", location);
    CssValueNode valueNode = new CssDotPathNode(resourceThisPrefix, imageResource + ".getHeight", null, "px",
            location);//from   w ww.ja va 2s.  c o  m

    CssPropertyValueNode propertyValueNode = new CssPropertyValueNode(ImmutableList.of(valueNode));

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

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

private CssDeclarationNode buildOverflowDeclaration(SourceCodeLocation location) {
    CssPropertyNode propertyNode = new CssPropertyNode("overflow", location);
    CssValueNode valueNode = new CssLiteralNode("hidden", location);

    CssPropertyValueNode propertyValueNode = new CssPropertyValueNode(ImmutableList.of(valueNode));

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

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

private CssDeclarationNode buildWidthDeclaration(String imageResource, SourceCodeLocation location) {
    CssPropertyNode propertyNode = new CssPropertyNode("width", location);
    CssValueNode valueNode = new CssDotPathNode(resourceThisPrefix, imageResource + ".getWidth", null, "px",
            location);/*from  ww w  .  jav a  2  s  . co m*/
    CssPropertyValueNode propertyValueNode = new CssPropertyValueNode(ImmutableList.of(valueNode));

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