Thank you everyone for your insights.
upon further investigation, I have two more related questions,
regarding how to implement this Presenter to Presenter communication:
Question #1:
should Presenter to Presenter communication be through Composition
(Has-A) relationship, or eventBus
one Presenter inside another (Has-A), result in tight coupling
using eventBus, might make the application slow and chatty ?
Question#2:
is it a good idea for one Presenter to pass around Widgets to other
Presenter, so that other Presenter can add it to its view ?
Question #1 :
Possible Solution #1 We use one Presenter inside another ?
public FooPresenter {
private BarPresenter barPresenter;
public FooPresenter(BarPresenter bp) { // Constructor
this.barPresenter = bp
}
void fooMethod(){
barPresenter.someMethodCall();
}
}
or Possible Solution #2
FooPresenter {
void fooMethod() {
eventBus.fire(event) // fire event on the eventBus so that
BarPresenter which is listening , can act on it
}
However, in MVP documentation, i read that we should not use eventBus
for all events, because it slows down and become chatty.
does #2 fall into that category ?
Question#2:
is it a good idea for one Presenter to pass around Widgets to other
Presenter, so that other Presenter can add it to its view ?
public FooPresenter {
private BarPresenter barPresenter;
void fooMethod(){
barPresenter.addWidget( new Widget()); // FooPresenter, calls
BarPresenter, giving it a Widget, so can BarPresenter can add it to
its BarView
}
}
--
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.