use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class RSAccountConnector method showShinyAppsDialog.
// Private methods --------------------------------------------------------
private void showShinyAppsDialog(final OperationWithInput<Boolean> onCompleted) {
RSConnectCloudDialog dialog = new RSConnectCloudDialog(new ProgressOperationWithInput<NewRSConnectAccountResult>() {
@Override
public void execute(NewRSConnectAccountResult input, ProgressIndicator indicator) {
processDialogResult(input, indicator, onCompleted);
}
}, new Operation() {
@Override
public void execute() {
onCompleted.execute(false);
}
});
dialog.showModal();
}
use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class OptionsLoader method showOptions.
public void showOptions(final Class<?> paneClass) {
final ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Error Reading Options");
indicator.onProgress("Reading options...");
server_.getRPrefs(new SimpleRequestCallback<RPrefs>() {
@Override
public void onResponseReceived(RPrefs rPrefs) {
indicator.onCompleted();
PreferencesDialog prefDialog = pPrefDialog_.get();
prefDialog.initialize(rPrefs);
if (paneClass != null)
prefDialog.activatePane(paneClass);
prefDialog.showModal();
// if the user changes global sweave or latex options notify
// them if this results in the current project being out
// of sync with the global settings
new SweaveProjectOptionsNotifier(prefDialog);
// the mac you can actually show prefs from a satellite window)
if (Desktop.isDesktop())
Desktop.getFrame().bringMainFrameToFront();
}
@Override
public void onError(ServerError error) {
indicator.onError(error.getUserMessage());
}
});
}
use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class EnvironmentPresenter method onOpenDataFile.
public void onOpenDataFile(OpenDataFileEvent event) {
final String dataFilePath = event.getFile().getPath();
globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Load RData", "Do you want to load the R data file \"" + dataFilePath + "\" " + "into the global environment?", new ProgressOperation() {
public void execute(ProgressIndicator indicator) {
consoleDispatcher_.executeCommand("load", FileSystemItem.createFile(dataFilePath));
indicator.onCompleted();
}
}, true);
}
use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class DataImportOptionsUiCsv method initEvents.
void initEvents() {
ValueChangeHandler<String> valueChangeHandler = new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> arg0) {
updateEnabled();
triggerChange();
}
};
ChangeHandler changeHandler = new ChangeHandler() {
@Override
public void onChange(ChangeEvent arg0) {
updateEnabled();
triggerChange();
}
};
ChangeHandler delimChangeHandler = new ChangeHandler() {
@Override
public void onChange(ChangeEvent arg0) {
if (delimiterListBox_.getSelectedValue() == "other") {
globalDisplay_.promptForTextWithOption("Other Delimiter", "Please enter a single character delimiter.", "", false, "", false, new ProgressOperationWithInput<PromptWithOptionResult>() {
private void dismissAndUpdate(ProgressIndicator indicator, int newSelectIndex) {
lastDelimiterListBoxIndex_ = newSelectIndex;
delimiterListBox_.setSelectedIndex(newSelectIndex);
indicator.onCompleted();
updateEnabled();
triggerChange();
}
@Override
public void execute(PromptWithOptionResult result, ProgressIndicator indicator) {
String otherDelimiter = result.input;
if (otherDelimiter.length() != 1) {
globalDisplay_.showErrorMessage("Incorrect Delimiter", "The specified delimiter is not valid.");
} else {
for (int idxDelimiter = 0; idxDelimiter < delimiterListBox_.getItemCount(); idxDelimiter++) {
if (delimiterListBox_.getValue(idxDelimiter) == otherDelimiter) {
dismissAndUpdate(indicator, idxDelimiter);
return;
}
}
int selectedIndex = delimiterListBox_.getSelectedIndex();
delimiterListBox_.insertItem("Character " + otherDelimiter, otherDelimiter, selectedIndex - 1);
dismissAndUpdate(indicator, selectedIndex - 1);
}
}
}, new Operation() {
@Override
public void execute() {
delimiterListBox_.setSelectedIndex(lastDelimiterListBoxIndex_);
updateEnabled();
triggerChange();
}
});
} else {
lastDelimiterListBoxIndex_ = delimiterListBox_.getSelectedIndex();
updateEnabled();
triggerChange();
}
}
};
ValueChangeHandler<Boolean> booleanValueChangeHandler = new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> arg0) {
updateEnabled();
triggerChange();
}
};
nameTextBox_.addValueChangeHandler(valueChangeHandler);
delimiterListBox_.addChangeHandler(delimChangeHandler);
quotesListBox_.addChangeHandler(changeHandler);
escapeListBox_.addChangeHandler(changeHandler);
columnNamesCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
trimSpacesCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
openDataViewerCheckBox_.addValueChangeHandler(booleanValueChangeHandler);
naListBox_.addChangeHandler(changeHandler);
commentListBox_.addChangeHandler(changeHandler);
skipTextBox_.addValueChangeHandler(valueChangeHandler);
localeButton_.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
new DataImportOptionsUiCsvLocale(new OperationWithInput<DataImportOptionsCsvLocale>() {
@Override
public void execute(final DataImportOptionsCsvLocale result) {
localeInfo_ = result;
updateEnabled();
triggerChange();
}
}, localeInfo_).showModal();
}
});
}
use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.
the class Plots method onSavePlotAsImage.
void onSavePlotAsImage() {
view_.bringToFront();
final ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Error");
indicator.onProgress("Preparing to export plot...");
// get the default directory
FileSystemItem defaultDir = ExportPlotUtils.getDefaultSaveDirectory(workbenchContext_.getCurrentWorkingDir());
// get context
server_.getSavePlotContext(defaultDir.getPath(), new SimpleRequestCallback<SavePlotAsImageContext>() {
@Override
public void onResponseReceived(SavePlotAsImageContext context) {
indicator.onCompleted();
exportPlot_.savePlotAsImage(globalDisplay_, server_, context, ExportPlotOptions.adaptToSize(uiPrefs_.get().exportPlotOptions().getValue(), getPlotSize()), saveExportOptionsOperation_);
}
@Override
public void onError(ServerError error) {
indicator.onError(error.getUserMessage());
}
});
}
Aggregations