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