Class ImageSpriteCreator

java.lang.Object
com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
com.google.gwt.resources.gss.ImageSpriteCreator
All Implemented Interfaces:
com.google.gwt.thirdparty.common.css.compiler.ast.AtRuleHandler, com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass, com.google.gwt.thirdparty.common.css.compiler.ast.CssTreeVisitor

public class ImageSpriteCreator extends com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor implements com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass
Visitor that detects sprite definitions and replace them by several css rules in order to create the corresponding sprited image.

This visitor will replace the following gss: .foo { padding: 5px; gwt-sprite: imageResource; width: 150px; } to the corresponding gss: .foo { padding: 5px; /* @alternate */ width: eval("imageResource.getWidth", "px"); /* @alternate */ height: eval("imageResource.getHeight", "px"); /* @alternate */ overflow: hidden; /* @alternate */ background: resourceUrl("imageResource") eval("imageResource.getLeft", "px") eval("imageResource.getTop", "px") no-repeat; width: 150px; }

This visitor will also check the presence of the ImageResource.ImageOptions annotation on the image resource in order to support correctly horizontal or vertical repetition.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static interface 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ImageSpriteCreator(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, ResourceContext context, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager)
     
    ImageSpriteCreator(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, ResourceContext context, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager, ImageSpriteCreator.MethodByPathHelper methodByPathHelper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    enterDeclaration(com.google.gwt.thirdparty.common.css.compiler.ast.CssDeclarationNode declaration)
     
    void
     

    Methods inherited from class com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor

    enterArgumentNode, enterAttributeSelector, enterBlock, enterClassSelector, enterCombinator, enterComponent, enterCompositeValueNode, enterCompositeValueNodeOperator, enterConditionalBlock, enterConditionalRule, enterDeclarationBlock, enterDefinition, enterFontFace, enterForLoop, enterFunctionNode, enterIdSelector, enterImportBlock, enterImportRule, enterKey, enterKeyBlock, enterKeyframeRuleset, enterKeyframesRule, enterMediaRule, enterMediaTypeListDelimiter, enterMixin, enterMixinDefinition, enterPageRule, enterPageSelector, enterPropertyValue, enterProvideNode, enterPseudoClass, enterPseudoElement, enterRequireNode, enterRuleset, enterSelector, enterSelectorBlock, enterTree, enterUnknownAtRule, enterValueNode, leaveArgumentNode, leaveAttributeSelector, leaveBlock, leaveClassSelector, leaveCombinator, leaveComponent, leaveCompositeValueNode, leaveCompositeValueNodeOperator, leaveConditionalBlock, leaveConditionalRule, leaveDeclaration, leaveDeclarationBlock, leaveDefinition, leaveFontFace, leaveForLoop, leaveFunctionNode, leaveIdSelector, leaveImportBlock, leaveImportRule, leaveKey, leaveKeyBlock, leaveKeyframeRuleset, leaveKeyframesRule, leaveMediaRule, leaveMediaTypeListDelimiter, leaveMixin, leaveMixinDefinition, leavePageRule, leavePageSelector, leavePropertyValue, leaveProvideNode, leavePseudoClass, leavePseudoElement, leaveRequireNode, leaveRuleset, leaveSelector, leaveSelectorBlock, leaveTree, leaveUnknownAtRule, leaveValueNode, visit

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ImageSpriteCreator

      public ImageSpriteCreator(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, ResourceContext context, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager)
    • ImageSpriteCreator

      ImageSpriteCreator(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, ResourceContext context, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager, ImageSpriteCreator.MethodByPathHelper methodByPathHelper)
  • Method Details

    • enterDeclaration

      public boolean enterDeclaration(com.google.gwt.thirdparty.common.css.compiler.ast.CssDeclarationNode declaration)
      Specified by:
      enterDeclaration in interface com.google.gwt.thirdparty.common.css.compiler.ast.CssTreeVisitor
      Overrides:
      enterDeclaration in class com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
    • runPass

      public void runPass()
      Specified by:
      runPass in interface com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass