accessing the PlaceHistoryMapper in Activities classes

56 views
Skip to first unread message

Lars

unread,
Aug 8, 2011, 1:28:15 PM8/8/11
to google-we...@googlegroups.com
In the "How to Navigate" section of the the standard MVP example: http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html#How_to_navigate

An alternative to using the PlaceController.goTo() method to navigate, it is suggested to use a Hyperlink and settings its HistoryToken by calling the PlaceHistoryMapper's getToken() method.  Now, in the example the PlaceHistoryMapper is not available to each "Activity" class since its not registered in the clientFactory class and is in no way accessible outside EntryPoint's onModuleLoad method.

So, whats the best way to proceed?
1. register the AppPlaceHistoryMapper in the clientFactory and then add a getPlaceHistoryMapper method to the clientFactory?
2. do AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class); in any activity i want to call the PlaceHistoryMapper's getToken method?
3. make the PlaceHistoryMapper some kinda globally accessible static object?

Am I missing an obvious solution here???

Thanks in advance,
Lars

objectuser

unread,
Aug 8, 2011, 3:55:29 PM8/8/11
to google-we...@googlegroups.com
I don't use a client factory myself, but I would think #1 would be by far the most preferable.  I use GIN and inject it into my views for just that purpose.

Lars

unread,
Aug 8, 2011, 6:34:46 PM8/8/11
to google-we...@googlegroups.com
Thanks for sharing your opinion, I was thinking i would do #1 if i wasn't missing some blatantly obvious solution.

I'll have to add looking into GIN to the long list if things I'd like to do.... <sigh>
Reply all
Reply to author
Forward
0 new messages