Similarly to synchronous calls, asynchronous calls inside the UIThread are made by invoking the execInsideUIAsync{}
method. This method is equivalent to calling doLater{}
in Swing.Example:class MyController {
def model def action1 = {
// will be invoked inside the UI Thread by default (pre 0.9.2)
def value = model.value
Thread.start {
// do some calculations
execInsideUIAsync {
// back inside the UI Thread
model.result = …
}
}
} def action2 = {
// will be invoked outside of the UI Thread by default (post 0.9.2)
def value = model.value
// do some calculations
execInsideUIAsync {
// back inside the UI Thread
model.result = …
}
}
}