Question

I tried the example which is showing how to get data from history to re-generate UI; The thing I see mostly in all "history usage" examples are related to UI re-generation only so it is none-static way...

But what about "each UI state may have its unique url something like JSF does with flows"? For example I have app url like a

http://localhost:8080/myapp/MyApp.html

the app default UI contains main menu which is helping to navigate through my test catalog; I tried to make possible keep the UI dynamics in history by building url in this way

http://localhost:8080/myapp/MyApp.html#menu_testcategory_page1

but when I click internet browser "refresh" button the url keeps the same as http://localhost:8080/myapp/MyApp.html#menu_testcategory_page1 but the UI comes back to its default state :(

So my question is

is there an optimal way in pure gwt to stay in the same UI state even after browser's refresh button is clicked (I mean the unload/load window events occur)?

thanks

P.S. gwt 2.3

Was it helpful?

Solution

You should implement Activities and Places pattern: http://www.gwtproject.org/doc/latest/DevGuideMvpActivitiesAndPlaces.html

I am using it for 3 years, and it works very well.

Note, however, that when you reload a page, you lose all of your state, data, etc. If you need to preserve some of it, you can use a combination of a Place (#page1) and a token that tells the corresponding Activity the state of the View representing this Place, i.e. (#page1:item=5).

OTHER TIPS

You probably just forgot to call

History.fireCurrentHistoryState();

from your entry point.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top