Update Parameters in NameTokens does not trigger onReveal

21 views
Skip to first unread message

dominic jansen

unread,
May 11, 2015, 5:29:41 AM5/11/15
to gwt-pl...@googlegroups.com

Hello there,

I'm using GWTP quite extensive since a few years and stumbled upon an issue with path parameters  in place tokens.

Let's say I have a place with this token annotation:

@NameToken({"/item/edit/{id}"

I reveal this place with the placemanager, and everything works fine. 
Now I stay on this place and want to reveal the same place again, but with an different id.
The prepareFromRequest is called and when i log out the id (log.info(request.getParameter("id", null));) i see the new id. Still everything fine. But now the onReveal method is not triggered.

Why? 

It works for queryparams (/item/edit?id=4324) but thats not what i need.
Any ideas what i missed?
As a workaround i can trigger the onReveal manual everytime the id is changed but the place is still the same, but for me this looks only like a workaround and not the solution....

Thanks in advance,
dom

Richard Wallis

unread,
May 11, 2015, 5:33:05 AM5/11/15
to gwt-pl...@googlegroups.com
If a presenter is visible it won't fire onReveal, because it's already revealed.  Can you not put your logic in prepareFromPlaceRequest()?

--
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.

Richard Wallis

unread,
May 11, 2015, 5:34:59 AM5/11/15
to gwt-pl...@googlegroups.com
You might also want to try onReset() I think it might fire in your situation.

dominic jansen

unread,
May 11, 2015, 5:48:44 AM5/11/15
to gwt-pl...@googlegroups.com
Yeah, thats what i missed... 
Thank you!

The onReset is triggered quite often, so it is not suitable to put my code there. 
To put it in the prepareFromPlaceRequest is okay :)

Just for clarification - why does it work when the id is a query parameter? Like "/item/edit?id=4324"?
When i create a new PlaceRequest with the same name token but a different id, the presenter is revealed even he is visible.



Richard Wallis

unread,
May 11, 2015, 5:51:34 AM5/11/15
to gwt-pl...@googlegroups.com
It shouldn't work with query params either.  Is the process you're using to reveal the queryParams place exactly the same as the other?

dominic jansen

unread,
May 11, 2015, 5:59:49 AM5/11/15
to gwt-pl...@googlegroups.com
Yip, it is exactly the same...

Creating a placeRequest with the PlaceRequest.Builder, adding the nameToken and the param via the ".with" method and revealing with the place manager.

The only difference is that at the one time the name token looks like this:
- "/item/edit/{id}" which results in "/item/edit/43242"
And the other time it looks like:
"/item/edit" which results in "/item/edit?id=43242"

dominic jansen

unread,
May 11, 2015, 7:41:47 AM5/11/15
to gwt-pl...@googlegroups.com
Okay, updating the gwtp to the latest release and removing all stuff that overrides gwtp classes, fixed the "feature".
Now it is not possible to reveal a visible presenter twice, neither with queryparams nor with routeparams.

Thanks for your support, Richard :)
Reply all
Reply to author
Forward
0 new messages