Search in sources :

Example 1 with EnhancedDialog

use of com.vaadin.componentfactory.EnhancedDialog in project TJ-Bot by Together-Java.

the class StreamedView method onChangeColumns.

private void onChangeColumns(ClickEvent<Button> event) {
    final EnhancedDialog dialog = new EnhancedDialog();
    dialog.setHeader("Choose the Columns you want to see.");
    final Set<String> columns = this.grid.getGrid().getColumns().stream().map(Grid.Column::getKey).collect(Collectors.toSet());
    final List<Checkbox> checkBoxes = new ArrayList<>();
    final List<String> fields = Arrays.asList(LogEventsConstants.FIELD_INSTANT, LogEventsConstants.FIELD_THREAD, LogEventsConstants.FIELD_LOGGER_LEVEL, LogEventsConstants.FIELD_LOGGER_NAME, LogEventsConstants.FIELD_MESSAGE, LogEventsConstants.FIELD_LOGGER_FQCN);
    for (String field : fields) {
        Checkbox c = new Checkbox(field);
        c.setValue(columns.contains(c.getLabel()));
        checkBoxes.add(c);
    }
    dialog.setContent(checkBoxes.toArray(Component[]::new));
    dialog.setFooter(new Button("Accept", evt -> this.onOkay(dialog, checkBoxes)), new Button("Cancel", e -> dialog.close()));
    dialog.open();
}
Also used : AllowedRoles(org.togetherjava.tjbot.logwatcher.accesscontrol.AllowedRoles) LogUtils(org.togetherjava.tjbot.logwatcher.util.LogUtils) MainLayout(org.togetherjava.tjbot.logwatcher.views.MainLayout) java.util(java.util) CssImport(com.vaadin.flow.component.dependency.CssImport) LogRepository(org.togetherjava.tjbot.logwatcher.logs.LogRepository) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) LocalDateTime(java.time.LocalDateTime) com.vaadin.flow.component(com.vaadin.flow.component) SessionDestroyEvent(com.vaadin.flow.server.SessionDestroyEvent) PageTitle(com.vaadin.flow.router.PageTitle) Route(com.vaadin.flow.router.Route) ZoneOffset(java.time.ZoneOffset) Grid(com.vaadin.flow.component.grid.Grid) PermitAll(javax.annotation.security.PermitAll) StreamWatcher(org.togetherjava.tjbot.logwatcher.watcher.StreamWatcher) LogEventsConstants(org.togetherjava.tjbot.logwatcher.constants.LogEventsConstants) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) Logevents(org.togetherjava.tjbot.db.generated.tables.pojos.Logevents) Collectors(java.util.stream.Collectors) GridCrud(org.vaadin.crudui.crud.impl.GridCrud) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) LocalDateTimeRenderer(com.vaadin.flow.data.renderer.LocalDateTimeRenderer) Button(com.vaadin.flow.component.button.Button) EnhancedDialog(com.vaadin.componentfactory.EnhancedDialog) VaadinService(com.vaadin.flow.server.VaadinService) DateTimeFormatter(java.time.format.DateTimeFormatter) Role(org.togetherjava.tjbot.logwatcher.accesscontrol.Role) Button(com.vaadin.flow.component.button.Button) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Grid(com.vaadin.flow.component.grid.Grid) EnhancedDialog(com.vaadin.componentfactory.EnhancedDialog)

Aggregations

EnhancedDialog (com.vaadin.componentfactory.EnhancedDialog)1 com.vaadin.flow.component (com.vaadin.flow.component)1 Button (com.vaadin.flow.component.button.Button)1 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)1 CssImport (com.vaadin.flow.component.dependency.CssImport)1 Grid (com.vaadin.flow.component.grid.Grid)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)1 LocalDateTimeRenderer (com.vaadin.flow.data.renderer.LocalDateTimeRenderer)1 PageTitle (com.vaadin.flow.router.PageTitle)1 Route (com.vaadin.flow.router.Route)1 SessionDestroyEvent (com.vaadin.flow.server.SessionDestroyEvent)1 VaadinService (com.vaadin.flow.server.VaadinService)1 LocalDateTime (java.time.LocalDateTime)1 ZoneOffset (java.time.ZoneOffset)1 DateTimeFormatter (java.time.format.DateTimeFormatter)1 java.util (java.util)1 Collectors (java.util.stream.Collectors)1 PermitAll (javax.annotation.security.PermitAll)1 Logevents (org.togetherjava.tjbot.db.generated.tables.pojos.Logevents)1