Event handling across different presenters

32 views
Skip to first unread message

Ben

unread,
Aug 26, 2014, 9:54:44 AM8/26/14
to gwt-pl...@googlegroups.com
Hello all,

I've got a question about event handling:

I have an application with several presenters. Two of them interfer via the eventbus, let's call them presenter A and B.

In presenter A I call "addRegisteredHandler(AEvent.getType(), this)" in "onBind()".
In presenter B I call "fireEvent(new AEvent());"

This works like a charm if both presenters are already loaded.
BUT if I am located on presenter B and press "F5" the event can get fired, but presenter A is not registered to it, because it has not been created, yet.

How do I resolve this problem?

Regards
Ben


Christian Goudreau

unread,
Aug 26, 2014, 10:42:13 AM8/26/14
to gwt-pl...@googlegroups.com
You can use @ProxyEvent for those case. That happen because Presenter are lazily instantiated to allow code splitting.

I realize that this is not well documented, but there's a old article talking about it:


--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Christian Goudreau | CEO - Président
M: 1.877.635.1585 | S: christian.goudreau

Ben

unread,
Aug 27, 2014, 7:20:41 AM8/27/14
to gwt-pl...@googlegroups.com
It works, thank you very much!

I have a related question:
Is it possible for presenter B to determine if presenter A has already been instantiated?

Regards
Ben

Christian Goudreau

unread,
Aug 27, 2014, 8:20:51 AM8/27/14
to gwt-pl...@googlegroups.com

Not really, most of the lifecycle is managed by gin.

Ben

unread,
Aug 27, 2014, 8:24:54 AM8/27/14
to gwt-pl...@googlegroups.com
What a pity.
Thank you anyways!
Reply all
Reply to author
Forward
0 new messages