List of usage examples for com.google.gwt.user.client Timer Timer
Timer
From source file:com.google.maps.gwt.samples.events.client.EventSimple.java
License:Apache License
@Override public void onModuleLoad() { LatLng myLatLng = LatLng.create(-25.363882, 131.044922); MapOptions myOptions = MapOptions.create(); myOptions.setZoom(4.0);/*ww w. j av a2 s . co m*/ myOptions.setCenter(myLatLng); myOptions.setMapTypeId(MapTypeId.ROADMAP); map = GoogleMap.create(Document.get().getElementById("map_canvas"), myOptions); map.addZoomChangedListener(new GoogleMap.ZoomChangedHandler() { public void handle() { Timer moveToDarwinTimer = new Timer() { public void run() { map.setCenter(DARWIN); } }; moveToDarwinTimer.schedule(3000); } }); MarkerOptions markerOptions = MarkerOptions.create(); markerOptions.setPosition(myLatLng); markerOptions.setMap(map); markerOptions.setTitle("Hello World!"); Marker myMarker = Marker.create(markerOptions); myMarker.addClickListener(new Marker.ClickHandler() { @Override public void handle(MouseEvent event) { map.setZoom(8); } }); }
From source file:com.google.maps.gwt.samples.maptypes.client.AerialRotation.java
License:Apache License
public void autorotate() { if (map.getTilt() != 0) { map.setHeading(180);// www.j a v a 2 s . c o m new Timer() { public void run() { map.setHeading(270); } }.schedule(3000); new Timer() { public void run() { map.setHeading(0); } }.schedule(6000); new Timer() { public void run() { map.setHeading(90); } }.schedule(9000); } }
From source file:com.google.maps.gwt.samples.overlays.client.MarkerAnimationsIteration.java
License:Apache License
public void drop() { deleteOverlays();/*from w w w . j av a2 s . c o m*/ for (int i = 0; i < NEIGHBORHOODS.length; i++) { final int idx = i; new Timer() { public void run() { addMarker(idx); } }.schedule((i + 1) * 200); } }
From source file:com.google.mobile.trippy.web.client.base.DefaultUtils.java
License:Apache License
@Override public void startCheckOnlineTimer() { if (onlineCheckTimer == null) { onlineCheckTimer = new Timer() { @Override/* w ww . j a va2 s . c o m*/ public void run() { // Check online state if (online == null || online != isOnline()) { online = isOnline(); ValueChangeEvent<Boolean> e = new ValueChangeEvent<Boolean>(online) { }; for (ValueChangeHandler<Boolean> handler : handlers) { handler.onValueChange(e); } } } }; } onlineCheckTimer.run(); // Schedule the timer to run every 5 seconds. onlineCheckTimer.scheduleRepeating(5000); }
From source file:com.google.mobile.trippy.web.client.Trippy.java
License:Apache License
private void init() { eventBus = singletonComponent.getEventBus(); tripService = singletonComponent.getTripService(); toast = singletonComponent.getToast(); utils = singletonComponent.getUtils(); messages = singletonComponent.getMessage(); // Expose methods to android shell app. AndroidProxy proxy = new AndroidProxy(eventBus); proxy.setDoSearch(proxy);// w ww.java2s . c o m final String cls = Window.Location.getParameter("cls"); if (cls != null && cls.toLowerCase().equals("true")) { LocalDbService.clearDb(); } initDb(); utils.addOnlineHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(final ValueChangeEvent<Boolean> event) { if (event.getValue()) { toast.showToast(messages.onLineStatusMsg()); } else { toast.showToast(messages.offLineStatusMsg()); } } }); utils.startCheckOnlineTimer(); // utils.startLocationUpdateTimer(); toast.showLoading(messages.loading()); syncFromRemoteDb(new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { toast.hideLoading(); } @Override public void onFailure(Throwable caught) { toast.hideLoading(); } }); final Timer timer = new Timer() { @Override public void run() { syncFromRemoteDb(); } }; // Sync db after every 60 secs. timer.scheduleRepeating(SYNC_PERIOD); }
From source file:com.google.mobile.trippy.web.client.widget.DefaultToast.java
License:Apache License
private void initializeToast() { toastLabel = new Label(); toastLabel.setStyleName(toastStyle.style.base()); toastPanel = new PopupPanel(); toastPanel.add(toastLabel);// w w w. j a v a2 s . c o m toastTimer = new Timer() { @Override public void run() { if (toastPanel.isShowing()) { toastPanel.hide(); } } }; toastPanel.setStyleName(toastStyle.style.popUpBase()); }
From source file:com.google.speedtracer.client.MonitorVisualizationsPanel.java
License:Apache License
private void createVisualizations(ApplicationState initialState, MainTimeLine.Resources resources) { // Sluggishness SluggishnessModel sluggishnessModel = (SluggishnessModel) initialState .getVisualizationModel(SluggishnessVisualization.TITLE); SluggishnessVisualization sluggishnessVisualization = new SluggishnessVisualization(mainTimeLine, sluggishnessModel, detailsViewPanel.getContainer(), resources); // Network Visualization NetworkVisualizationModel networkModel = (NetworkVisualizationModel) initialState .getVisualizationModel(NetworkVisualization.TITLE); NetworkVisualization networkVisualization = new NetworkVisualization(mainTimeLine, networkModel, detailsViewPanel.getContainer(), resources); // Load the visualization that we just added. loadVisualization(sluggishnessVisualization); loadVisualization(networkVisualization); // Setup the graphs to refresh when hintlet data arrives. Buffer the data // so that the screen doesn't jump from rapid hintlet data coming in. initialState.getDataDispatcher().getHintletEngineHost() .addHintListener(new HintletInterface.HintListener() { boolean queued = false; public void onHint(HintRecord hintlet) { if (queued) { return; }/*ww w .j a v a 2 s. co m*/ double hintletTime = hintlet.getTimestamp(); if (hintletTime < mainTimeLineModel.getLeftBound() || hintletTime > mainTimeLineModel.getRightBound()) { // out of bounds - no need to refresh return; } Timer t = new Timer() { @Override public void run() { mainTimeLineModel.refresh(); queued = false; } }; t.schedule(HINTLET_REFRESH_DELAY_MS); queued = true; } }); }
From source file:com.google.testing.testify.risk.frontend.client.view.impl.ProjectSettingsViewImpl.java
License:Apache License
@Override public void showSaved() { updateProjectInfoButton.setEnabled(true); savedPanel.setVisible(true);//from w ww. j ava 2 s .c o m Timer timer = new Timer() { @Override public void run() { savedPanel.setVisible(false); } }; // Make the saved item disappear after 10 seconds. timer.schedule(10000); }
From source file:com.google.testing.testify.risk.frontend.client.view.widgets.EditCapabilityWidget.java
License:Apache License
public void showSaved() { // Show saved message. savedPanel.setVisible(true);// ww w.jav a 2 s. c o m Timer timer = new Timer() { @Override public void run() { savedPanel.setVisible(false); } }; // Make the saved text disappear after 10 seconds. timer.schedule(5000); }
From source file:com.googlecode.gwtgl.example.client.AbstractGwtGLExample.java
License:Apache License
/** * Starts the execution of the example. First the example is initialized * using {@link AbstractGwtGLExample#init()}. After that the rendering loop * is executed with 50 fps. Each frame is rendered using * {@link AbstractGwtGLExample#draw()}.//from ww w. jav a 2 s . c om */ private void start() { init(); Timer timer = new Timer() { @Override public void run() { draw(); } }; timer.scheduleRepeating(20); }