List of usage examples for com.google.gwt.user.client Timer schedule
public synchronized void schedule(int delayMs)
From source file:com.extjs.gxt.ui.client.dnd.TreePanelDropTarget.java
License:sencha.com license
protected void handleAppend(DNDEvent event, final TreeNode item) { // clear any active append item if (activeItem != null && activeItem != item) { tree.getView().onDropChange(activeItem, false); }/*www . ja va 2s. c o m*/ status = -1; Insert.get().hide(); event.getStatus().setStatus(true); if (activeItem != null) { tree.getView().onDropChange(activeItem, false); } if (item != null && item != appendItem && autoExpand && !item.isExpanded()) { Timer t = new Timer() { @Override public void run() { if (item == appendItem) { item.setExpanded(true); } else { } } }; t.schedule(autoExpandDelay); } appendItem = item; activeItem = item; if (activeItem != null) { tree.getView().onDropChange(activeItem, true); } }
From source file:com.extjs.gxt.ui.client.GXT.java
License:sencha.com license
/** * Hides the loading panel.//from w w w .ja va2s. c o m * * @param id the loading panel id */ public static void hideLoadingPanel(String id) { final Element loading = XDOM.getElementById(id); if (loading != null) { Timer t = new Timer() { @Override public void run() { El.fly(loading).hide(); } }; t.schedule(500); } }
From source file:com.extjs.gxt.ui.client.widget.grid.Grid.java
License:sencha.com license
protected void afterRender() { view.render();/*from w w w. j a va2 s . com*/ super.afterRender(); if (lazyRowRender > 0) { Timer t = new Timer() { @Override public void run() { afterRenderView(); } }; t.schedule(lazyRowRender); } else { afterRenderView(); } }
From source file:com.extjs.gxt.ui.client.widget.Info.java
License:sencha.com license
protected void afterShow() { Timer t = new Timer() { public void run() { afterHide();/*from w w w . j ava 2s . co m*/ } }; t.schedule(config.display); }
From source file:com.garmin.gwt.communicator.testing.client.Showcase.java
License:Apache License
@Override public void onModuleLoad() { // small delay to allow the page to parse the plugin final Timer delay = new Timer() { @Override/* w w w . ja v a 2s . c o m*/ public void run() { conditionallyLoadScreen(); } }; delay.schedule(300); }
From source file:com.github.gwtmaterialdesign.client.application.googleinbox.GoogleInboxView.java
License:Apache License
@Inject GoogleInboxView(Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); for (InboxDTO dto : DataHelper.getAllTodayInbox()) { inboxColaps.add(new InboxCollapsible(dto)); }//from w ww .j ava2 s. c om for (InboxLinkDTO dto : DataHelper.getAllYesterdayInbox()) { inboxLinkColaps.add(new InboxLinkCollapsible(dto)); } splash.show(); Timer t = new Timer() { @Override public void run() { splash.hide(); } }; t.schedule(4500); }
From source file:com.google.appinventor.client.editor.simple.components.MockComponentsUtil.java
License:Open Source License
/** * Sets the background image for the given widget. * * @param container the MockContainer to refresh when image is loaded * @param widget widget to change background image for * @param image URL//from w ww.j a va2 s . co m */ static void setWidgetBackgroundImage(final MockContainer container, Widget widget, String image) { // Problem: When we change the background image via a Style referencing a "url" // the browser doesn't initially know the size of the image. We need to know it // when the container layout height and/or width is "Automatic." If we query right // away, we will be told the image is 0 x 0 because it isn't loaded yet. // I have not been able to figure out how to get the browser to give us a onLoad (or // similar event) when the image is loaded. If we could get such an event, we can // call refreshForm in the container and win. // // The code below fudges this by setting up a time to fire after 1 second with the // hope that the image will have been loaded by then and its dimensions known. // The code commented out immediately below this code is what I would like to use, // but it doesn't seem to work! -JIS Timer t = new Timer() { @Override public void run() { container.refreshForm(); } }; // widget.addHandler(new LoadHandler() { // @Override // public void onLoad(LoadEvent event) { // container.refreshForm(); // } // }, new Type<LoadHandler>()); setWidgetBackgroundImage(widget, image); t.schedule(1000); // Fire in one second }
From source file:com.google.appinventor.client.explorer.commands.ShowProgressBarCommand.java
License:Open Source License
@Override //the main function to be called public void execute(final ProjectNode node) { final Ode ode = Ode.getInstance(); if (counter < 1) { projectNode = node;/*from www . j ava2 s . com*/ minPB = new ProgressBarDialogBox(); minPB.center(); executeNextCommand(node); } counter++; //call back function - dynamic DialogBox OdeAsyncCallback<RpcResult> callback = new OdeAsyncCallback<RpcResult>(MESSAGES.buildError()) // failure message { @Override public void onSuccess(RpcResult result) { minPB.addMessages(node.getName(), result); if (result.succeeded()) { minPB.hide(); } else if (progressBarShow != 2) { // Build isn't done yet Timer timer = new Timer() { @Override public void run() { execute(node); } }; // TODO(user): Maybe do an exponential backoff here. timer.schedule(WAIT_INTERVAL_MILLIS); } } @Override public void onFailure(Throwable caught) { super.onFailure(caught); executionFailedOrCanceled(); } }; ode.getProjectService().getBuildResult(node.getProjectId(), target, callback); }
From source file:com.google.appinventor.client.explorer.commands.ShowProgressBarForEclipseCommand.java
License:Open Source License
@Override //the main function to be called public void execute(final ProjectNode node) { final Ode ode = Ode.getInstance(); if (counter < 1) { projectNode = node;//from w ww. java2s.c om minPB = new ProgressBarDialogBox(); minPB.center(); executeNextCommand(node); } counter++; //call back function - dynamic DialogBox OdeAsyncCallback<RpcResult> callback = new OdeAsyncCallback<RpcResult>(MESSAGES.buildError()) // failure message { @Override public void onSuccess(RpcResult result) { minPB.addMessages(node.getName(), result); if (result.succeeded()) { minPB.hide(); } else if (progressBarShow != 2) { // Build isn't done yet Timer timer = new Timer() { @Override public void run() { execute(node); } }; // TODO(user): Maybe do an exponential backoff here. timer.schedule(WAIT_INTERVAL_MILLIS); } } @Override public void onFailure(Throwable caught) { super.onFailure(caught); executionFailedOrCanceled(); } }; ode.getProjectService().getEclipseProjectBuildResult(node.getProjectId(), target, this.buildOption, callback); }
From source file:com.google.appinventor.client.explorer.commands.WaitForBuildResultCommand.java
License:Open Source License
@Override public void execute(final ProjectNode node) { final Ode ode = Ode.getInstance(); messagesOutput.clear();// ww w . j ava2 s . c o m messagesOutput.addMessages(MESSAGES.buildRequestedMessage(node.getName(), buildRequestTime)); OdeAsyncCallback<RpcResult> callback = new OdeAsyncCallback<RpcResult>( // failure message MESSAGES.buildError()) { @Override public void onSuccess(RpcResult result) { messagesOutput.addMessages("Waiting for " + getElapsedMillis() / 1000 + " seconds."); messagesOutput.addMessages(result.getOutput()); messagesOutput.addMessages(result.getError()); Tracking.trackEvent(Tracking.PROJECT_EVENT, Tracking.PROJECT_SUBACTION_BUILD_YA, node.getName(), getElapsedMillis()); if (result.succeeded()) { ode.getTopToolbar().updateKeystoreFileMenuButtons(); executeNextCommand(node); } else if (result.getResult() == 1) { // General build error String errorMsg = result.getError(); // This is not an internal App Inventor bug. The error should be // reported in a yellow info box. ErrorReporter .reportInfo(MESSAGES.buildFailedError() + (errorMsg.isEmpty() ? "" : " " + errorMsg)); executionFailedOrCanceled(); } else if (result.getResult() == 2) { // Yail generation error String formName = extractFormName(result); ErrorReporter.reportError(MESSAGES.errorGeneratingYail(formName)); String blocksFileName = formName + YoungAndroidSourceAnalyzer.CODEBLOCKS_SOURCE_EXTENSION; YoungAndroidBlocksNode blocksNode = findBlocksNode((YoungAndroidProjectNode) node, blocksFileName); if (blocksNode != null) { showProblemBlocks(blocksNode); } executionFailedOrCanceled(); } else { // Build isn't done yet Timer timer = new Timer() { @Override public void run() { execute(node); } }; // TODO(user): Maybe do an exponential backoff here. timer.schedule(WAIT_INTERVAL_MILLIS); } } @Override public void onFailure(Throwable caught) { super.onFailure(caught); executionFailedOrCanceled(); } }; ode.getProjectService().getBuildResult(node.getProjectId(), target, callback); }