use of org.karnak.frontend.monitoring.component.ExportSettingsDialog in project karnak by OsiriX-Foundation.
the class MonitoringView method buildComponents.
/**
* Build components
*/
private void buildComponents() {
// Paginated Grid + data provider
transferStatusGrid = new TransferStatusGrid(transferStatusDataProvider);
transferStatusDataProvider.setFilter(transferStatusGrid.getTransferStatusFilter());
transferStatusGrid.setDataProvider(transferStatusDataProvider);
// Refresh button
refreshGridButton = new Button("Refresh", new Icon(VaadinIcon.REFRESH));
refreshGridButton.addClickListener(buttonClickEvent -> transferStatusDataProvider.refreshAll());
refreshGridButton.setWidthFull();
// Export Settings Dialog
exportSettingsDialog = new ExportSettingsDialog();
// Export Settings Button
exportSettingsButton = new Button("Export Settings", new Icon(VaadinIcon.COGS));
exportSettingsButton.setWidthFull();
exportSettingsButton.addClickListener(buttonClickEvent -> exportSettingsDialog.open());
// Export button
StreamResource streamResource = new StreamResource("export.csv", () -> new ByteArrayInputStream(monitoringLogic.buildCsv(exportSettingsDialog.getExportSettings())));
exportAnchor = new Anchor(streamResource, "");
exportAnchor.setWidthFull();
Button exportButton = new Button("Export", new Icon(VaadinIcon.DOWNLOAD_ALT));
exportButton.setWidthFull();
exportAnchor.getElement().setAttribute("download", true);
exportAnchor.add(exportButton);
}
Aggregations