History.newItem() vs. PlaceManager.revealPlace()

49 views
Skip to first unread message

peter...@freshcode.biz

unread,
Sep 17, 2015, 11:44:59 PM9/17/15
to GWTP
Hi,

I've been using GWTP for years but have only just learned something that seems pretty fundamental.  Can I get someone to confirm this is correct please?....

Basically, I need to know when a user navigates to a new place so I tapped into the History change events:
  History.addValueChangeHandler(new ValueChangeHandler<String>() {...

Previously I used to use PlaceManager.revealPlace() to do all my navigation but this does not fire the History change event.
More recently, I've discovered History.newItem() which fires the event and performs the navigation (just like an 'href' in an anchor).

So, is History.newItem() more appropriate to use than PlaceManager.revealPlace()?

FYI, RootPresenter.java (lines 48 & 58) in my learning project illustrates the differences.  The navigation menu needs to be explicitly hidden whenever the user navigates (for screen width <768px).

Thanks in advance,
Pete

Christian Goudreau

unread,
Sep 18, 2015, 7:00:41 AM9/18/15
to gwt-pl...@googlegroups.com
What version are you using of GWTP? revealPlace in newer versions can be used with a boolean to trigger the ChangeEvent or not.

Also you should be able listen to NavigationEvent to capture when a user navigates to a new place.


Cheers,



Christian Goudreau | CEO - PDG

--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

peter...@freshcode.biz

unread,
Oct 13, 2015, 2:55:38 AM10/13/15
to GWTP
Thank you Christian.  I'll change over to NavigationEvent listening.

Pete
Reply all
Reply to author
Forward
0 new messages