quarks
quarks

Reputation: 35276

Troubles with CSS defined in CssResource

I am having some problem displaying the CSS using UiBinder and CssResource:

public interface Resources extends ClientBundle {

    @NotStrict
    @Source("style.css")
    Style style();

    @Source("logo.png")
    ImageResource logo();
}

public interface Style extends CssResource {
    @ClassName("orange")
    public String orange();
}

If I apply the CSS like this with UiBinder:

styleName="{res.style.orange}" 

It doen't work, although the CSS ".orange" rule here is fully tested to be rendered properly.

I have defined the resouce in the UiBinder like this:

<ui:with field='res' type='com.mygwtapp.client.Resources'/>

And if I place this for example:

<g:Image resource='{res.logo}'/>

It works, the logo image is displayed but the CSS won't work. Is there any other procedure or method that I have missed that is causing the CSS not to be rendered?

Upvotes: 0

Views: 132

Answers (1)

Thomas Broyer
Thomas Broyer

Reputation: 64541

You have to call ensureInjected() on your CssResources.

UiBinder does it automatically for a ui:style, but not for CssResources you provide via an ui:with.

Upvotes: 1

Related Questions