- edt {} - makes a synchronous call inside the EDT.
- doLater {} - makes an asynchronous call inside the EDT.
- doOutside {} - executes code outside the EDT.
This class provides the same behavior as the previous threading facilities but with the added advantage that it is toolkit aware, meaning it will use the proper threading facilities as required by the running toolkit. These are the main methods you will find on this class
- execSync {} - makes a synchronous call inside the UI thread.
- execAsync {} - makes an asynchronous call inside the UI thread.
- execOutside {} - executes code outside the UI thread.
- isUIThread() - queries if the current thread is the UI thread.
- execFuture {} - schedules the code on an ExecutorService and returns a Future.
Calling these methods from another class requires you to access the singleton instance of the UIThreadhelper, in other words you need to write something like
UIThreadHelper.instance.execSync { /* your code */ }
In the upcoming 0.3.2 release you'll be able to call these methods inside the life cycle scripts using the shorthand notation, no need to use UIThreadHelper.instance as a prefix. It is still undecided if a functional equivalent to SwingWorker will be added to the threading options or not, at the moment the only abstraction around that class is SwingXBuilder's withWorker() node.
You will find more information about threading in Griffon by browsing the Griffon Guide.
Keep on Groovying!