Search in sources :

Example 1 with TransferStatusGrid

use of org.karnak.frontend.monitoring.component.TransferStatusGrid 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);
}
Also used : ExportSettingsDialog(org.karnak.frontend.monitoring.component.ExportSettingsDialog) Anchor(com.vaadin.flow.component.html.Anchor) StreamResource(com.vaadin.flow.server.StreamResource) Button(com.vaadin.flow.component.button.Button) ByteArrayInputStream(java.io.ByteArrayInputStream) TransferStatusGrid(org.karnak.frontend.monitoring.component.TransferStatusGrid) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Aggregations

Button (com.vaadin.flow.component.button.Button)1 Anchor (com.vaadin.flow.component.html.Anchor)1 Icon (com.vaadin.flow.component.icon.Icon)1 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)1 StreamResource (com.vaadin.flow.server.StreamResource)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ExportSettingsDialog (org.karnak.frontend.monitoring.component.ExportSettingsDialog)1 TransferStatusGrid (org.karnak.frontend.monitoring.component.TransferStatusGrid)1