Search in sources :

Example 1 with Icon

use of com.vaadin.flow.component.icon.Icon in project karnak by OsiriX-Foundation.

the class ProfileComponent method createDownloadButton.

public void createDownloadButton(ProfileEntity profileEntity) {
    final StreamResource profileStreamResource = createStreamResource(profileEntity);
    download = new Anchor(profileStreamResource, "");
    download.getElement().setAttribute("download", true);
    download.add(new Button(new Icon(VaadinIcon.DOWNLOAD_ALT)));
    download.getStyle().set("margin-top", "30px");
}
Also used : Anchor(com.vaadin.flow.component.html.Anchor) StreamResource(com.vaadin.flow.server.StreamResource) Button(com.vaadin.flow.component.button.Button) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Example 2 with Icon

use of com.vaadin.flow.component.icon.Icon in project karnak by OsiriX-Foundation.

the class ProfileComponent method createDeleteButton.

private void createDeleteButton(ProfileEntity profileEntity) {
    deleteButton = new Button((new Icon(VaadinIcon.TRASH)));
    deleteButton.setWidth("100%");
    deleteButton.addThemeVariants(ButtonVariant.LUMO_ERROR, ButtonVariant.LUMO_PRIMARY);
    deleteButton.getStyle().set("margin-top", "34px");
    deleteButton.addClickListener(buttonClickEvent -> {
        if (profileEntity.getProjectEntities() != null && !profileEntity.getProjectEntities().isEmpty()) {
            dialogWarning.setText(profileEntity);
            dialogWarning.open();
        } else {
            profileLogic.deleteProfile(profileEntity);
            removeAll();
        }
    });
}
Also used : Button(com.vaadin.flow.component.button.Button) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Example 3 with Icon

use of com.vaadin.flow.component.icon.Icon in project projecte-dam-v2-equip2 by IESEBRE.

the class MainLayout method createHeader.

private void createHeader() {
    H1 logo = new H1("");
    logo.addClassNames("text-l", "m-m");
    Image logo1 = new Image("https://i.ibb.co/52282JQ/Pi-Story-Cheek.png", "a");
    logo1.setHeight(56, Unit.PIXELS);
    logo1.setWidth(106, Unit.PIXELS);
    logo1.addClickListener(e -> {
        UI.getCurrent().navigate(ListView.class);
    });
    addToNavbar(logo1);
    HorizontalLayout header = new HorizontalLayout(logo);
    header.setWidth("70%");
    header.addClassNames("py-0", "px-m");
    addToNavbar(header);
    logo.addClickListener(e -> {
        UI.getCurrent().navigate(ListView.class);
    });
    if (user != null) {
        Button add = new Button("Add", new Icon(VaadinIcon.PLUS_CIRCLE));
        add.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
        add.setWidth("10%");
        addToNavbar(add);
        add.addClickListener(e -> {
            UI.getCurrent().navigate("uploadImatge");
        });
        Button logout = new Button("Logout", new Icon(VaadinIcon.OUT));
        logout.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
        logout.setWidth("10%");
        addToNavbar(logout);
        logout.addClickListener(e -> {
            UI.getCurrent().getPage().setLocation("login");
            VaadinSession.getCurrent().getSession().invalidate();
            VaadinSession.getCurrent().close();
        });
    } else {
        Button login = new Button("Login", new Icon(VaadinIcon.USER));
        login.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
        login.setWidth("10%");
        addToNavbar(login);
        login.addClickListener(e -> {
            UI.getCurrent().navigate("login");
        });
    }
}
Also used : Button(com.vaadin.flow.component.button.Button) H1(com.vaadin.flow.component.html.H1) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Image(com.vaadin.flow.component.html.Image) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 4 with Icon

use of com.vaadin.flow.component.icon.Icon in project flow-viritin by viritin.

the class Tree method editChild.

/**
 * Edits child in UI.
 *
 * @param item the item to be edited in the UI
 */
public void editChild(T item) {
    TreeItem treeItem = domainObjectToTreeItem.get(item);
    Span nodeContent = (Span) treeItem.getNodeContent();
    Optional<Component> optIcon = treeItem.getNodeContent().getChildren().filter(c -> c instanceof Icon).findFirst();
    Optional<Component> optSpan = treeItem.getNodeContent().getChildren().filter(c -> c instanceof Span).findFirst();
    if (optIcon.isPresent() && optSpan.isPresent()) {
        Icon icon = (Icon) optIcon.get();
        Span span = (Span) optSpan.get();
        nodeContent.remove(icon);
        nodeContent.remove(span);
        span.getChildren().filter(cc -> cc instanceof Text).findFirst().ifPresent(cc -> {
            ((Text) cc).setText(itemLabelGenerator.apply(item));
        });
        nodeContent.add(itemIconGenerator.apply(item));
        nodeContent.add(span);
    }
}
Also used : Text(com.vaadin.flow.component.Text) SerializableFunction(com.vaadin.flow.function.SerializableFunction) Component(com.vaadin.flow.component.Component) Composite(com.vaadin.flow.component.Composite) StyleSheet(com.vaadin.flow.component.dependency.StyleSheet) ItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator) TreeData(com.vaadin.flow.data.provider.hierarchy.TreeData) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) Set(java.util.Set) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) Serializable(java.io.Serializable) ArrayList(java.util.ArrayList) List(java.util.List) BiConsumer(java.util.function.BiConsumer) Optional(java.util.Optional) Collections(java.util.Collections) Icon(com.vaadin.flow.component.icon.Icon) LinkedHashSet(java.util.LinkedHashSet) Span(com.vaadin.flow.component.html.Span) Text(com.vaadin.flow.component.Text) Icon(com.vaadin.flow.component.icon.Icon) Component(com.vaadin.flow.component.Component) Span(com.vaadin.flow.component.html.Span)

Example 5 with Icon

use of com.vaadin.flow.component.icon.Icon in project layout-examples by vaadin.

the class PricingView method createFooter.

private void createFooter() {
    Div box;
    box = new Div();
    box.addClassName("copyright-box");
    Paragraph copyright = new Paragraph("© 2019");
    copyright.addClassName("copyright");
    box.add(new Icon(VaadinIcon.VAADIN_H), copyright);
    footer.add(box);
    box = new Div();
    box.add(new H2("Features"));
    box.add(new UnorderedList(new ListItem(new Anchor("#", "Cool stuff")), new ListItem(new Anchor("#", "Random feature")), new ListItem(new Anchor("#", "Team feature")), new ListItem(new Anchor("#", "Stuff for developers")), new ListItem(new Anchor("#", "Another one")), new ListItem(new Anchor("#", "Last time"))));
    footer.add(box);
    box = new Div();
    box.add(new H2("Resources"));
    box.add(new UnorderedList(new ListItem(new Anchor("#", "Resource")), new ListItem(new Anchor("#", "Resource name")), new ListItem(new Anchor("#", "Another resource")), new ListItem(new Anchor("#", "Final resource"))));
    footer.add(box);
    box = new Div();
    box.add(new H2("About"));
    box.add(new UnorderedList(new ListItem(new Anchor("#", "Team")), new ListItem(new Anchor("#", "Locations")), new ListItem(new Anchor("#", "Privacy")), new ListItem(new Anchor("#", "Terms"))));
    footer.add(box);
}
Also used : Div(com.vaadin.flow.component.html.Div) Anchor(com.vaadin.flow.component.html.Anchor) UnorderedList(com.vaadin.flow.component.html.UnorderedList) H2(com.vaadin.flow.component.html.H2) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) ListItem(com.vaadin.flow.component.html.ListItem) Paragraph(com.vaadin.flow.component.html.Paragraph)

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