/**
   * @param detailView
   * @param eventId
   */
  public RouteDetailsActivity(Place newPlace, ClientFactory cf) {
    super(cf.getRouteDetailsView(), "");
    clientFactory = cf;

    if (newPlace instanceof RouteDetailsPlace) {
      RouteDetailsPlace place = (RouteDetailsPlace) newPlace;
      view = clientFactory.getRouteDetailsView();
      bikeTrainRoute = place.getRoute();

      RouteContainerFactory.getRouteContainer().setDetailsActivity(this);

      addHandlerRegistration(view.getBackbutton().addTapHandler(new ReturnToEventTapHandler()));
      addHandlerRegistration(
          view.getHeaderTapHandlers().addClickHandler(new ReturnToEventClickHandler()));
    }
  }
  /** @param view */
  protected void setNavHandlers(RouteDetailsView view) {
    addHandlerRegistration(
        view.getHomeButton()
            .addTapHandler(
                new TapHandler() {

                  @Override
                  public void onTap(TapEvent event) {
                    clientFactory.getPlaceController().goTo(new HomePlace());
                  }
                }));
  }
  /**
   * Fills the form with details from the bikeTrainRoute.
   *
   * @param bikeTrainRoute
   */
  public void setViewDetails(BikeTrainRoute bikeTrainRoute) {
    this.bikeTrainRoute = bikeTrainRoute;
    if (bikeTrainRoute == null) {
      headerText = "Select a Route";
    } else {
      headerText = bikeTrainRoute.getDisplayName();
    }
    view.getHeader().setText(headerText);

    // Populate View with the BikeTrain
    BikeTrainDTO bikeTrain = bikeTrainRoute.getBikeTrain();
    view.setArrival(bikeTrain.getArrivalTime());
    view.setDeparture(bikeTrain.getDepartureTime());
    view.setLeaderName(bikeTrain.getLeaderName());
    RouteContainer rc = RouteContainerFactory.getRouteContainer();
    Date currentTime = new Date();
    Date yesterday = new Date(currentTime.getTime() - 86400000);
    DisplayGroupDTO currentDisplayGroup = rc.getCurrentDisplayGroup();

    // Based on date, decide whether to display contact info
    if (currentDisplayGroup == null
        || currentDisplayGroup.getEventDate() == null
        || currentDisplayGroup.getEventDate().after(yesterday)) {
      view.setLeaderEmail(bikeTrain.getLeaderEmail());
      view.setLeaderPhone(bikeTrain.getLeaderPhone());
    } else {
      view.setLeaderEmail("private");
      view.setLeaderPhone("private");
    }
    view.setNotes(bikeTrain.getNotes());
    view.setRouteName(bikeTrain.getRouteName());

    // Populate View with the BikeTrainRoute
    view.setDisplayName(bikeTrainRoute.getDisplayName());
  }