Thanks Chris and sorry I am replying to this post very late. The problem is I don't see how do I use it for background images.
I want to be able to display a background icon inside a DateBox (i.e. calendar.gif) and as far as I understand I have to define the style .datebox using the @sprite. The way you have described it above how would you set the Image to appear as a the background of a DateBox ? thanks Shahid On Feb 12, 8:21 pm, Chris Ramsdale <cramsd...@google.com> wrote: > Why not reference your styles from a CssResource that itself is wrapped in a > ClientBundle? Something like: > > *Resources.java* > public interface Resources extends ClientBundle { > public static final Resources INSTANCE = GWT.create(Resources.class); > > @Source("UiStyles.css") > public MyUiStyles uiStylesCss(); > > @Source("calendar.png") > public ImageResource calendar(); > > } > > *MyUiStyles.java* > * > public interface ImagesDialogCss extends CssResource { > public String datebox();} > > * > * > * > *MyDialog.ui.xml* > <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' > xmlns:g='urn:import:com.google.gwt.user.client.ui'> > > <ui:with field='resources' type='com.google.gwt.sample.client.Resources'/> > > <g:VerticalPanel> > <g:Image addStyleNames='{resources.uiStylesCss.datebox}' > ui:field='someFieldId' /> > </g:VerticalPanel> > </ui:UiBinder> > > I might be overlooking some details, but you should be able to use the above > to share your UiStyles.css w/o having to declare an associated <ui:image> > element all over the place. > > -- Chris > > On Fri, Feb 12, 2010 at 3:59 AM, shahid <shahidza...@gmail.com> wrote: > > I started using the UiBinder for various forms in my application. I > > have created a UiStyles.css (with a CssResource interface called Css) > > under the main client package and would like to use that in all > > packages across the application. The problem is I am using a sprite in > > the stylesheet for a background image as: > > > @sprite .datebox { gwt-image:"calendar"; width : 150px !important; > > height : 24px !important; padding : 2px; background-position : right > > center !important; } > > > and I refer to the stylesheet in the ui.xml as: > > > <ui:style src='../UiStyles.css' /> > > > and for the sprite I have the following line in the ui.xml : > > > <ui:image field="calendar" src='../StaticResources/images/ > > calendar.png' /> > > > Now I thought I should only need this in the ui.xml file that is using > > the .datebox style. But I see that if I refer to the UiStyles.css in > > any ui.xml (even if it does use the above sprite), it requires the > > <ui:image field="calendar" src='../StaticResources/images/ > > calendar.png' /> > > > otherwise it fails to compile > > > [ERROR] Unable to find ImageResource method calendar in ... > > packagename .... > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Web Toolkit" group. > > To post to this group, send email to google-web-tool...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.