use of org.rstudio.studio.client.workbench.views.environment.model.DataPreviewResult in project rstudio by rstudio.
the class ImportFileSettingsDialog method loadData.
private void loadData() {
final Token invalidationToken = updateRequest_.getInvalidationToken();
progress_.onProgress("Detecting data format");
server_.getDataPreview(dataFile_.getPath(), new ServerRequestCallback<DataPreviewResult>() {
@Override
public void onResponseReceived(DataPreviewResult response) {
input_.setHTML(toInputHtml(response));
if (invalidationToken.isInvalid())
return;
progress_.onProgress(null);
populateOutput(response);
if (response.hasHeader())
headingYes_.setValue(true);
else
headingNo_.setValue(true);
selectByValue(separator_, response.getSeparator());
selectByValue(decimal_, response.getDecimal());
selectByValue(quote_, response.getQuote());
selectByValue(comment_, response.getComment());
defaultStringsAsFactors_ = response.getDefaultStringsAsFactors();
stringsAsFactors_.setValue(defaultStringsAsFactors_);
}
@Override
public void onError(ServerError error) {
if (invalidationToken.isInvalid())
return;
progress_.onProgress(null);
globalDisplay_.showErrorMessage("Error", error.getUserMessage());
}
});
}
use of org.rstudio.studio.client.workbench.views.environment.model.DataPreviewResult in project rstudio by rstudio.
the class ImportFileSettingsDialog method updateOutput.
private void updateOutput() {
if (separator_.getSelectedIndex() < 0 || quote_.getSelectedIndex() < 0 || decimal_.getSelectedIndex() < 0) {
return;
}
updateRequest_.invalidate();
final Token invalidationToken = updateRequest_.getInvalidationToken();
progress_.onProgress("Updating preview");
server_.getOutputPreview(dataFile_.getPath(), encoding_.getValue(encoding_.getSelectedIndex()), headingYes_.getValue().booleanValue(), separator_.getValue(separator_.getSelectedIndex()), decimal_.getValue(decimal_.getSelectedIndex()), quote_.getValue(quote_.getSelectedIndex()), comment_.getValue(comment_.getSelectedIndex()), new ServerRequestCallback<DataPreviewResult>() {
@Override
public void onResponseReceived(DataPreviewResult response) {
if (invalidationToken.isInvalid())
return;
progress_.onProgress(null);
populateOutput(response);
}
@Override
public void onError(ServerError error) {
if (invalidationToken.isInvalid())
return;
progress_.onProgress(null);
globalDisplay_.showErrorMessage("Error", error.getUserMessage());
}
});
}
Aggregations