0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.