Open GoogleCodeExporter opened 9 years ago
I have a hard time understanding this issue? Can you point to code or a
discussion somewhere?
Original comment by philippe.beaudoin
on 26 Sep 2011 at 3:11
Indeed I wasn't very elaborate on it. HasXxx interfaces are characteristic
interfaces that indicate that the class implementing it has a certain
characteristic/property. Most of them have a getter and a setter to reflect
that characteristic/property. At the moment HasUiHandlers only has
setUiHandlers() method and doesn't have getUiHandlers().
It would really be beneficial to have a getter. We know that UiHandlers is not
initialized when constructor runs. It means that all incapsulated objects can't
be initialized with UiHandlers in constructor. If only HasUiHandlers had a
getter we could easily initialize those incapsulated objects with HasUiHandlers
instead of UiHandlers which is functionally almost the same. Pls see example
below.
I am not saying this can't be worked around. I am suggesting that it seems more
appropriate if HasUiHandlers was not just a write-only characteristic but a
read-write one. And it would be a simple change since all existing GWTP
implementations of HasUiHandlers already have a getter which can simply be made
public.
class MyScreenPanel expands ViewWithUiHandlers<MyScreenUiHandlers> {
private SubPanelA subPanelA;
private SubPanelB subPanelB;
public MyScreenPanel() {
...
subPanelA.setHasUiHandlers(this);
subPanelB.setHasUiHandlers(this);
...
}
}
class SubPanelA {
private HasUiHandlers hasUiHandlers;
public void setHasUiHandlers(HasUiHandlers hasUiHandlers) {
this.hasUiHandlers = hasUiHandlers;
}
public void onEvent(Event event) {
hasUiHandlers.getUiHandler().executeActionA(...);
hasUiHandlers.getUiHandler().executeActionB(...);
}
}
class SubPanelB {
private HasUiHandlers hasUiHandlers;
public void setHasUiHandlers(HasUiHandlers hasUiHandlers) {
this.hasUiHandlers = hasUiHandlers;
}
public void onEvent(Event event) {
hasUiHandlers.getUiHandler().executeActionA(...);
hasUiHandlers.getUiHandler().executeActionC(...);
}
}
Original comment by cheriomu...@gmail.com
on 28 Sep 2011 at 10:00
Original issue reported on code.google.com by
cheriomu...@gmail.com
on 23 Sep 2011 at 6:44