List of usage examples for com.google.gwt.user.client Timer schedule
public synchronized void schedule(int delayMs)
From source file:it.bz.tis.sasabus.html5.shared.ui.menu.Menu.java
License:Open Source License
public void hide() { this.moreClickHandler.hide(); if (this.menuOpen) { this.addStyleName("anim-left"); this.removeStyleName("show"); this.menuOpen = !this.menuOpen; Timer removeAnim = new Timer() { @Override// w w w . j a v a 2 s. com public void run() { Menu.this.removeStyleName("anim-left"); } }; removeAnim.schedule(1000); } }
From source file:it.bz.tis.sasabus.html5.shared.ui.SplashPanel.java
License:Open Source License
public SplashPanel(final DivView cover, final DivView wrapper, final SASAbusMap map, final Menu menu, final HomePanel homePage, final DMHashNavigationPanel navigationPanel, final BusStationCustomViewAndI18N custom, String appTitle) { super("splash-panel"); final SASAbusI18N i18n = custom.getI18n(); this.appendChild(new SpanView(appTitle)); this.appendChild(Icon.newHTML5Icon()); DivView imageContainer = new DivView("image-container"); final ImgView sasaImg = new ImgView("../images/bus.png"); imageContainer.appendChild(sasaImg); this.appendChild(imageContainer); final SpanView currentOperation = new SpanView(i18n.getLocalizedText("AboutPanel_checkingUpdates")); this.appendChild(currentOperation); final long startTime = System.currentTimeMillis(); final SASAbusDBDataReady<AreaList> response = new SASAbusDBDataReady<AreaList>() { @Override//from w w w .ja v a2 s. c o m public void ready(final AreaList data) { currentOperation.setText(i18n.getLocalizedText("AboutPanel_ready")); long stopTime = System.currentTimeMillis(); long minWait = 2000 - (stopTime - startTime); if (minWait < 0) { minWait = 0; } Timer t1 = new Timer() { @Override public void run() { sasaImg.getElement().getStyle().setLeft(300, Unit.PX); cover.getElement().getStyle().setOpacity(0); Timer t2 = new Timer() { @Override public void run() { wrapper.remove(cover); map.start(data); menu.initClickHandlers(data); } }; t2.schedule(700); } }; t1.schedule((int) minWait); FavouriteBusStationListPanel favouriteBusStationListPanel = new FavouriteBusStationListPanel(data, navigationPanel, map, custom, "home"); homePage.favouriteContainer.appendChild(favouriteBusStationListPanel); homePage.favouriteBusStationListPanel = favouriteBusStationListPanel; } }; SASAbusDBClientImpl.singleton.lastModified(new SASAbusDBDataReady<SASAbusDBLastModified>() { @Override public void ready(SASAbusDBLastModified data) { final Storage localStorage = Storage.getLocalStorageIfSupported(); if (localStorage != null) { String tmp = localStorage.getItem(SplashPanel.this.SASABUS_DB_LAST_MODIFIED); if (tmp != null) { long localLastModified = Long.parseLong(tmp); if (localLastModified == data.getTimestamp()) { currentOperation.setText(i18n.getLocalizedText("AboutPanel_readingLocalstore")); Timer t1 = new Timer() { @Override public void run() { SASAbusBackendUnmarshaller unmarshaller = new SASAbusBackendUnmarshaller(); String txt = localStorage.getItem(SplashPanel.this.SASABUS_DB_DATA); JSONObject jsonObject = (JSONObject) JSONParser.parse(txt); GWTStructure gwtStructure = new GWTStructure(jsonObject); try { AreaList obj = (AreaList) unmarshaller.newInstance("AreaList"); unmarshaller.unmarschall(gwtStructure, obj); response.ready(obj); } catch (Exception exxx) { SASAbusHTML5.handleException(exxx); } } }; t1.schedule(200); return; } } } currentOperation.setText(i18n.getLocalizedText("AboutPanel_downloadingUpdates")); SASAbusDBClientImpl.singleton.listBusAreasLinesStopsStations(new SASAbusDBDataReady<AreaList>() { @Override public void ready(final AreaList data) { // save data to localstore if possible if (localStorage != null) // browser support local storage { currentOperation.setText(i18n.getLocalizedText("AboutPanel_writingLocalstore")); Timer t1 = new Timer() { @Override public void run() { try { int i = 0; long[] times = new long[7]; times[i++] = System.currentTimeMillis(); JSONStructure jsonStructure = new JSONStructure(0); times[i++] = System.currentTimeMillis(); SASAbusBackendMarshaller marshaller = new SASAbusBackendMarshaller(); times[i++] = System.currentTimeMillis(); marshaller.marschall(data, jsonStructure); times[i++] = System.currentTimeMillis(); String txt = jsonStructure.toString(); times[i++] = System.currentTimeMillis(); localStorage.setItem(SplashPanel.this.SASABUS_DB_DATA, txt); times[i++] = System.currentTimeMillis(); localStorage.setItem(SplashPanel.this.SASABUS_DB_LAST_MODIFIED, String.valueOf(data.getLastModified())); times[i++] = System.currentTimeMillis(); long stop = System.currentTimeMillis(); String report = ""; for (int k = 0; k < times.length - 1; k++) { report += "Time " + k + ": " + (times[k + 1] - times[k]) + "\n"; } response.ready(data); } catch (Exception e) { SASAbusHTML5.handleException(e); } } }; t1.schedule(200); return; } response.ready(data); } }); } }); }
From source file:it.geosdi.era.client.controller.GeocoderController.java
License:Open Source License
/** * // w w w . j ava2 s. com */ private void checkWidgetStatus() { Timer timer = new Timer() { @Override public void run() { if (geocoderWidget.getGrid().getView().getBody().isMasked()) { MessageBox.confirm("Geocoder - Service", "Geocoding service is demanding too much time, probably the connection problem, do you want to stop it?", new Listener<WindowEvent>() { public void handleEvent(WindowEvent be) { if (be.buttonClicked.getText().equalsIgnoreCase("yes") || be.buttonClicked.getText().equalsIgnoreCase("si")) { geocoderWidget.getGrid().getView().getBody().unmask(); geocoderWidget.getGrid().getView().refresh(false); } else schedule(15000); } }); } } }; timer.schedule(15000); }
From source file:it.sasabz.sasabus.webmap.client.SASAbusWebMap.java
License:Open Source License
void checkGpsTimer() { Timer timer = new Timer() { @Override// w w w.jav a 2 s .c om public void run() { SASAbusWebMap.this.checkGps(); } }; timer.schedule(500); }
From source file:jetbrains.jetpad.base.edt.JsEventDispatchThread.java
License:Apache License
@Override public Registration schedule(int delay, final Runnable r) { Timer timer = new Timer() { @Override/*www . jav a2 s .c om*/ public void run() { doExecute(r); } }; timer.schedule(delay); return timerReg(timer); }
From source file:loomp.oca.client.ui.OcaEditor.java
License:Open Source License
public void addCssFile(String css) { /* http://www.sencha.com/forum/showthread.php?69946-Using-styles-in-HTMLEditor */ Timer t = new CssTimer(css); t.schedule(500); }
From source file:net.easysmarthouse.ui.webui.client.rpc.mock.MonitoringAsyncMock.java
@Override public void getSensors(final AsyncCallback<List<Sensor>> asyncCallback) { final List<Sensor> sensors = new LinkedList<Sensor>(); PlainSensor sensor1 = new PlainSensor(); sensor1.setAddress("C2000801AC339F10"); sensor1.setDescription("Temperature sensor outside"); sensor1.setLabel("Temperature sensor 1"); sensor1.setSensorType(SensorType.TemperatureSensor); sensor1.setValue(-1.0d);/*from ww w . j a va 2 s. c o m*/ sensors.add(sensor1); PlainSensor sensor2 = new PlainSensor(); sensor2.setAddress("EC000801AC673410"); sensor2.setDescription("Temperature sensor inside"); sensor2.setLabel("Temperature sensor 2"); sensor2.setSensorType(SensorType.TemperatureSensor); sensor2.setValue(25.3d); sensors.add(sensor2); final Timer timer = new Timer() { @Override public void run() { asyncCallback.onSuccess(sensors); } }; timer.schedule(TIMER_DELAY); }
From source file:next.celebs.api.API.java
License:Apache License
private void gotoPage(final int[] page, final int maxPage, final ImageSearch search) { if (page[0] > maxPage) { return;//w w w . j a v a 2 s . co m } Timer t = new Timer() { public void run() { search.gotoPage(page[0]); Log.info("Opening page " + page[0]); page[0] = page[0] + 1; gotoPage(page, maxPage, search); } }; t.schedule(300); }
From source file:next.celebs.model.API.java
License:Apache License
private void gotoPage(final int[] page, final int maxPage, final ImageSearch search) { if (page[0] > maxPage) { return;//from w w w.j a v a2 s .c o m } Timer t = new Timer() { public void run() { search.gotoPage(page[0]); page[0] = page[0] + 1; gotoPage(page, maxPage, search); } }; t.schedule(200); }
From source file:next.celebs.page.FrontTopMenu.java
License:Apache License
private void doHideBtn(final Widget widg, int schedule) { Timer t3 = new Timer() { public void run() { FxUtil.doHide(widg, null).play(); }//from ww w . j av a2 s . c om }; t3.schedule(schedule); }