Clientbundle mearges all images into one and displays the mearged image

37 views
Skip to first unread message

Deepak Singh

unread,
Dec 20, 2011, 1:44:59 PM12/20/11
to google-we...@googlegroups.com
Hi,

GWT 2.4

I have a client bundle and generates images and background images as follows,

Document.get().getElementById("hbhtopbar2").getStyle().
setBackgroundImage("url("+HomePageClientBundle.INSTANCE.topbar2().getSafeUri().asString()+")");


Image hbtopbar3 = Image.wrap(Document.get().getElementById("hbtopbar3"));
hbtopbar3.setUrl(HomePageClientBundle.INSTANCE.topbar3().getSafeUri().asString());


But the problem is, clientbundle combines all clientbundle imgae into a single image and that combined image is displayed in place of all single images.

Can someone pls let me know the solution.

Thanks
Deepak Singh

Patrick Tucker

unread,
Dec 20, 2011, 1:49:00 PM12/20/11
to Google Web Toolkit
Take a look at image sprites.

On Dec 20, 1:44 pm, Deepak Singh <deepaksingh...@gmail.com> wrote:
> Hi,
>
> GWT 2.4
>
> I have a client bundle and generates images and background images as
> follows,
>
> Document.get().getElementById("hbhtopbar2").getStyle().

> setBackgroundImage("url("+HomePageClientBundle.INSTANCE.topbar2().getSafeUr­i().asString()+")");


>
> Image hbtopbar3 = Image.wrap(Document.get().getElementById("hbtopbar3"));

> hbtopbar3.setUrl(HomePageClientBundle.INSTANCE.topbar3().getSafeUri().asStr­ing());

Thomas Broyer

unread,
Dec 20, 2011, 5:09:25 PM12/20/11
to google-we...@googlegroups.com
Use @sprite in a CssRessource so it sets the appropriate background position. If you have an Image widget, pass the ImageRessource to setRessource.
Reply all
Reply to author
Forward
0 new messages