package br.com.cadeOOnibus.client;

import br.com.cadeOOnibus.client.places.BusLineRegisterPlace;
import br.com.cadeOOnibus.mvp.AppActivityMapper;
import br.com.cadeOOnibus.mvp.AppPlaceHistoryMapper;
import br.com.cadeOOnibus.mvp.ClientFactory;

import com.google.gwt.activity.shared.ActivityManager;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.core.client.EntryPoint;
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.PlaceController;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.user.client.ui.RootLayoutPanel;

public class CadeOOnibus implements EntryPoint {
 
 public static final Place defaultPlace = new BusLineRegisterPlace(null);
 public static final ClientFactory clientFactory = GWT.create(ClientFactory.class);

 @Override
 public void onModuleLoad() {
  EventBus eventBus = clientFactory.getEventBus();
  PlaceController placeController = clientFactory.getPlaceController();

  // Start ActivityManager for the main widget with our ActivityMapper
  ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
  ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
  activityManager.setDisplay(clientFactory.getMasterView().getContentPanel());

  // Start PlaceHistoryHandler with our PlaceHistoryMapper
  AppPlaceHistoryMapper historyMapper= GWT.create(AppPlaceHistoryMapper.class);
  PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
  historyHandler.register(placeController, eventBus, defaultPlace);

  RootLayoutPanel.get().add(clientFactory.getMasterView());
  // Goes to place represented on URL or default place
  historyHandler.handleCurrentHistory();
 }
}

Add a code snippet to your website: www.paste.org