itd: Michael Kaulig
unread,Dec 1, 2015, 9:03:11 AM12/1/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gwt-pl...@googlegroups.com
Hi,
I build some presenter widget, which has one slot for a navigation presenter widget. Since I have different widgets for navigation I have to use a general type for the generic parameter of the slot for the navigation widget.
Here is the problem:
Since IsSlot has the generic type <T extends PresenterWidget<?>> and PresenterWidget is a class not an interface I see two options:
1. Use a (abstract) super class Navigation for all the navigation presenters which extends PresenterWidget<NavigationView>. Now all my Views and Presenter Widgets need to Inherit from NavigationPresenter and NavigationView, which hinders reuse of these widgets in other contexts.
2. Let all Navigation Presenters implement some interface INavigationPresenter which specifies the methods supported by all navigation widgets. The problem here is that this interface needs to have some method PresenterWidget asPresenterWidget() to get the actual implementation and put it into the slot. Here I loose the type information, because I have to return PresenterWidget<?>, which seems to destroy the whole typed slots concept.
What is the best practice here? Is there a third solution to keep the class hierarchy clean and keep the type information of the slots?
Is there a reason why IsSlot does not have a generic type of something like <T extends IsPresenterWidget> where IsPresenterWidget would be some Interface implemented by PresenterWidget (like the GWT Widget which implements IsWidget)?
Kind regards,
Michael