use of com.vaadin.flow.data.renderer.ComponentRenderer in project komunumo-server by komunumo.
the class SponsorsView method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(TemplateRenderer.<SponsorEntity>of("<a style=\"font-weight: bold;\" href=\"[[item.website]]\" target=\"_blank\">[[item.name]]</a>").withProperty("name", SponsorEntity::name).withProperty("website", SponsorEntity::website)).setHeader("Name").setAutoWidth(true).setFlexGrow(1);
grid.addColumn(TemplateRenderer.<SponsorEntity>of("<img style=\"max-width: 100%;\" src=\"[[item.logo]]\" /></span>").withProperty("logo", SponsorEntity::logo)).setHeader("Logo").setWidth("96px").setFlexGrow(0);
grid.addColumn(SponsorEntity::level).setHeader("Level").setAutoWidth(true);
grid.addColumn(sponsorEntity -> formatDate(sponsorEntity.validFrom())).setHeader("Valid from").setAutoWidth(true).setFlexGrow(0).setKey("validFrom");
grid.addColumn(sponsorEntity -> formatDate(sponsorEntity.validTo())).setHeader("Valid to").setAutoWidth(true).setFlexGrow(0).setKey("validTo");
grid.addColumn(new ComponentRenderer<>(sponsorEntity -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showSponsorDialog(sponsorEntity));
editButton.setTitle("Edit this sponsor");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteSponsor(sponsorEntity));
deleteButton.setTitle("Delete this sponsor");
return new HorizontalLayout(editButton, deleteButton);
})).setHeader("Actions").setAutoWidth(true).setFlexGrow(0);
grid.setHeightFull();
}
use of com.vaadin.flow.data.renderer.ComponentRenderer in project komunumo-server by komunumo.
the class KeywordsView method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(KeywordListEntity::keyword).setHeader("Keyword").setAutoWidth(true).setFlexGrow(0).setKey("keyword");
grid.addColumn(KeywordListEntity::eventCount).setHeader("Events").setAutoWidth(true).setTextAlign(ColumnTextAlign.CENTER).setFlexGrow(0);
grid.addColumn(new ComponentRenderer<>(keyword -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showKeywordDialog(keyword));
editButton.setTitle("Edit this keyword");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteKeyword(keyword));
deleteButton.setTitle("Delete this keyword");
deleteButton.setEnabled(keyword.eventCount() == 0);
return new HorizontalLayout(editButton, deleteButton);
})).setHeader("Actions").setAutoWidth(true).setFlexGrow(0);
grid.setHeightFull();
}
use of com.vaadin.flow.data.renderer.ComponentRenderer in project komunumo-server by komunumo.
the class ConfigurationSetting method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(ConfigurationRecord::getKey).setHeader("Key").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(ConfigurationRecord::getValue).setHeader("Value").setAutoWidth(false).setFlexGrow(1);
grid.addColumn(new ComponentRenderer<>(configurationRecord -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showEditDialog(configurationRecord));
editButton.setTitle("Edit this configuration setting");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteConfiguration(configurationRecord));
deleteButton.setTitle("Delete this configuration setting");
return new HorizontalLayout(editButton, deleteButton);
})).setHeader("Actions").setAutoWidth(true).setFlexGrow(0);
grid.setHeightFull();
}
use of com.vaadin.flow.data.renderer.ComponentRenderer in project karnak by OsiriX-Foundation.
the class DicomEchoSelectionDialog method buildDicomNodeRenderer.
private ComponentRenderer<Div, ConfigNode> buildDicomNodeRenderer() {
return new ComponentRenderer<>(item -> {
Div div = new Div();
div.getStyle().set("line-height", "92%");
Span spanDescription = new Span(item.getName());
spanDescription.getStyle().set("font-weight", "500");
HtmlComponent htmlLineBreak = new HtmlComponent("BR");
Span spanOtherAttributes = new Span(item.getAet() + " | " + item.getHostname() + " | " + item.getPort());
spanOtherAttributes.getStyle().set("font-size", "75%");
div.add(spanDescription, htmlLineBreak, spanOtherAttributes);
return div;
});
}
use of com.vaadin.flow.data.renderer.ComponentRenderer in project furms by unity-idm.
the class AuditLogView method createCommunityGrid.
private Grid<AuditLogGridModel> createCommunityGrid() {
Grid<AuditLogGridModel> grid = new DenseGrid<>(AuditLogGridModel.class);
Column<AuditLogGridModel> timestamp = grid.addComponentColumn(model -> {
if (model.data.isEmpty())
return new Div(new Label(model.timestamp.format(dateTimeFormatter)));
Icon icon = grid.isDetailsVisible(model) ? ANGLE_DOWN.create() : ANGLE_RIGHT.create();
return new Div(icon, new Label(model.timestamp.format(dateTimeFormatter)));
}).setHeader(getTranslation("view.fenix-admin.audit-log.grid.1")).setSortable(true).setComparator(model -> model.timestamp);
grid.addColumn(model -> model.originator).setHeader(getTranslation("view.fenix-admin.audit-log.grid.2")).setSortable(true).setComparator(model -> model.originator);
grid.addColumn(model -> getTranslation("view.fenix-admin.audit-log.operation." + model.operation)).setHeader(getTranslation("view.fenix-admin.audit-log.grid.3")).setSortable(true).setComparator(comparing(model -> model.operation));
grid.addColumn(model -> getTranslation("view.fenix-admin.audit-log.action." + model.action)).setHeader(getTranslation("view.fenix-admin.audit-log.grid.4")).setSortable(true).setComparator(comparing(model -> model.action));
grid.addColumn(model -> model.name).setHeader(getTranslation("view.fenix-admin.audit-log.grid.5")).setSortable(true).setComparator(comparing(model -> model.name));
grid.addColumn(model -> model.id).setHeader(getTranslation("view.fenix-admin.audit-log.grid.6")).setSortable(true).setComparator(comparing(model -> model.id));
grid.sort(ImmutableList.of(new GridSortOrder<>(timestamp, SortDirection.DESCENDING)));
grid.setItemDetailsRenderer(new ComponentRenderer<>(c -> AuditLogDetailsComponentFactory.create(c.data)));
grid.setSelectionMode(Grid.SelectionMode.NONE);
return grid;
}
Aggregations