The Google/GWT example of creating an ImageResource is understood:
interface MyResources extends ClientBundle {
@Source("image.png")
ImageResource image();
@Source("my.css");
CssResource css();
}
@sprite .myImage {
gwt-image: 'image';
}
I understand how to use ImageResources and apply style names, however...
In my application, I have multiple themes that are applied to various widgets using CSS and deferred binding. So I have defined a CSS rule ('background') that I would like to use the .myImage class, but it does not do anything:
background {
background-attachment: fixed;
background-image: .myImage; //?? This is the question!
background-size: contain
}
What is the syntax for using the .myImage class within the 'background' CSS property? It seems I should be able to specify the .myImage class as the argument for background-image.
Edit: Did some more research and found the correct syntax to do this using a DataResource.
MyClientBundle extends ClientBundle {
//Background Image
@Source("resources/background.png")
DataResource backgroundImage();
}
(mypanel.css)
@url background backgroundImage;
.myPanel {
border-radius: 0px;
background-color:#ffffff;
opacity:0.6;
background-image: background;
}