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_);
}
}
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);
}
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);
}
}
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;
}
}
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);
}
Aggregations