_css.tripPanelSummaryTrip()));
summaryPanel.add(new DivWidget("Travel time: about " + duration,
_css.tripPanelSummaryDuration()));
for (int i = 0; i < legs.size(); i++) {
LegBean leg = legs.get(i);
String mode = leg.getMode();
if( mode.equals("transit")) {
TransitLegBean transitLeg = leg.getTransitLeg();
TripBean tripBean = transitLeg.getTrip();
RouteBean routeBean = tripBean.getRoute();
DivPanel panel = new DivPanel();
panel.addStyleName(_css.tripPanelVehiclePanel());
DivPanel row1 = new DivPanel(_css.tripPanelVehiclePanelRow1());
panel.add(row1);
DataResource busIcon = resources.getBusTripTypeIcon();
Image image = new Image(busIcon.getUrl());
image.addStyleName(_css.tripPanelVehiclePanelModeImage());
row1.add(image);
int minutes = Math.round((leg.getEndTime() - leg.getStartTime())
/ (1000 * 60));
String routeShortName = getBestName(transitLeg.getRouteShortName(),tripBean.getRouteShortName(), routeBean.getShortName(),"");
String tripHeadsign = getBestName(transitLeg.getTripHeadsign(),tripBean.getTripHeadsign(),routeBean.getLongName(),"");
row1.add(new DivWidget("Bus - " + routeShortName + " - "
+ tripHeadsign, _css.tripPanelVehiclePanelTitle()));
String departureTime = _timeFormat.format(new Date(leg.getStartTime()));
String arrivalTime = _timeFormat.format(new Date(leg.getEndTime()));
DivPanel row2 = new DivPanel(_css.tripPanelVehiclePanelRow2());
panel.add(row2);
DivPanel row3 = new DivPanel(_css.tripPanelVehiclePanelRow3());
panel.add(row3);
DivPanel row4 = new DivPanel(_css.tripPanelVehiclePanelRow4());
panel.add(row4);
String fromStopName = "";
StopBean fromStop = transitLeg.getFromStop();
if( fromStop != null)
fromStopName = fromStop.getName();
String toStopName = "";
StopBean toStop = transitLeg.getToStop();
if( toStop != null)
toStopName = toStop.getName();
row2.add(new DivWidget(departureTime,
_css.tripPlanVehiclePanelDepartureTime(),
_css.tripPlanVehiclePanelA()));
row2.add(new DivWidget("Depart " + fromStopName,
_css.tripPlanVehiclePanelDepartureLabel(),
_css.tripPlanVehiclePanelB()));
row3.add(new DivWidget("...",
_css.tripPlanVehiclePanelInTransitLabel(),
_css.tripPlanVehiclePanelA()));
row3.add(new DivWidget(minutes + " mins",
_css.tripPlanVehiclePanelInTransitTime(),
_css.tripPlanVehiclePanelB()));
row4.add(new DivWidget(arrivalTime,
_css.tripPlanVehiclePanelArrivalLabel(),
_css.tripPlanVehiclePanelA()));
row4.add(new DivWidget("Arrive " + toStopName,
_css.tripPlanVehiclePanelArrivalTime(),
_css.tripPlanVehiclePanelB()));
_panel.add(panel);
} else if (mode.equals("walk")) {
DivPanel panel = new DivPanel();
panel.addStyleName(_css.tripPanelWalkPanel());
DivPanel row1 = new DivPanel(_css.tripPanelWalkPanelRow1());
panel.add(row1);
DataResource walkIcon = resources.getWalkTripTypeIcon();
Image image = new Image(walkIcon.getUrl());
image.addStyleName(_css.tripPanelWalkPanelModeImage());
row1.add(image);
String target = getWalkToTarget(legs, i, destination);
row1.add(new DivWidget("Walk to " + target,
_css.tripPanelWalkPanelTitle()));
DivPanel row2 = new DivPanel(_css.tripPanelWalkPanelRow2());
panel.add(row2);
long dur = leg.getEndTime() - leg.getStartTime();
row2.add(new DivWidget("About "
+ TripBeanSupport.getDurationLabel(dur)));
_panel.add(panel);
}