Search in sources :

Example 51 with Icon

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

the class LinkkiTabSheetTest method testGetTab.

@Test
void testGetTab() {
    Icon captionComponent = VaadinIcon.PLUS.create();
    LinkkiTabSheet tabSheet = new LinkkiTabSheet("id", "caption", captionComponent, "description", () -> new Span("content"), () -> true, Collections.emptyList());
    assertThat(tabSheet.getTab().getLabel(), is("caption"));
    assertThat(tabSheet.getTab().getChildren().findFirst().get(), is(captionComponent));
    assertThat(tabSheet.getTab().getId().get(), is("id"));
    assertThat(tabSheet.getTab().getElement().getAttribute("title"), is("description"));
// TODO LIN-2054 description as tooltip
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Span(com.vaadin.flow.component.html.Span) Test(org.junit.jupiter.api.Test)

Example 52 with Icon

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

the class LinkkiTabSheetTest method testBuilder_WithCaptionComponent_OverwritesExistingCaption.

@Test
void testBuilder_WithCaptionComponent_OverwritesExistingCaption() {
    Icon icon = VaadinIcon.PLUS.create();
    LinkkiTabSheet tabSheet = LinkkiTabSheet.builder("id").caption("caption").caption(icon).content(() -> new Span("content")).build();
    assertThat(tabSheet.getTab().getLabel(), is(""));
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Span(com.vaadin.flow.component.html.Span) Test(org.junit.jupiter.api.Test)

Example 53 with Icon

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

the class LinkkiTabSheetTest method testBuilder_WithCaptionComponent.

@Test
void testBuilder_WithCaptionComponent() {
    Icon icon = VaadinIcon.PLUS.create();
    LinkkiTabSheet tabSheet = LinkkiTabSheet.builder("id").caption(icon).content(() -> new Span("content")).build();
    assertThat(tabSheet.getTab().getLabel(), is(""));
    assertThat(tabSheet.getTab().getChildren().findFirst().get(), is(icon));
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Span(com.vaadin.flow.component.html.Span) Test(org.junit.jupiter.api.Test)

Example 54 with Icon

use of com.vaadin.flow.component.icon.Icon in project sapl-demos by heutelbeck.

the class Utilities method getInfoText.

public static HorizontalLayout getInfoText(String infoText) {
    Pre infoTextPre = new Pre(infoText);
    infoTextPre.getStyle().set("white-space", "pre-wrap").set("margin", "auto").set("font-size", "medium").set("padding-left", "5px").set("padding-right", "5px");
    Icon infoIcon = new Icon(VaadinIcon.INFO_CIRCLE);
    return new HorizontalLayout(infoIcon, infoTextPre);
}
Also used : Pre(com.vaadin.flow.component.html.Pre) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 55 with Icon

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

the class TripletView method addCreateRemoveButtons.

private void addCreateRemoveButtons() {
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.add(new Button(new Icon(VaadinIcon.TRASH), click -> fireEvent(new TripletViewDeleteButtonPressedEvent(this))));
    buttons.add(new Button(new Icon(VaadinIcon.PLUS), click -> fireEvent(new AddTripletViewAfterButtonPressedEvent(this))));
    add(buttons);
    setVerticalComponentAlignment(Alignment.END, buttons);
}
Also used : ComponentEventListener(com.vaadin.flow.component.ComponentEventListener) ConceptListUpdateRequestedEvent(org.archcnl.ui.common.andtriplets.triplet.events.ConceptListUpdateRequestedEvent) VariableCreationRequestedEvent(org.archcnl.ui.common.andtriplets.triplet.events.VariableCreationRequestedEvent) Registration(com.vaadin.flow.shared.Registration) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) AddTripletViewAfterButtonPressedEvent(org.archcnl.ui.common.andtriplets.triplet.events.AddTripletViewAfterButtonPressedEvent) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) ComponentEvent(com.vaadin.flow.component.ComponentEvent) PredicateSelectedEvent(org.archcnl.ui.common.andtriplets.triplet.events.PredicateSelectedEvent) RelationListUpdateRequestedEvent(org.archcnl.ui.common.andtriplets.triplet.events.RelationListUpdateRequestedEvent) TripletViewDeleteButtonPressedEvent(org.archcnl.ui.common.andtriplets.triplet.events.TripletViewDeleteButtonPressedEvent) Button(com.vaadin.flow.component.button.Button) Icon(com.vaadin.flow.component.icon.Icon) ConceptSelectedEvent(org.archcnl.ui.common.andtriplets.triplet.events.ConceptSelectedEvent) VariableListUpdateRequestedEvent(org.archcnl.ui.common.andtriplets.triplet.events.VariableListUpdateRequestedEvent) VariableSelectedEvent(org.archcnl.ui.common.andtriplets.triplet.events.VariableSelectedEvent) AddTripletViewAfterButtonPressedEvent(org.archcnl.ui.common.andtriplets.triplet.events.AddTripletViewAfterButtonPressedEvent) Button(com.vaadin.flow.component.button.Button) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) TripletViewDeleteButtonPressedEvent(org.archcnl.ui.common.andtriplets.triplet.events.TripletViewDeleteButtonPressedEvent) 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