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