Search in sources :

Example 56 with Icon

use of com.vaadin.flow.component.icon.Icon in project ArchCNL by Mari-Wie.

the class MappingEditorView method createTitleBar.

private HorizontalLayout createTitleBar(String mappingType) {
    final Label title = new Label("Create or edit a " + mappingType);
    title.setClassName("card-title-box--title");
    final Button closeButton = new Button(new Icon(VaadinIcon.CLOSE), click -> fireEvent(new MappingCloseButtonClicked(this, true)));
    final HorizontalLayout titleBar = new HorizontalLayout(title, closeButton);
    titleBar.setWidthFull();
    title.setWidthFull();
    titleBar.setDefaultVerticalComponentAlignment(Alignment.CENTER);
    return titleBar;
}
Also used : Button(com.vaadin.flow.component.button.Button) Label(com.vaadin.flow.component.html.Label) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) MappingCloseButtonClicked(org.archcnl.ui.inputview.rulesormappingeditorview.mappingeditor.events.MappingCloseButtonClicked) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 57 with Icon

use of com.vaadin.flow.component.icon.Icon 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();
}
Also used : ImageBanner(ar.com.fdvs.dj.domain.ImageBanner) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) Event(org.komunumo.data.entity.Event) CssImport(com.vaadin.flow.component.dependency.CssImport) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) PrintPreviewReport(org.vaadin.reports.PrintPreviewReport) LocalDateTime(java.time.LocalDateTime) EnhancedButton(org.komunumo.ui.component.EnhancedButton) FormatterUtil.formatDate(org.komunumo.util.FormatterUtil.formatDate) RegistrationListEntity(org.komunumo.data.entity.RegistrationListEntity) RegistrationListEntityWrapper(org.komunumo.data.entity.reports.RegistrationListEntityWrapper) ByteArrayInputStream(java.io.ByteArrayInputStream) UI(com.vaadin.flow.component.UI) EnhancedDialog(org.komunumo.ui.component.EnhancedDialog) Icon(com.vaadin.flow.component.icon.Icon) TextField(com.vaadin.flow.component.textfield.TextField) StreamRegistration(com.vaadin.flow.server.StreamRegistration) FormatterUtil(org.komunumo.util.FormatterUtil) VaadinSession(com.vaadin.flow.server.VaadinSession) Grid(com.vaadin.flow.component.grid.Grid) Anchor(com.vaadin.flow.component.html.Anchor) GridVariant(com.vaadin.flow.component.grid.GridVariant) UTF_8(java.nio.charset.StandardCharsets.UTF_8) StringWriter(java.io.StringWriter) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) CSVWriter(com.opencsv.CSVWriter) LocalDateTimeRenderer(com.vaadin.flow.data.renderer.LocalDateTimeRenderer) Nullable(org.jetbrains.annotations.Nullable) DatabaseService(org.komunumo.data.service.DatabaseService) ColumnTextAlign(com.vaadin.flow.component.grid.ColumnTextAlign) StreamResource(com.vaadin.flow.server.StreamResource) ConfirmDialog(com.vaadin.flow.component.confirmdialog.ConfirmDialog) NotNull(org.jetbrains.annotations.NotNull) Callback(org.komunumo.Callback) FilterField(org.komunumo.ui.component.FilterField) RegistrationListEntity(org.komunumo.data.entity.RegistrationListEntity) EnhancedButton(org.komunumo.ui.component.EnhancedButton) Anchor(com.vaadin.flow.component.html.Anchor) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) Icon(com.vaadin.flow.component.icon.Icon) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) LocalDateTimeRenderer(com.vaadin.flow.data.renderer.LocalDateTimeRenderer)

Example 58 with Icon

use of com.vaadin.flow.component.icon.Icon 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();
}
Also used : EnhancedButton(org.komunumo.ui.component.EnhancedButton) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) Icon(com.vaadin.flow.component.icon.Icon) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 59 with Icon

use of com.vaadin.flow.component.icon.Icon 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();
}
Also used : EnhancedButton(org.komunumo.ui.component.EnhancedButton) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) SpeakerListEntity(org.komunumo.data.entity.SpeakerListEntity) Icon(com.vaadin.flow.component.icon.Icon) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 60 with Icon

use of com.vaadin.flow.component.icon.Icon 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();
}
Also used : EnhancedButton(org.komunumo.ui.component.EnhancedButton) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) SponsorEntity(org.komunumo.data.entity.SponsorEntity) Icon(com.vaadin.flow.component.icon.Icon) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Aggregations

Icon (com.vaadin.flow.component.icon.Icon)110 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)94 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)46 Button (com.vaadin.flow.component.button.Button)39 Span (com.vaadin.flow.component.html.Span)21 Div (com.vaadin.flow.component.html.Div)19 ComponentRenderer (com.vaadin.flow.data.renderer.ComponentRenderer)18 Tab (com.vaadin.flow.component.tabs.Tab)16 Text (com.vaadin.flow.component.Text)15 Test (org.junit.Test)12 EnhancedButton (org.komunumo.ui.component.EnhancedButton)12 Grid (com.vaadin.flow.component.grid.Grid)10 RouterLink (com.vaadin.flow.router.RouterLink)9 Notification (com.vaadin.flow.component.notification.Notification)8 Component (com.vaadin.flow.component.Component)7 ColumnTextAlign (com.vaadin.flow.component.grid.ColumnTextAlign)7 Anchor (com.vaadin.flow.component.html.Anchor)7 TextField (com.vaadin.flow.component.textfield.TextField)7 UI (com.vaadin.flow.component.UI)6 StreamResource (com.vaadin.flow.server.StreamResource)6