List of usage examples for com.google.gwt.maps.client.services DirectionsRoute getWarnings
public final native JsArrayString getWarnings() ;
From source file:net.cbtltd.client.field.RouteField.java
public String getValue() { StringBuilder sb = new StringBuilder(); JsArray<DirectionsRoute> routes = result.getRoutes(); if (routes == null) { sb.append("No directions available"); } else {//from w w w. j a v a2 s . co m sb.append("Route\n"); for (int i = 0; i < routes.length(); i++) { DirectionsRoute route = routes.get(i); sb.append(route.getWarnings()); JsArray<DirectionsLeg> legs = route.getLegs(); for (int j = 0; j < routes.length(); j++) { DirectionsLeg leg = legs.get(j); sb.append(leg.getStart_Address()); sb.append(" to "); sb.append(leg.getEnd_Address()); sb.append(" "); sb.append(leg.getDistance().getText()); sb.append(" ("); sb.append(leg.getDuration().getText()); sb.append(")\n\n"); } } } return Text.stripHTML(sb.toString()); }
From source file:net.cbtltd.client.field.RouteField.java
/** * Gets the HTML table of the route directions. * /*w ww . j av a2 s . com*/ * @param all is true if the <pre><html><body>...</body></html></pre> tags are to be included. * @return the HTML table of the route directions. */ public String getHTML(boolean all) { StringBuilder sb = new StringBuilder(); if (all) { sb.append("<html><body>"); } JsArray<DirectionsRoute> routes = result.getRoutes(); if (routes == null) { sb.append("No directions available"); } for (int i = 0; i < routes.length(); i++) { DirectionsRoute route = routes.get(i); sb.append(route.getWarnings()); JsArray<DirectionsLeg> legs = route.getLegs(); for (int j = 0; j < routes.length(); j++) { DirectionsLeg leg = legs.get(j); sb.append("<tr>"); sb.append("<td>"); sb.append(leg.getStart_Address() + " to " + leg.getEnd_Address()); sb.append("</td>"); sb.append("<td>"); sb.append(leg.getDistance().getText()); sb.append("</td>"); sb.append("<td>("); sb.append(leg.getDuration().getText()); sb.append(")</td>"); sb.append("</tr>"); } sb.append("</table>"); } if (all) { sb.append("</body></html>"); } return sb.toString(); }