I was trying to use a tiled image in an image resource, and i was refering to the GWT tutorial for it…
one section says you need to use sprites:
http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#ImageResource
repeatStyle is an enumerated value
that is used in combination with
the@sprite directive to indicate that
the image is intended to be tiled
so, now i need to add a sprite directive .. Where ?
researching about sprites, i came here:
http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#Image_Sprites
The example dictates the creation of two files :
- MyCssResource
- MyResources
where would I write this :
@sprite .mySpriteClass {gwt-image:
“imageAccessor”; other: property;}
?
some more quotes for reference:
@sprite is sensitive to the FooBundle
in which the CSSResource is declared;
a sibling ImageResource method named
in the @sprite declaration will be
used to compose the background sprite.
From what you’ve written I’m going to presume that MyResources is an interface that extends ClientBundle and MyCssResources is an interface that extends CssResource:
So now there are two ways to use the ImageResource obtained from MyResources. The first is to attach it to a CSS rule using the @sprite directive. myCss.css:
Then, anything with the myBackground class will have myImage as its background. So, using UiBinder, for example:
One can also instantiate Image objects directly using the defined ImageResource. UiBinder:
Without UiBinder: