Style matching in onModuleLoad vs. on visualization loaded

19 views
Skip to first unread message

Patrick Logan

unread,
Apr 16, 2012, 12:14:00 PM4/16/12
to google-we...@googlegroups.com
I have a question about how and when styles are applied. This is in combination with the GWT API for the Google visualization toolkit. (Although this example does nothing more than load the toolkit.)

The styles I have defined directly in my uibinder file work when the view is created directly in onModuleLoad, e.g. the following displays as expected...

public void onModuleLoad() {
Runnable onLoadCallback = new Runnable() {
public void run() {
Window.alert("Hey, loaded!");
}
};
RootPanel root = RootPanel.get();
SearchView view = new SearchView();
root.add(view);
VisualizationUtils.loadVisualizationApi(onLoadCallback, Table.PACKAGE);
}

However, if I move the lines "RootPanel root = ... ; root.add(view);" into the callback, the elements and text appear, but the styles have not been applied as expected.

Is there a section in the documentation for either GWT or the visualization toolkit that might explain why this is the case?

Thanks
-Patrick

Joseph Lust

unread,
Apr 20, 2012, 5:50:03 PM4/20/12
to google-we...@googlegroups.com
Have you made sure that you called 
yourCssResource.ensureInjected()

in the constructor of your object? If not, your CSS properties will not be loaded into the DOM and applied. Perhaps you're losing this in you callback.


Sincerely,
Joseph
Reply all
Reply to author
Forward
0 new messages