List of usage examples for com.google.gwt.user.client Timer schedule
public synchronized void schedule(int delayMs)
From source file:es.deusto.weblab.client.mocks.MockController.java
License:Open Source License
private void afterShowingWaitingConfirmation() { final ExperimentID experimentID = new ExperimentID(); experimentID.setCategory(new Category("PLD experiments")); experimentID.setExperimentName("pld-deusto"); try {//from w w w . j av a 2 s.com this.uimanager.onExperimentReserved(experimentID, null); } catch (final ExperimentException e) { e.printStackTrace(); return; } this.uimanager.onMessage("Programming device..."); final Timer t = new Timer() { @Override public void run() { MockController.this.uimanager.onMessage("Ready to serve"); } }; t.schedule(600); }
From source file:es.upm.fi.dia.oeg.map4rdf.client.Browser.java
License:Open Source License
@Override public void onModuleLoad() { try {/* ww w . j a v a2 s. c o m*/ injector = GWT.create(Injector.class); } catch (Exception e) { injector = null; Window.alert("An several exception ocurred when load the webpage. " + " Exception: " + e.getMessage() + "." + "Please contact with System Admin"); return; } AppController controller = new AppController(injector.getBrowserUi(), injector.getEventBus()); controller.addPresenter(injector.getDashboard(), Places.DASHBOARD); controller.addPresenter(injector.getSelectConfigurationPresenter(), Places.SELECT_CONFIG); controller.bind(); RootLayoutPanel.get().add(controller.getDisplay().asWidget()); TokenFormatter tokenFormatter = new TokenFormatter() { private HashMap<String, PlaceRequest> tokenPlaces = new HashMap<String, PlaceRequest>(); private HashMap<PlaceRequest, String> placeTokens = new HashMap<PlaceRequest, String>(); @Override public PlaceRequest toPlaceRequest(String token) throws TokenFormatException { PlaceRequest toReturn; if (tokenPlaces.containsKey(token)) { toReturn = tokenPlaces.get(token); } else { toReturn = new PlaceRequest(token); tokenPlaces.put(token, toReturn); placeTokens.put(toReturn, token); } return toReturn; } @Override public String toHistoryToken(PlaceRequest placeRequest) throws TokenFormatException { String token; if (placeTokens.containsKey(placeRequest)) { token = placeTokens.get(placeRequest); } else { token = placeRequest.getName(); tokenPlaces.put(token, placeRequest); placeTokens.put(placeRequest, token); } return token; } }; PlaceManager placeManager = new DefaultPlaceManager(injector.getEventBus(), tokenFormatter) { }; if (!injector.getConfigID().existsConfigID()) { injector.getEventBus().fireEvent(new PlaceChangedEvent(Places.SELECT_CONFIG)); } else { if (History.getToken() == null || History.getToken().length() == 0) { // Go to the default place injector.getEventBus().fireEvent(new PlaceChangedEvent(Places.DEFAULT)); } // Trigger history tokens. // ONLY IS VALID IF THE APP HAVE VALID CONFIG ID String parameters[] = Window.Location.getQueryString().substring(1).split("&"); for (String param : parameters) { final String[] parts = param.split("="); if (parts[0].equals("uri")) { //TODO remove timer and use events. Timer timer = new Timer() { @Override public void run() { LoadResourceEvent.fire(parts[1], injector.getEventBus()); } }; timer.schedule(2000); } } } placeManager.fireCurrentPlace(); }
From source file:eu.gaetan.grigis.mail.client.gui.Mail.java
License:Apache License
private void reloadMails() { // Schedule the timer to run once in 5 seconds. Timer t = new Timer() { public void run() { final MailServiceAsync mailService = GWT.create(MailService.class); mailService.getMails(mailAdress, new AsyncCallback<ArrayList<eu.gaetan.grigis.mail.client.Mail>>() { @Override/*from w w w.j av a 2 s .c om*/ public void onSuccess(ArrayList<eu.gaetan.grigis.mail.client.Mail> result) { MailItems.addMails(result); mailList.update(); } @Override public void onFailure(Throwable caught) { } }); this.schedule(5000); } }; t.schedule(5000); }
From source file:fr.aliasource.webmail.client.View.java
License:GNU General Public License
/** * Pop a notification widget for the given time * /* ww w . j a va2 s . c o m*/ * @param w * the widget shown to the user as a notification * @param seconds * how long the widget will remain visible */ public void notifyUser(final Widget w, int seconds) { Timer t = new Timer() { public void run() { statusPanel.remove(w); } }; statusPanel.clear(); w.setStyleName("notificationMessage"); statusPanel.add(w); statusPanel.setCellHorizontalAlignment(w, VerticalPanel.ALIGN_CENTER); t.schedule(seconds * 1000); }
From source file:fr.fg.client.ajax.Action.java
License:Open Source License
private void retry(String error) { attempts++;//from w ww . jav a 2s .c o m errorsCount++; if (attempts < 3) { Timer t = new Timer() { public void run() { doRequest(); } }; t.schedule(200); } else { if (callback != null) { if (error.equals("404")) callback.onFailure("Serveur en cours de maintenance."); else callback.onFailure("Erreur " + error); } cleanUp(); } }
From source file:fr.fg.client.core.Client.java
License:Open Source License
public void onModuleLoad() { instance = this; systemInfoVisible = false;/* w w w . j a va 2s . c o m*/ setStatus("Chargement..."); GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void onUncaughtException(Throwable e) { Utilities.log("Uncaught exception", e); } }); // Charge le fichier XML de dfinition du thme if (Config.isDebug()) OpenJWT.loadStyle(Config.getTheme() + "/style.xml"); else OpenJWT.loadStyle(Config.getServerUrl() + "themeproxy?theme=" + URL.encodeComponent(Config.getTheme())); if (!OpenJWT.isStyleReady()) { Timer timer = new Timer() { @Override public void run() { if (OpenJWT.isStyleReady()) { load(); } else { schedule(100); } } }; timer.schedule(100); } else { load(); } }
From source file:fr.fg.client.core.UpdateManager.java
License:Open Source License
public void onFailure(String error) { if (instance.active) { instance.errorsCount++;/*from w ww . ja v a2 s .c o m*/ if (instance.errorsCount > 3) { super.onFailure(error); // Recharge la page Window.Location.reload(); } else { Timer t = new Timer() { public void run() { instance.update(); } }; t.schedule(200); } } }
From source file:fr.fg.client.map.impl.MiniMap.java
License:Open Source License
public void onWindowResized(int width, int height) { updateMiniMapLocation();//from w ww. j a v a2s .c o m update(); Timer timer = new Timer() { @Override public void run() { updateMiniMapLocation(); update(); } }; timer.schedule(50); }
From source file:fr.ippon.chat.client.widget.LoginDialog.java
License:Open Source License
protected void onSubmit() { if (userName != null && password != null && userList.contains(userName.getValue()) && userList.contains(password.getValue())) { status.show();//from www .j a v a 2 s . com getButtonBar().disable(); Timer t = new Timer() { @Override public void run() { StateManager.get().set("userName", userName.getValue()); LoginDialog.this.hide(); } }; t.schedule(2000); } else { Info.display("Echec", "Erreur de login/password"); } }
From source file:fr.mncc.gwttoolbox.ui.client.Indicator.java
License:Open Source License
public static void showInfo(String msg, int durationInSeconds) { final Indicator indicator = new Indicator(); indicator.setInfoMessage(msg);//from w w w. j a v a 2 s . c om indicator.show(); Timer timer = new Timer() { @Override public void run() { indicator.hide(); } }; timer.schedule(durationInSeconds * 1000); }