List of usage examples for com.google.gwt.user.client Timer cancel
public synchronized void cancel()
From source file:org.rhq.coregui.client.dashboard.AutoRefreshUtil.java
License:Open Source License
private static Timer startRefreshCycle(final AutoRefresh autoRefresh, final Canvas autoRefreshCanvas, Timer refreshTimer, int intervalMillis, int minIntervalMillis) { //cancel any existing timer if (null != refreshTimer) { refreshTimer.cancel(); refreshTimer = null;/* w ww .j a v a2 s . c om*/ } if (minIntervalMillis <= 0 || intervalMillis >= minIntervalMillis) { refreshTimer = new Timer() { public void run() { // if the autoRefresh component is already refreshing or is not currently on screen then // don't bother doing the work. this protects against unnecessary or unwanted db queries // being performed in the background. Also, avoid refresh if the session has expired and we're // waiting for the user to login and refresh his session. if (!autoRefresh.isRefreshing() && autoRefreshCanvas.isDrawn() && autoRefreshCanvas.isVisible() && !autoRefreshCanvas.isDisabled() && !LoginView.isLoginShowing()) { autoRefresh.refresh(); } } }; refreshTimer.scheduleRepeating(intervalMillis); } return refreshTimer; }
From source file:org.rhq.coregui.client.dashboard.AutoRefreshUtil.java
License:Open Source License
public static void onDestroy(Timer refreshTimer) { if (refreshTimer != null) { refreshTimer.cancel(); }//w w w . j a v a2 s . c om }
From source file:org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil.java
License:Open Source License
public static Timer startRefreshCycle(final AutoRefreshPortlet autoRefreshPortlet, final Canvas autoRefreshPortletCanvas, Timer refreshTimer) { final int refreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval(); //cancel any existing timer if (null != refreshTimer) { refreshTimer.cancel(); }/* www.j a v a2 s . c o m*/ if (refreshInterval >= MeasurementUtility.MINUTES) { refreshTimer = new Timer() { public void run() { // if the portlet is already refreshing or if the portlet is not currently on screen then // don't bother doing the work. this protects against unnecessary or unwanted db queries // being performed in the background. if (!autoRefreshPortlet.isRefreshing() && autoRefreshPortletCanvas.isVisible()) { autoRefreshPortlet.refresh(); } } }; refreshTimer.scheduleRepeating(refreshInterval); } return refreshTimer; }
From source file:org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil.java
License:Open Source License
public static void onDestroy(final Canvas portlet, Timer refreshTimer) { if (refreshTimer != null) { refreshTimer.cancel(); }//from w ww .j a v a 2s . c o m }
From source file:org.rstudio.studio.client.rsconnect.ui.RSConnectDeployDialog.java
License:Open Source License
private void updateApplicationList() { final RSConnectAccount account = contents_.getSelectedAccount(); if (account == null) return;/*from w ww.ja v a 2 s.co m*/ // Check to see if the app list is already in our cache if (apps_.containsKey(account)) { setAppList(apps_.get(account)); return; } // This operation hits the back-end service, so show some progress if // it takes more than a few ms final Timer t = new Timer() { @Override public void run() { indicator_.onProgress("Contacting Server..."); } }; t.schedule(500); // Not already in our cache, fetch it and populate the cache server_.getRSConnectAppList(account.getName(), account.getServer(), new ServerRequestCallback<JsArray<RSConnectApplicationInfo>>() { @Override public void onResponseReceived(JsArray<RSConnectApplicationInfo> apps) { t.cancel(); indicator_.onCompleted(); apps_.put(account, apps); setAppList(apps); } @Override public void onError(ServerError error) { t.cancel(); indicator_.onCompleted(); // we can always create a new app contents_.setAppList(null, null); } }); }
From source file:org.rstudio.studio.client.shiny.ui.ShinyAppsDeployDialog.java
License:Open Source License
private void updateApplicationList() { final String accountName = contents_.getSelectedAccount(); if (accountName == null) return;/*www.j a v a2s .c o m*/ // Check to see if the app list is already in our cache if (apps_.containsKey(accountName)) { setAppList(apps_.get(accountName)); return; } // This operation hits the ShinyApps service, so show some progress if // it takes more than a few ms final Timer t = new Timer() { @Override public void run() { indicator_.onProgress("Contacting ShinyApps..."); } }; t.schedule(500); // Not already in our cache, fetch it and populate the cache server_.getShinyAppsAppList(accountName, new ServerRequestCallback<JsArray<ShinyAppsApplicationInfo>>() { @Override public void onResponseReceived(JsArray<ShinyAppsApplicationInfo> apps) { t.cancel(); indicator_.onCompleted(); apps_.put(accountName, apps); setAppList(apps); } @Override public void onError(ServerError error) { t.cancel(); indicator_.onCompleted(); // we can always create a new app contents_.setAppList(null, null); } }); }
From source file:org.spiffyui.spsample.client.WidgetsPanel.java
License:Apache License
/** * Create the tooltip and add it to the sliding grid */// w w w . ja v a 2s . c o m private void addTooltip() { /* * Create a tooltip with a simple body. * Add an anchor that will show the tooltip. */ final Tooltip tooltip = new Tooltip(); tooltip.setBody(new HTML(Index.getStrings().tooltipBody())); final Anchor anchor = new Anchor(Index.getStrings().showTooltip()); final Timer showTooltip = new Timer() { @Override public void run() { tooltip.showRelativeTo(anchor); } }; anchor.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { /* * Show the tooltip after a delay */ showTooltip.schedule(tooltip.getAutoCloseTime()); } }); anchor.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { if (tooltip.isShowing()) { /* * Autoclose the tooltip after a delay */ tooltip.startAutoCloseTimer(); } else { /* * Cancel the delay to show the tooltip */ showTooltip.cancel(); } } }); addToSlidingGrid(anchor, "WidgetsTooltip", Index.getStrings().tooltip(), STRINGS.Tooltip_html()); }