use of com.vaadin.flow.data.renderer.ComponentRenderer in project komunumo-server by komunumo.
the class MailTemplateSetting method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(MailTemplateRecord::getId).setHeader("ID").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(MailTemplateRecord::getSubject).setHeader("Subject").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(new ComponentRenderer<>(mailTemplateRecord -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showEditDialog(mailTemplateRecord));
editButton.setTitle("Edit this mail template");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteMailTemplate(mailTemplateRecord));
deleteButton.setTitle("Delete this mail template");
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 RedirectSetting method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(RedirectRecord::getOldUrl).setHeader("Old URL").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(RedirectRecord::getNewUrl).setHeader("New URL").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(new ComponentRenderer<>(redirectRecord -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showEditDialog(redirectRecord));
editButton.setTitle("Edit this location color setting");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteRedirect(redirectRecord));
deleteButton.setTitle("Delete this location color setting");
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 RegistrationsDialog method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addClassName("registration-dialog");
grid.addColumn(new ComponentRenderer<>(registrationListEntity -> new Anchor("mailto:" + registrationListEntity.email(), registrationListEntity.fullName()))).setHeader("Attendee").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(new LocalDateTimeRenderer<>(RegistrationListEntity::date, FormatterUtil.dateTimeFormatter())).setHeader("Registration date").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(RegistrationListEntity::source).setHeader("Source").setAutoWidth(true).setFlexGrow(0);
if (event.getDate().isBefore(LocalDateTime.now())) {
grid.addColumn(new ComponentRenderer<>(registrationListEntity -> new Icon(registrationListEntity.noShow() ? VaadinIcon.CLOSE_CIRCLE_O : VaadinIcon.CHECK_CIRCLE_O))).setHeader("No show").setTextAlign(ColumnTextAlign.CENTER).setAutoWidth(true).setFlexGrow(0);
}
grid.addColumn(new ComponentRenderer<>(registrationListEntity -> {
final var deregisterButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deregister(registrationListEntity));
deregisterButton.setTitle("Deregister this attendee");
deregisterButton.setEnabled(event.getDate() != null && event.getDate().isAfter(LocalDateTime.now()));
return deregisterButton;
})).setHeader("Actions").setAutoWidth(true).setFlexGrow(0);
grid.setWidthFull();
grid.setHeightFull();
}
use of com.vaadin.flow.data.renderer.ComponentRenderer in project komunumo-server by komunumo.
the class FaqView method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(FaqRecord::getQuestion).setHeader("Question").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(new ComponentRenderer<>(faqRecord -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showEditDialog(faqRecord));
editButton.setTitle("Edit this entry");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteEntry(faqRecord));
deleteButton.setTitle("Delete this entry");
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 SpeakersView method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(LitRenderer.<SpeakerListEntity>of("<span style=\"font-weight: bold;\">${item.fullName}</span><br/>" + "<a href=\"${item.website}\" target=\"_blank\" title=\"${item.title}\">${item.company}</a>").withProperty("fullName", SpeakerListEntity::fullName).withProperty("company", speakerListEntity -> FormatterUtil.formatString(speakerListEntity.company(), 50)).withProperty("title", SpeakerListEntity::company).withProperty("website", SpeakerListEntity::website)).setHeader("Name & Company").setAutoWidth(true).setFlexGrow(1);
grid.addColumn(LitRenderer.<SpeakerListEntity>of("<a href=\"mailto:${item.email}\" target=\"_blank\">${item.email}</a>").withProperty("email", SpeakerListEntity::email)).setHeader("Email").setAutoWidth(true).setFlexGrow(0).setKey("email");
grid.addColumn(LitRenderer.<SpeakerListEntity>of("<a href=\"https://twitter.com/${item.twitter}\" target=\"_blank\" title=\"${item.twitter}\">${item.twitter}</a>").withProperty("twitter", SpeakerListEntity::twitter)).setHeader("Twitter").setAutoWidth(true).setFlexGrow(0).setKey("twitter");
final var eventCountRenderer = LitRenderer.<SpeakerListEntity>of("<a href=\"/admin/events?filter=${item.filterValue}\">${item.eventCount}</a>").withProperty("eventCount", SpeakerListEntity::eventCount).withProperty("filterValue", speakerListEntity -> URLEncoder.encode(speakerListEntity.fullName(), UTF_8));
grid.addColumn(eventCountRenderer).setHeader("Events").setAutoWidth(true).setTextAlign(ColumnTextAlign.CENTER).setFlexGrow(0);
grid.addColumn(new ComponentRenderer<>(speakerListEntity -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showSpeakerDialog(speakerListEntity));
editButton.setTitle("Edit this speaker");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteSpeaker(speakerListEntity));
deleteButton.setTitle("Delete this speaker");
deleteButton.setEnabled(speakerListEntity.eventCount() == 0);
return new HorizontalLayout(editButton, deleteButton);
})).setHeader("Actions").setAutoWidth(true).setFlexGrow(0);
grid.setHeightFull();
}
Aggregations