gwt navigation with 3rd party app in iframe

71 views
Skip to first unread message

Lance Frohman

unread,
Aug 8, 2013, 3:07:59 PM8/8/13
to google-we...@googlegroups.com
I have a GWT application with navigation designed using the samples (Place,Activity,EventBus ...)
There is a navigation bar, and a Panel where the actual navigation takes place. In some
cases, the panel is filled with a third party app using a com.google.gwt.user.client.ui.Frame
iframe. The user can navigate in side the 3rd party app, and my app captures this and processes
it with the GWT navigation. The problem is that when the user is on page1 with param1 and they
go to page2 with param2, I create Token "page2:param2" and do a PlaceController.goTo(place).
But this causes the same page to get reloaded, it "blinks". Is it possible to simulate the goTo(place)
by changing the URL to the new token and adding it into the PlaceHistory?

thanks

Jens

unread,
Aug 8, 2013, 4:05:12 PM8/8/13
to google-we...@googlegroups.com
You need to cache the activity that displays the 3rd party app so it does not get recreated in your ActivityMapper each time you navigate inside the 3rd party app. So your URLs should look like

/#ThirdPartyAppPlace:app=page1
/#ThirdPartyAppPlace:app=page2&param=x
/#ThirdPartyAppPlace:app=page3

and for each URL the same activity instance should be returned. You could either code this caching into your AppActivityMapper directly or use GWT's CachingActivityMapper together with GWT's FilteredActivityMapper to keep your AppActivityMapper clean. If you choose to use GWT's ActivityMappers you must implement hashcode/equals for your place because CachingActivityMapper uses currentPlace.equals(newPlace) to determine if the cached activity can be returned.

At the end you will have something like new FilteredActivityMapper(filter, new CachingActivityMapper(new AppActivityMapper()); where "filter" transforms all your ThirdPartyAppPlaces to an empty ThirdPartyAppPlace so that CachingActivityMapper always sees equal places. Whenever the CachingActivityMapper sees different places, it will ask your AppActivityMapper for the new activity.

-- J.

Lance Frohman

unread,
Aug 9, 2013, 12:16:13 PM8/9/13
to google-we...@googlegroups.com
Thank you.

Lance Frohman

unread,
Aug 12, 2013, 12:50:57 PM8/12/13
to google-we...@googlegroups.com
I got the pages to not blink, but the back button does not work correctly, you need to click it three times
to get to the page it should go to. It was doing this before I made your fix.
thanks


--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/6U5rhALEomE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jens

unread,
Aug 12, 2013, 1:07:42 PM8/12/13
to google-we...@googlegroups.com

I got the pages to not blink, but the back button does not work correctly, you need to click it three times
to get to the page it should go to. It was doing this before I made your fix.

Well thats expected as you update the URL whenever a navigation inside the 3rd party app occurs. I thought this behavior is the one you already had but with blinking going on.

-- J.
Reply all
Reply to author
Forward
0 new messages