Hello
I'm trying to clear selection on a list that has selectionChangeHandler
attached to it. This fires a new event that triggers the handler again. I'd
like to ignore the event that has been triggered as result of me clearing
the selection.
The problem is that there seems to be stuff happening asynchronously.
new SelectionChangeEvent.Handler()
{
boolean muted = false;
@SuppressWarnings("unchecked")
@Override
public void onSelectionChange(SelectionChangeEvent event)
{
if(muted)
return;
NoSelectionModel<User> selectionModel = (NoSelectionModel<User>)
event.getSource();
User user = selectionModel.getLastSelectedObject();
// ...
muted = true;
// I'd expect the following line to launch onSelectionChange again, with
muted=true
selectionModel.setSelected(user, false);
// instead following one gets evaluated
muted = false;
// and the handler gets triggered after that, obviously with muted=false
again :(
}
}
I could check whether the user is null and return out of the handler but I
don't like that kind of workaround because null selection != invalid
selection; and (more importantly) this ?async? evaluation does not seem
right...
What am I missing please?
J. Záruba
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.