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 <[email protected]> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.