List of usage examples for com.google.gwt.maps.client.event TrafficOverlayChangedHandler TrafficOverlayChangedHandler
TrafficOverlayChangedHandler
From source file:com.google.gwt.maps.sample.hellomaps.client.TrafficOverlayDemo.java
License:Apache License
public TrafficOverlayDemo() { Panel panel = new FlowPanel(); map = new MapWidget(LatLng.newInstance(40.652513, -73.936615), 12); map.setSize("640px", "480px"); panel.add(map);// w w w. ja va 2s . com Button toggleTraffic = new Button("Toggle Traffic"); toggleTraffic.addClickListener(new ClickListener() { public void onClick(Widget sender) { if (trafficShown) { map.removeOverlay(trafficInfo); } else { map.addOverlay(trafficInfo); } trafficShown = !trafficShown; } }); panel.add(toggleTraffic); final Label changeLabel = new Label(); panel.add(changeLabel); initWidget(panel); trafficInfo = new TrafficOverlay(); trafficInfo.addTrafficOverlayChangedHandler(new TrafficOverlayChangedHandler() { public void onChanged(TrafficOverlayChangedEvent event) { changeLabel.setText("Last Changed: " + new Date()); } }); }