Search in sources :

Example 31 with Timer

use of com.google.gwt.user.client.Timer in project rstudio by rstudio.

the class ApplicationClientInit method reloadWithDelay.

private void reloadWithDelay(int delayMs) {
    // need a delay so the server has time to fully process the
    // interrupt and go offline
    Timer delayTimer = new Timer() {

        public void run() {
            Window.Location.reload();
        }
    };
    delayTimer.schedule(delayMs);
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 32 with Timer

use of com.google.gwt.user.client.Timer in project rstudio by rstudio.

the class ProgressIndicatorDelay method onProgress.

@Override
public void onProgress(final String status, final Operation onCancel) {
    showing_ = true;
    if (firstUpdate_) {
        firstUpdate_ = false;
        new Timer() {

            @Override
            public void run() {
                if (showing_) {
                    progressIndicator_.onProgress(status, onCancel);
                }
            }
        }.schedule(startDelay_);
    } else {
        progressIndicator_.onProgress(status, onCancel);
    }
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 33 with Timer

use of com.google.gwt.user.client.Timer in project rstudio by rstudio.

the class DesktopHooks method evaluateRCmd.

void evaluateRCmd(final String cmd) {
    // inject a 100ms delay between execution of commands to prevent
    // issues with commands being delivered out of order by cocoa
    // networking to the server (it appears as if when you put e.g. 10
    // requests in flight simultaneously it's not guarnateed that they
    // will be received in the order they were sent).
    commandQueue_.addCommand(new SerializedCommand() {

        @Override
        public void onExecute(final Command continuation) {
            // execute the code
            events_.fireEvent(new SendToConsoleEvent(cmd, true));
            // wait 100ms to execute the next command in the queue
            new Timer() {

                @Override
                public void run() {
                    continuation.execute();
                }
            }.schedule(100);
            ;
        }
    });
    // make sure the queue is running
    commandQueue_.run();
}
Also used : SerializedCommand(org.rstudio.core.client.SerializedCommand) Timer(com.google.gwt.user.client.Timer) SerializedCommand(org.rstudio.core.client.SerializedCommand) AppCommand(org.rstudio.core.client.command.AppCommand) Command(com.google.gwt.user.client.Command) SendToConsoleEvent(org.rstudio.studio.client.workbench.views.console.events.SendToConsoleEvent)

Example 34 with Timer

use of com.google.gwt.user.client.Timer in project rstudio by rstudio.

the class ApplicationWindow method showSerializationProgress.

public void showSerializationProgress(String msg, boolean modal, int delayMs, int timeoutMs) {
    // hide any existing progress
    hideSerializationProgress();
    // create and show progress
    activeSerializationProgress_ = new ApplicationSerializationProgress(msg, modal, delayMs);
    // want to hide it)
    if (timeoutMs > 0) {
        final ApplicationSerializationProgress timeoutSerializationProgress = activeSerializationProgress_;
        new Timer() {

            @Override
            public void run() {
                if (timeoutSerializationProgress == activeSerializationProgress_)
                    hideSerializationProgress();
            }
        }.schedule(timeoutMs);
    }
}
Also used : Timer(com.google.gwt.user.client.Timer) ApplicationSerializationProgress(org.rstudio.studio.client.application.ui.serializationprogress.ApplicationSerializationProgress)

Example 35 with Timer

use of com.google.gwt.user.client.Timer in project rstudio by rstudio.

the class ChunkOutputWidget method toggleExpansionState.

private void toggleExpansionState(final boolean ensureVisible, final CommandWithArg<Boolean> onTransitionCompleted) {
    // (no simple way to gracefully reverse direction) 
    if (collapseTimer_ != null && collapseTimer_.isRunning())
        return;
    if (expansionState_.getValue() == EXPANDED) {
        // remove scrollbars
        frame_.getElement().getStyle().setProperty("transition", "height " + ANIMATION_DUR + "ms ease");
        setCollapsedStyles();
        collapseTimer_ = new Timer() {

            @Override
            public void run() {
                renderedHeight_ = ChunkOutputUi.CHUNK_COLLAPSED_HEIGHT;
                host_.onOutputHeightChanged(ChunkOutputWidget.this, renderedHeight_, ensureVisible);
                if (onTransitionCompleted != null)
                    onTransitionCompleted.execute(true);
            }
        };
        expansionState_.setValue(COLLAPSED, true);
    } else {
        clearCollapsedStyles();
        expansionState_.setValue(EXPANDED, true);
        syncHeight(true, ensureVisible);
        collapseTimer_ = new Timer() {

            @Override
            public void run() {
                syncHeight(true, ensureVisible);
                frame_.getElement().getStyle().clearProperty("transition");
                if (onTransitionCompleted != null)
                    onTransitionCompleted.execute(true);
            }
        };
    }
    collapseTimer_.schedule(ANIMATION_DUR);
}
Also used : Timer(com.google.gwt.user.client.Timer)

Aggregations

Timer (com.google.gwt.user.client.Timer)86 Command (com.google.gwt.user.client.Command)6 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)4 ServerError (org.rstudio.studio.client.server.ServerError)4 Element (com.google.gwt.dom.client.Element)3 SessionInfo (org.rstudio.studio.client.workbench.model.SessionInfo)3 Animation (com.google.gwt.animation.client.Animation)2 JsArray (com.google.gwt.core.client.JsArray)2 Style (com.google.gwt.dom.client.Style)2 Image (com.google.gwt.user.client.ui.Image)2 Label (com.google.gwt.user.client.ui.Label)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 Widget (com.google.gwt.user.client.ui.Widget)2 PatchMethod (com.googlecode.gwt.test.patchers.PatchMethod)2 TimerTask (java.util.TimerTask)2 Operation (org.eclipse.che.api.promises.client.Operation)2 Operation (org.rstudio.core.client.widget.Operation)2 InvalidSessionInfo (org.rstudio.studio.client.application.model.InvalidSessionInfo)2 ServerRequestCallback (org.rstudio.studio.client.server.ServerRequestCallback)2 Optional (com.google.common.base.Optional)1