Alex Rivera | Logout

When to use GWT ensureInjected()?

Asked 2010-03-09T04:32:46.980
17

I created a few styles into a CSSResource and it works well whether I use

GWT.<MyResources>create(MyResources.class).myStyles().ensureInjected();

or not.

Could anyone shed a light on this and explain when to use ensureInjected or not?

Thank you! Daniel

Edit
Report

1 Answer

6

The rule is easy: you have to call ensureInjected() explicitly, unless the CssResource is being generated from an <ui:style> in a UiBinder template (because most of the time you won't have a handle on the generated CssResource.
Specifically, <ui:with> provides no special treatment for CssResources.

Also, a few widgets take a specific ClientBundle as argument to a constructor (such as CellTable), they will then call ensureInjected() on the CssResource they use.

answered 2012-08-17T11:01:12.537

Your Answer