Search in sources :

Example 36 with Timer

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

the class ChunkRowExecState method setState.

public void setState(int state) {
    // ignore if already at this state
    if (state_ == state)
        return;
    // if the moving to the error state, clean other states
    if (state == LINE_ERROR)
        removeClazz();
    // if this is the error state, there's no transition to the resting state
    if (state_ == LINE_ERROR && state == LINE_RESTING)
        return;
    state_ = state;
    if (state_ == LINE_RESTING) {
        timer_ = new Timer() {

            @Override
            public void run() {
                addClazz(state_);
                scheduleDismiss();
            }
        };
        timer_.schedule(LINGER_MS);
    } else {
        addClazz(state_);
    }
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 37 with Timer

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

the class ChunkRowExecState method scheduleDismiss.

private void scheduleDismiss() {
    resetTimer();
    timer_ = new Timer() {

        @Override
        public void run() {
            detach();
        }
    };
    timer_.schedule(FADE_MS);
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 38 with Timer

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

the class ChunkDataWidget method initPagedTableOrDelay.

private void initPagedTableOrDelay() {
    if (pagedTableExists()) {
        pagedTable_ = showDataOutputNative(data_, getElement(), chunkOutputSize_ == ChunkOutputSize.Full);
        onDataOutputChange();
    } else {
        Timer t = new Timer() {

            public void run() {
                initPagedTableOrDelay();
            }
        };
        t.schedule(200);
    }
}
Also used : Timer(com.google.gwt.user.client.Timer)

Example 39 with Timer

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

the class MathJax method onMathJaxTypesetCompleted.

private void onMathJaxTypesetCompleted(final Object mathjaxElObject, final String text, final boolean error, final Object commandObject, final int attempt) {
    final Element mathjaxEl = (Element) mathjaxElObject;
    if (attempt < MAX_RENDER_ATTEMPTS) {
        // if mathjax displayed an error, try re-rendering once more
        Element[] errorEls = DomUtils.getElementsByClassName(mathjaxEl, "MathJax_Error");
        if (errorEls != null && errorEls.length > 0 && attempt < MAX_RENDER_ATTEMPTS) {
            // hide the error and retry in 25ms (experimentally this seems to
            // produce a better shot at rendering successfully than an immediate
            // or deferred retry)
            mathjaxEl.getStyle().setVisibility(Visibility.HIDDEN);
            new Timer() {

                @Override
                public void run() {
                    mathjaxTypeset(mathjaxEl, text, commandObject, attempt + 1);
                }
            }.schedule(25);
            return;
        }
    }
    // show whatever we've got (could be an error if we ran out of retries)
    mathjaxEl.getStyle().setVisibility(Visibility.VISIBLE);
    // execute callback
    if (commandObject != null && commandObject instanceof MathJaxTypesetCallback) {
        MathJaxTypesetCallback callback = (MathJaxTypesetCallback) commandObject;
        callback.onMathJaxTypesetComplete(error);
    }
    if (!error) {
        lastRenderedText_ = text;
    }
}
Also used : Timer(com.google.gwt.user.client.Timer) Element(com.google.gwt.dom.client.Element)

Example 40 with Timer

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

the class LocatorPanel method showFeedbackAt.

private void showFeedbackAt(Point p) {
    cancelFeedback();
    setWidgetTopHeight(feedbackImage_, p.getY() - FB_OFFSET_Y, Unit.PX, FB_HEIGHT, Unit.PX);
    setWidgetLeftWidth(feedbackImage_, p.getX() - FB_OFFSET_X, Unit.PX, FB_WIDTH, Unit.PX);
    forceLayout();
    feedbackImage_.setVisible(true);
    feedbackImage_.getElement().getStyle().setOpacity(1.0);
    feedbackTimer_ = new Timer() {

        @Override
        public void run() {
            feedbackTimer_ = null;
            ArrayList<Widget> widgets = new ArrayList<Widget>();
            widgets.add(feedbackImage_);
            feedbackAnimation_ = new FadeOutAnimation(widgets, new Command() {

                public void execute() {
                    feedbackAnimation_ = null;
                }
            });
            feedbackAnimation_.run(300);
        }
    };
    feedbackTimer_.schedule(700);
}
Also used : Timer(com.google.gwt.user.client.Timer) FadeOutAnimation(org.rstudio.core.client.layout.FadeOutAnimation) Command(com.google.gwt.user.client.Command) ArrayList(java.util.ArrayList)

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