List of usage examples for com.google.gwt.user.client Timer schedule
public synchronized void schedule(int delayMs)
From source file:com.square.composant.ged.square.client.composant.popup.LoadingPopup.java
License:Open Source License
/** * Affiche la popup d'info de chargement. * @param config la configuration de la popup *//*from w w w .j a v a 2s .c o m*/ public static void afficher(LoadingPopupConfiguration config) { if (config.getMessage() == null) { config.setMessage(POPUP_CONSTANTS.defaultMessage()); } // on tronque la largeur si message trop long if (config.getMessage().length() > PopupConstants.MESSAGE_LENGTH_MAX_RESIZE) { config.setWidth(Popup.POPUP_WIDTH_LARGE); } // On incrmente le compteur de lancements compteurLancements++; if (config.getExtraContent() != null) { final VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.add(new HTML(config.getMessage())); panel.add(config.getExtraContent()); getInstance().setContenu(panel); } else { getInstance().setContenu(new HTML(config.getMessage())); } if (config.getWidth() != null) { getInstance().setWidth(config.getWidth() + "px"); } getInstance().show(); if (config.getSecondes() != null) { final Timer timer = new Timer() { public void run() { // Arrt de la popup stop(); } }; // Lancement du timer timer.schedule(config.getSecondes() * PopupConstants.MILLISECONDS); } }
From source file:com.square.composants.graphiques.lib.client.popups.DecoratedInfoPopup.java
License:Open Source License
/** Affichage de la popup. */ public void show() { super.show(); final Timer timer = new Timer() { @Override/*from ww w. ja v a 2s.c o m*/ public void run() { // On fait disparaitre la popup la fin du timer. hide(); if (config.getCallback() != null) { config.getCallback().onResult(true); } } }; // Lancement du timer timer.schedule((int) (config.getTimeOut() * PopupConstants.MILLISECONDS)); }
From source file:com.sun.labs.aura.music.wsitm.client.ui.swidget.SimpleSearchSwidget.java
License:Open Source License
private void invokeGetArtistInfo(String artistID, boolean refresh, SearchResults listResults) { PerformanceTimer.start("invokeGetArtistInfo"); ///* ww w . ja v a2 s . com*/ // If we are currently fetching the similarity type, we can't fetch the // artist's info yet so let's try again in 250ms if (cdm.getCurrSimTypeName() == null || cdm.getCurrSimTypeName().equals("")) { Timer t = new TimerWithArtist(artistID, refresh); t.schedule(250); } else { if (artistID.startsWith("artist:")) { artistID = artistID.replaceAll("artist:", ""); } AsyncCallback callback = new DEAsyncCallback<SearchResults, ArtistDetails>(listResults) { public void onSuccess(ArtistDetails artistDetails) { PerformanceTimer.stop("getArtistDetails"); // do some UI stuff to show success if (artistDetails != null && artistDetails.isOK()) { PerformanceTimer.start("createArtistPanel"); cdm.setCurrArtistInfo(artistDetails.getId(), artistDetails.getName()); Widget artistPanel = createArtistPanel(artistDetails); //search.setText(artistDetails.getName(), searchTypes.SEARCH_FOR_ARTIST_BY_ARTIST); //search.updateSuggestBox(Oracles.ARTIST); setResults("artist:" + artistDetails.getId(), artistPanel); hideLoader(); showTopMessage(new Label("Artist bio is displayed below. Click any tag for details. " + "Similar artists are shown on the left. See where they overlap " + "with \"why?\". The big steering wheel on the right lets you " + "customize the recommended artists.")); // If we embeded a search result, a serch was made and although aura returned // multiple results, one of them matched exacly. Offer to display the full list if (data != null) { int length = data.getItemResults(null).length; Label l = new Label("Not the artist you were looking for? Show " + String.valueOf(length - 1) + " similar result" + (length > 2 ? "s" : "")); l.setStyleName("pointer topMsgIndicatorSmall"); l.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { searchResultsToArtistList(data); } }); showTopMessage(l); } PerformanceTimer.stop("createArtistPanel"); } else { if (artistDetails == null) { showTopMessage("Sorry. The details for the artist don't seem to be in our database."); clearResults(); } else { showTopMessage("Whooops " + artistDetails.getStatus()); clearResults(); } } PerformanceTimer.stop("invokeGetArtistInfo"); } public void onFailure(Throwable caught) { PerformanceTimer.stop("getArtistDetails"); Popup.showErrorPopup(caught, Popup.ERROR_MSG_PREFIX.ERROR_OCC_WHILE, "retrieve artist details.", Popup.ERROR_LVL.NORMAL, null); PerformanceTimer.stop("invokeGetArtistInfo"); } }; showLoader(); try { PerformanceTimer.start("getArtistDetails"); musicServer.getArtistDetails(artistID, refresh, cdm.getCurrSimTypeName(), cdm.getCurrPopularity(), callback); } catch (Exception ex) { Popup.showErrorPopup(ex, Popup.ERROR_MSG_PREFIX.ERROR_OCC_WHILE, "retrieve artist details.", Popup.ERROR_LVL.NORMAL, null); } } }
From source file:com.sun.labs.aura.music.wsitm.client.ui.swidget.Swidget.java
License:Open Source License
protected void showHelpOffer() { if (useTopLoader) { HorizontalPanel hP = new HorizontalPanel(); hP.setSpacing(3);//from ww w . j av a 2 s . c o m hP.add(playImgBundle.topArrow().createImage()); Label helpLbl = new Label("Need help?"); helpLbl.addStyleName("tag1"); helpLbl.setWidth("100px"); hP.add(helpLbl); hP.getElement().getStyle().setPropertyPx("marginLeft", 30); topMsgGrid.setWidget(0, 0, hP); // Clear message in 10 seconds Timer t = new Timer() { @Override public void run() { topMsgGrid.clearCell(0, 0); } }; t.schedule(1000 * 10); } }
From source file:com.sun.labs.aura.music.wsitm.client.ui.widget.RightMenuWidget.java
License:Open Source License
private void init(T w, Panel mainPanel) { this.w = w;// ww w . ja va2 s.c o m this.mainPanel = mainPanel; this.rightMenu = new SpannedFlowPanel(); //this.rightMenu = new SpannedVerticalPanel(); mainPanel.add(w); mainPanel.add(rightMenu); initWidget(mainPanel); rightMenuWidgets = new HashSet<Widget>(); hoverListenerManager = new HoverListenerManager(); addMouseListener(new MouseListener() { public void onMouseEnter(Widget arg0) { isHovering = true; hoverListenerManager.triggerOnMouseHover(); } public void onMouseLeave(Widget arg0) { isHovering = false; hoverListenerManager.triggerOnMouseOut(); Timer t = new Timer() { public void run() { if (!isHovering) { hoverListenerManager.triggerOnOutTimer(); } } }; t.schedule(250); } public void onMouseDown(Widget arg0, int arg1, int arg2) { } public void onMouseMove(Widget arg0, int arg1, int arg2) { } public void onMouseUp(Widget arg0, int arg1, int arg2) { } }); }
From source file:com.tasktop.c2c.server.profile.web.ui.client.presenter.components.ProjectDashboardPresenter.java
License:Open Source License
private void fetchDashboardData() { final String fetchingProjectId = projectId; AppGinjector.get.instance().getProfileService().getDashboard(fetchingProjectId, new AsyncCallbackSupport<ProjectDashboard>(AsyncCallbackSupport.LOADING_MESSSAGE) { @Override/*from w ww . j a v a 2s . co m*/ protected void success(final ProjectDashboard result) { if (!stillOnPage(fetchingProjectId)) { return; } dashboardView.drawCommits(result.getCommitsByAuthor()); dashboardView.drawTimelines(result.getTaskSummaries(), result.getScmSummaries()); dashboardView.hudsonStatusView.setStatus(result.getBuildStatus()); Timer timer = new Timer() { @Override public void run() { if (!stillOnPage(fetchingProjectId)) { return; } fetchDashboardData(); } }; timer.schedule(UPDATE_PERIOD); } }); }
From source file:com.tasktop.c2c.server.profile.web.ui.client.presenter.components.ProjectDashboardPresenter.java
License:Open Source License
private void fetchActivityData() { final String fetchingProjectId = projectId; AppGinjector.get.instance().getProfileService().getRecentActivity(fetchingProjectId, new AsyncCallbackSupport<List<ProjectActivity>>(AsyncCallbackSupport.LOADING_MESSSAGE) { @Override/* w w w . j ava 2s. c o m*/ protected void success(List<ProjectActivity> result) { if (!stillOnPage(fetchingProjectId)) { return; } dashboardView.activityView.renderActivity(result); Timer timer = new Timer() { @Override public void run() { if (!stillOnPage(fetchingProjectId)) { return; } fetchActivityData(); } }; timer.schedule(UPDATE_PERIOD); } }); }
From source file:com.tasktop.c2c.server.profile.web.ui.client.view.components.BaseProjectIconPanel.java
License:Open Source License
private void setupProjectServiceCallback(final String projectIdentifier) { Timer timer = new Timer() { @Override//from w ww . j a v a 2 s.c o m public void run() { if (!stillOnPage(projectIdentifier)) { return; } AppGinjector.get.instance().getEventBus().fireEvent(new ClearCacheEvent()); AppGinjector.get.instance().getDispatchService().execute(new GetProjectAction(projectIdentifier), new AsyncCallbackSupport<GetProjectResult>() { @Override protected void success(GetProjectResult result) { if (!stillOnPage(projectIdentifier)) { return; } // Re-set our project to trigger recalculation of current service availability. setProject(result.get()); } }); } }; timer.schedule(SERVICE_PROVISION_POLL_DELAY); }
From source file:com.taxigang.client.facebook.FacebookFactory.java
License:Apache License
private static void waitAWhile(final int counter, final Command command) { Timer timer = new Timer() { public void run() { Log.info("waitAWhile " + counter + " " + scriptLoaded); if (scriptLoaded) { return; }/* w w w.j av a 2 s.c o m*/ int i = counter + 1; if (i > 8) { Log.info("timed out " + scriptLoaded); if (!scriptLoaded) { createFBConnection(thisCallback, command); } return; } waitAWhile(i, command); } }; timer.schedule(500); }
From source file:com.totsp.gwittir.client.fx.ui.SoftHorizontalScrollbar.java
License:Open Source License
protected void onAttach() { super.onAttach(); target.addScrollListener(this.scrollListener); Window.addWindowResizeListener(this.windowListener); this.lowerTarget.addMouseListener(this.getLowerListener()); this.higherTarget.addMouseListener(this.getHigherListener()); this.barTarget.addMouseListener(this.getBarListener()); Timer t = new Timer() { public void run() { target.setScrollPosition(target.getScrollPosition()); refresh();/*from w w w . ja v a 2 s.c o m*/ } }; t.schedule(10); }