gwtandroid-activityhistorymvpgwt-history

GWT MVP Update the History-Token without changing the Activity


my problem is the following: I have a MVP GWT application with a table in which datasets are shown. There are several hundreds of datasets and so I decided to split the table in pages of 20 results each. I load each page from the server via a GWT-RPC Service who gets the pagenumber as an argument.

Now I want to do the following: I want to save the page of the table the user sees in the History-Token (so the token would be something like TablePlace:page=5), but I do not want to create a new activity because then the state of the other elements (for example there is a TreeView) the activity manages would be lost. In my case all the items of the TreeView become closed, which is not what I want.

If I don't fire new Places the user can't use the browser's back button to get back to the page he visited before.

Thanks for your help in advance.


Solution

  • You'd issue a normal PlaceController goTo to navigate to another place, but in your ActivityMapper, you'd return the exact same Activity instance as before. In that specific case, the ActivityManager doesn't stop/start the activity, but instead let it run it's own life (without even signaling the place has changed; if you want that, then have your ActivityMapper tell your Activity before returning it).

    You might also find the FilteredActivityMapper and CachingActivityMapper useful for returning the same activity for slightly different places, without placing the burden into your own mapper.