October 29, 2012

GWT CssResource not working...


I recently was trying to use a CssResource and I couldn't figure out why it wasn't working. It was inserting the class attribute into the Element but it wasn't actually adding the CSS file into the document.  I finally noticed that there is an method called ensureInjected() on the generate CssResource and that seemed to fix my problem. My assumption is that somewhere in GWT when it loads the ClientBundle its calling this method somewhere but in my case the class that was calling it was just a regular class and not some sort of widget. Anyway, call ensureInjected() and it should fix your problem.




No comments: