Package com.antonytrupe.client

Source Code of com.antonytrupe.client.Index

package com.antonytrupe.client;

import com.antonytrupe.client.mvp.AppActivityMapper;
import com.antonytrupe.client.mvp.AppPlaceHistoryMapper;
import com.antonytrupe.client.place.DisplayPlace;
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.place.shared.Place;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.web.bindery.event.shared.EventBus;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Index implements EntryPoint {
  public static final String ANTONY_TRUPE = " - Antony Trupe";
  private Place defaultPlace = new DisplayPlace("home");
  private SimplePanel appWidget = new SimplePanel();

  /**
   * This is the entry point method.
   */
  @Override
  public void onModuleLoad() {
    // Create ClientFactory using deferred binding so we can replace with
    // different impls in gwt.xml
    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    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(this.appWidget);

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

    RootPanel.get().add(this.appWidget);

    // Goes to place represented on URL or default place
    historyHandler.handleCurrentHistory();
  }
}
TOP

Related Classes of com.antonytrupe.client.Index

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.