1

I'm incorporating a GWT application in my website and I need to execute some functions after the application has finished loading.

I've read this question but calling some javascript function from GWT is not what I want. I would like to be able, from the page, to detect that the loading is finished.

Is there a way to fire an event from GWT that I could listen to from jquery ?

Ideally without the need to create a jQuery custom event inside GWT.

Community
  • 1
  • 1
Loïc Février
  • 7,540
  • 8
  • 39
  • 51

1 Answers1

1

You could probably just use this

NativeEvent event = Document.get().createChangeEvent(); DomEvent.fireNativeEvent(event, this);

To fire a custom event (after populating it) and having it event propagate to some jQuery handler. It seems like an awful amount of overhead to bundle in jQuery when using the build in stuff from GWT would most likely suffice (i.e. onLoad();)

Additionally, you might look into GWTQuery.

Lam Chau
  • 842
  • 5
  • 14
  • The thing is that I need to combine some elements (external script for code highlighting) with some GWT component (custom javascript interpreter for C codes) and the code highlighting needs to be done before the GWT component is launch. But I don't want the GWT part to have to launch the highlighting part itself. I have a race condition between GWT' `onLoad` et jQuery `$(document).ready`. – Loïc Février Jun 07 '11 at 10:51
  • Have you tried wrapping the `onLoad()` with a `Scheduler.get().scheduleFinally(...)`? You could `setVisible(false)` the widget you're trying to load until the highlighting is done then `setVisible(true)` once it's completed. – Lam Chau Jun 08 '11 at 02:53