/** * 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()); }