0

I use MVP pattern for GWT application. I have a filter view and search results view. If the search criteria is modified, search results are getting updated.

But, the selected criteria lost when I refresh the browser. So I want to retain the search criteria and tried using CachingActivityMapper in my onModuleLoad()

 CachingActivityMapper cached = new CachingActivityMapper(new AppActivityMapper(clientFactory));
 FilteredActivityMapper.Filter filter = new FilteredActivityMapper.Filter() {
      @Override
      public Place filter(Place place) {
        return place;
      }
    };

 final ActivityManager activityManager = new ActivityManager(activityMapper,
            eventBus);      
 activityManager.setDisplay(filterDisplayView);

But I dont see any difference.

Kindly tell what went wrong in my code.

Thanks.

Sree
  • 921
  • 2
  • 12
  • 31

2 Answers2

2

There's nothing in the docs for CachingActivityMapper to suggest that it is able to store anything between page reloads. It isn't your code that's wrong here but the assumption that a CachingActivityMapper is reload-resilient - it is not. Reloading the page means rebooting your app and loosing all its runtime state, including anything a CachingActivityMapper may have cached.

Boris Brudnoy
  • 2,405
  • 18
  • 28
  • So, is there a way to add my filters into the URL? So that I can get the runtime filters when the page is refreshed – Sree Jan 07 '13 at 21:40
0

Look into this for implementing Local Storage. This could solve your problem.

BST
  • 531
  • 5
  • 18