Search in sources :

Example 21 with H2

use of com.vaadin.flow.component.html.H2 in project isis-lab by apache-isis-committers.

the class _SideMenuLayout method createDrawerContent.

Component createDrawerContent(final Iterable<MenuItemInfo> menuItems) {
    H2 appName = new H2("isis-lab-experiments-layout-sidemenu");
    appName.addClassNames("flex", "items-center", "h-xl", "m-0", "px-m", "text-m");
    com.vaadin.flow.component.html.Section section = new com.vaadin.flow.component.html.Section(appName, createNavigation(menuItems), createFooter());
    section.addClassNames("flex", "flex-col", "items-stretch", "max-h-full", "min-h-full");
    return section;
}
Also used : H2(com.vaadin.flow.component.html.H2)

Example 22 with H2

use of com.vaadin.flow.component.html.H2 in project docs by vaadin.

the class DialogDraggable method createHeaderLayout.

private static H2 createHeaderLayout() {
    // tag::snippet2[]
    H2 headline = new H2("Add note");
    headline.addClassName("draggable");
    // end::snippet2[]
    headline.getStyle().set("margin", "0").set("font-size", "1.5em").set("font-weight", "bold").set("cursor", "move").set("padding", "var(--lumo-space-m) 0").set("flex", "1");
    return headline;
}
Also used : H2(com.vaadin.flow.component.html.H2)

Example 23 with H2

use of com.vaadin.flow.component.html.H2 in project komunumo-server by komunumo.

the class MemberValidationView method beforeEnter.

@Override
public void beforeEnter(@NotNull final BeforeEnterEvent event) {
    Paragraph message;
    try {
        final var params = event.getLocation().getQueryParameters().getParameters();
        final var email = params.get("email").get(0);
        final var code = params.get("code").get(0);
        securityService.activate(email, code);
        message = new Paragraph("Your email address was successfully validated.");
        message.addClassName("successful");
    } catch (final BadCredentialsException e) {
        message = new Paragraph("The link was invalid. Please check your email for a working validation link.");
        message.addClassName("failed");
    }
    setContent(new Div(new H2("Validation"), message, new RouterLink("Back to home page", HomeView.class)));
}
Also used : Div(com.vaadin.flow.component.html.Div) RouterLink(com.vaadin.flow.router.RouterLink) H2(com.vaadin.flow.component.html.H2) BadCredentialsException(org.springframework.security.authentication.BadCredentialsException) Paragraph(com.vaadin.flow.component.html.Paragraph)

Example 24 with H2

use of com.vaadin.flow.component.html.H2 in project komunumo-server by komunumo.

the class MembersView method createFeedbackForm.

private Component createFeedbackForm() {
    final var div = new Div();
    div.addClassName("feedback-form");
    div.add(new H2("Your Feedback, suggestion, idea..."));
    final var firstName = new TextField("First name");
    firstName.setMinLength(1);
    firstName.setMaxLength(2_000);
    final var lastName = new TextField("Last name");
    lastName.setMinLength(1);
    lastName.setMaxLength(2_000);
    final var email = new EmailField("Email");
    email.setMinLength(1);
    email.setMaxLength(2_000);
    final var feedback = new TextArea("Feedback");
    feedback.setMinLength(1);
    feedback.setMaxLength(2_000);
    final var submit = new Button("Send");
    submit.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
    submit.setEnabled(false);
    submit.setDisableOnClick(true);
    List.of(firstName, lastName, email, feedback).forEach(field -> {
        field.setRequiredIndicatorVisible(true);
        field.setValueChangeMode(ValueChangeMode.EAGER);
        field.addValueChangeListener(valueChangeEvent -> submit.setEnabled(!firstName.getValue().isBlank() && !lastName.getValue().isBlank() && !email.isInvalid() && !feedback.getValue().isBlank()));
    });
    final var form = new FormLayout();
    form.setResponsiveSteps(new FormLayout.ResponsiveStep("0", 1));
    form.add(firstName, lastName, email, feedback, submit);
    div.add(form);
    submit.addClickListener(buttonClickEvent -> {
        databaseService.receiveFeedback(firstName.getValue(), lastName.getValue(), email.getValue(), feedback.getValue());
        div.replace(form, new Paragraph("We have received your feedback, thank you very much!"));
    });
    firstName.focus();
    return div;
}
Also used : Div(com.vaadin.flow.component.html.Div) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) TextArea(com.vaadin.flow.component.textfield.TextArea) Button(com.vaadin.flow.component.button.Button) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) H2(com.vaadin.flow.component.html.H2) Paragraph(com.vaadin.flow.component.html.Paragraph)

Example 25 with H2

use of com.vaadin.flow.component.html.H2 in project komunumo-server by komunumo.

the class NewsView method toNewsItem.

private static Component toNewsItem(@NotNull final NewsEntity newsEntity) {
    final var newsItem = new Article();
    newsItem.addClassName("news-item");
    final var createdDate = new Paragraph(formatDate(newsEntity.created().toLocalDate()));
    createdDate.addClassName("created-date");
    newsItem.add(createdDate);
    newsItem.add(new H2(newsEntity.title()));
    if (!newsEntity.subtitle().isBlank()) {
        newsItem.add(new H3(newsEntity.subtitle()));
    }
    final var teaser = new Paragraph(new Html("<div>%s</div>".formatted(newsEntity.teaser())));
    teaser.addClassName("teaser");
    newsItem.add(teaser);
    final var message = new Paragraph(new Html("<div>%s</div>".formatted(newsEntity.message())));
    message.addClassName("message");
    newsItem.add(message);
    return newsItem;
}
Also used : Article(com.vaadin.flow.component.html.Article) Html(com.vaadin.flow.component.Html) H2(com.vaadin.flow.component.html.H2) H3(com.vaadin.flow.component.html.H3) Paragraph(com.vaadin.flow.component.html.Paragraph)

Aggregations

H2 (com.vaadin.flow.component.html.H2)68 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)29 Div (com.vaadin.flow.component.html.Div)25 Grid (com.vaadin.flow.component.grid.Grid)11 ComboBox (com.vaadin.flow.component.combobox.ComboBox)10 Button (com.vaadin.flow.component.button.Button)8 Paragraph (com.vaadin.flow.component.html.Paragraph)7 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)7 Route (com.vaadin.flow.router.Route)6 List (java.util.List)6 IntStream (java.util.stream.IntStream)6 NativeButton (com.vaadin.flow.component.html.NativeButton)5 ArrayList (java.util.ArrayList)5 Html (com.vaadin.flow.component.Html)4 TextField (com.vaadin.flow.component.textfield.TextField)4 Faker (com.github.javafaker.Faker)3 ItemFilter (com.vaadin.flow.component.combobox.ComboBox.ItemFilter)3 Label (com.vaadin.flow.component.html.Label)3 CallbackDataProvider (com.vaadin.flow.data.provider.CallbackDataProvider)3 ComponentRenderer (com.vaadin.flow.data.renderer.ComponentRenderer)3