Hi *,

I've just done some refactoring in my project and am now finding that my PlaceHistoryHandler is no longer able to trigger a default Place. I'm following the default procedure as described in the GWT online documentation as you can see in the source code at the end of the mail.

After some debugging, I have detected that the listeners for the PlaceController are not in place early enough. When doing any navigation activites in the menu later, everything works fine and the ActivityManager and PlaceHistoryHandler are both showing up in the listener queue.

The MVPManagement is activated in an event listener that is triggered after the app has retrieved the user profile after an RMI call.

Any help or advice is greatly appreciated :)

Ralf

-----------

package com.str84wd.nifty.client.mvp;

import com.google.gwt.activity.shared.ActivityManager;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.str84wd.nifty.client.ClientFactory;

public class MVPManager {

    private ActivityMapper activityMapper;
    private ActivityManager activityManager;
    private ClientFactory clientFactory;
    private AppPlaceHistoryMapper historyMapper;
    private PlaceHistoryHandler historyHandler;

    public MVPManager(ClientFactory pClientFactory) {
        super();
        clientFactory=pClientFactory;
    }

public void activateMvpManagement(AcceptsOneWidget pDisplayContainer, Place pDefaultPlace) {
        setupActivityManager(pDisplayContainer);
        startPlaceHistoryManagement(pDefaultPlace);
    }

    private void setupActivityManager(AcceptsOneWidget pDisplayContainer) {

        System.out.println("MVP Setup - initializing ActivityManager");
// Start ActivityManager for the main widget with our ActivityMapper
        activityMapper = new AppActivityMapper(clientFactory);
        EventBus eventBus = clientFactory.getEventBus();
        activityManager = new ActivityManager(activityMapper, eventBus);
        activityManager.setDisplay(pDisplayContainer);
    }

    private void startPlaceHistoryManagement(Place pDefaultPlace) {

System.out.println("MVP Setup - set place history management with default place " + pDefaultPlace);
        // Start PlaceHistoryHandler with our PlaceHistoryMapper
        historyMapper= GWT.create(AppPlaceHistoryMapper.class);
        historyHandler = new PlaceHistoryHandler(historyMapper);
historyHandler.register(clientFactory.getPlaceController(), clientFactory.getEventBus(), pDefaultPlace);
        historyHandler.handleCurrentHistory();
    }

}

--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to