use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class Presentation method confirmClose.
public void confirmClose(Command onConfirmed) {
// don't allow close if this is a tutorial
if (currentState_.isTutorial()) {
globalDisplay_.showMessage(MessageDisplay.MSG_WARNING, "Unable to Close", "Tutorials cannot be closed");
return;
}
final ProgressIndicator progress = new GlobalProgressDelayer(globalDisplay_, 0, "Closing Presentation...").getIndicator();
server_.closePresentationPane(new ServerRequestCallback<Void>() {
@Override
public void onResponseReceived(Void resp) {
reloadWorkbench();
}
@Override
public void onError(ServerError error) {
progress.onError(error.getUserMessage());
}
});
}
use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class Presentation method onTutorialFeedback.
@Handler
void onTutorialFeedback() {
EditDialog editDialog = new EditDialog("Provide Feedback", "Submit", "", false, true, new Size(450, 300), new ProgressOperationWithInput<String>() {
@Override
public void execute(String input, ProgressIndicator indicator) {
if (input == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving feedback...");
server_.tutorialFeedback(input, new VoidServerRequestCallback(indicator));
}
});
editDialog.showModal();
}
use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class Presentation method onPresentationSaveAsStandalone.
@Handler
void onPresentationSaveAsStandalone() {
// determine the default file name
if (saveAsStandaloneDefaultPath_ == null) {
FileSystemItem presFilePath = FileSystemItem.createFile(currentState_.getFilePath());
saveAsStandaloneDefaultPath_ = FileSystemItem.createFile(presFilePath.getParentPath().completePath(presFilePath.getStem() + ".html"));
}
fileDialogs_.saveFile("Save Presentation As", fileSystemContext_, saveAsStandaloneDefaultPath_, ".html", false, new ProgressOperationWithInput<FileSystemItem>() {
@Override
public void execute(final FileSystemItem targetFile, ProgressIndicator indicator) {
if (targetFile == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving Presentation...");
server_.createStandalonePresentation(targetFile.getPath(), new VoidServerRequestCallback(indicator) {
@Override
public void onSuccess() {
saveAsStandaloneDefaultPath_ = targetFile;
}
});
}
});
}
use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class Source method onNewRPresentationDoc.
@Handler
public void onNewRPresentationDoc() {
dependencyManager_.withRMarkdown("Authoring R Presentations", new Command() {
@Override
public void execute() {
fileDialogs_.saveFile("New R Presentation", fileContext_, workbenchContext_.getDefaultFileDialogDir(), ".Rpres", true, new ProgressOperationWithInput<FileSystemItem>() {
@Override
public void execute(final FileSystemItem input, final ProgressIndicator indicator) {
if (input == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Creating Presentation...");
server_.createNewPresentation(input.getPath(), new VoidServerRequestCallback(indicator) {
@Override
public void onSuccess() {
openFile(input, FileTypeRegistry.RPRESENTATION, new CommandWithArg<EditingTarget>() {
@Override
public void execute(EditingTarget arg) {
server_.showPresentationPane(input.getPath(), new VoidServerRequestCallback());
}
});
}
});
}
});
}
});
}
use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class WebTextInput method promptForTextWithOption.
@Override
public void promptForTextWithOption(String title, String label, String initialValue, final boolean usePasswordMask, String extraOptionPrompt, boolean extraOptionDefault, int selectionStart, int selectionLength, String okButtonCaption, final ProgressOperationWithInput<PromptWithOptionResult> okOperation, Operation cancelOperation) {
// This variable introduces a level of pointer indirection that lets us
// get around passing TextEntryModalDialog a reference to itself in its
// own constructor.
final Value<TextEntryModalDialog> pDialog = new Value<TextEntryModalDialog>(null);
final TextEntryModalDialog dialog = new TextEntryModalDialog(title, label, initialValue, usePasswordMask, extraOptionPrompt, extraOptionDefault, false, selectionStart, selectionLength, okButtonCaption, 300, new ProgressOperationWithInput<String>() {
@Override
public void execute(String input, ProgressIndicator indicator) {
PromptWithOptionResult result = new PromptWithOptionResult();
result.input = input;
result.extraOption = pDialog.getValue().getExtraOption();
okOperation.execute(result, indicator);
}
}, cancelOperation) {
@Override
protected void positionAndShowDialog(final Command onCompleted) {
setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
int left = (Window.getClientWidth() / 2) - (offsetWidth / 2);
int top = (Window.getClientHeight() / 2) - (offsetHeight / 2);
if (usePasswordMask)
top = 50;
setPopupPosition(left, top);
onCompleted.execute();
}
});
}
};
pDialog.setValue(dialog, false);
dialog.showModal();
}
Aggregations