Thanks for the tips!! I'll look into the EagerSingleton. However, regarding the class Root: I don't really want to change it, I want to remove it completely. It's not necessary for anything at all, it's just because we need to start the code. This program goes to our default Place (see getDefaultPlace() call in the code) , the class Root is 100% unncessary fill-in code, and extremely ugly as well. How can I get rid of it?
Thanks!, Baloe On 16 nov, 20:18, PhilBeaudoin <philippe.beaud...@gmail.com> wrote: > 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 <nielsba...@gmail.com> 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 google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.