Why make the Root a inner class? I think it should be either a static nested class or a top-level class.
Also, you can remove a lot of your boilerplate and ugly news there using GIN and binding asEagerSingleton. In this way you could bind: - Root - PlaceController - ActivityMapper - MyActivityManager: Inherit ActivityManager with a @Inject constructor receiving ActivityMapper, EventBus and Root. Then call setDisplay(root) - AppPlaceHistoryMapper - MyPlaceHistoryHandler Inherit PlaceHistoryHandler with a @Inject constructor receiving all you need, then call regiser(...) handleCurrentHistory in your constructor. Also, instead of Root extending LayoutPanel, you can have it simply implement AcceptsOneWidget, then in setWidget you call directly RootLayoutMapnel.get().add(...) Cheers, Philippe On Nov 16, 1:57 am, Baloe <[email protected]> wrote: > Hi all, > > We are using MVP as much as possible, but it has been a pain so far, > not a lot of documentation. There is one thing that we really couldn't > get right. Please see how much boilerplate blabla this application > needs, and see how ugly the class at the end is. We don't want the > class near the end. And if someone has a tip how to clean up this > code, please! Thanks a lot! > > Baloe > > public class OurApp implements EntryPoint { > > @Override > public void onModuleLoad() { > > AppGinjector injector = GWT.create(AppGinjector.class); > Root app = new Root(); > > EventBus eventBus = injector.getEventBus(); > PlaceController placeController = > injector.getPlaceController(); > ActivityMapper activityMapper = injector.getActivityMapper(); > > ActivityManager activityManager = new > ActivityManager(activityMapper, eventBus); > activityManager.setDisplay(app); > > AppPlaceHistoryMapper historyMapper = > GWT.create(AppPlaceHistoryMapper.class); > PlaceHistoryHandler historyHandler = new > PlaceHistoryHandler(historyMapper); > historyHandler.register(placeController, eventBus, > ((AppPlaceController) placeController).getDefault()); > > historyHandler.handleCurrentHistory(); > RootLayoutPanel.get().add(app); > > Resources.Instance.css().ensureInjected(); > } > > private class Root extends LayoutPanel implements AcceptsOneWidget { > @Override > public void setWidget(IsWidget w) { > if (w == null) { > clear(); > } else { > add(w); > } > } > > } > > > > > > > > } -- 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.
