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();
}
Aggregations