-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I used Event queue to communicate between View Models as I cannot use GlobalCommand that would trigger multiple instances of one of my ViewModel.
I'm using a different event queue for each of my instance and it works fine. In the Init, I lookup that event queue and also subscribe to a new SerializableEventListener<event>.
@Init(superclass = true)
public void init() {
eq = EventQueues.lookup(tabEventQueue);
eq.subscribe(new SerializableEventListener<Event>() {
private static final long serialVersionUID = 1L;
@Override
public void onEvent(final Event pEvent) throws Exception {
if (pEvent.getName().equals(MY_EVENT_NAME)) {
// Do something
}
}
});
}
However when the use navigate in my application, he ll rego through init if he leave the page and comes back. Thus I end up subscribing multiple time to the event.
How can I avoid that multiple register?
Asked: 2015-07-20 16:40:38 +0800
Seen: 16 times
Last updated: Jul 21 '15