use of org.activityinfo.shared.command.RenderElement in project activityinfo by bedatadriven.
the class ExportDialog method export.
public void export(String filename, ReportElement model, Format format) {
show();
bar.updateText(I18N.CONSTANTS.exportProgress());
bar.auto();
RenderElement command = new RenderElement(model, format);
command.setFilename(filename);
dispatcher.execute(command, new AsyncCallback<UrlResult>() {
@Override
public void onFailure(Throwable caught) {
MessageBox.alert(I18N.CONSTANTS.export(), I18N.CONSTANTS.serverError(), new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
ExportDialog.this.hide();
}
});
}
@Override
public void onSuccess(UrlResult result) {
if (!canceled) {
bar.reset();
bar.updateProgress(1.0, I18N.CONSTANTS.downloadReady());
button.setText(I18N.CONSTANTS.close());
tryStartDownloadWithIframe(result.getUrl());
downloadLink.getElement().setAttribute("href", result.getUrl());
downloadLink.setVisible(true);
layout(true);
}
}
});
}
Aggregations