Search in sources :

Example 91 with Icon

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

the class ButtonTest method setIcon_addThemeVariant_themeAttributeContiansThemeVariantAndIcon.

@Test
public void setIcon_addThemeVariant_themeAttributeContiansThemeVariantAndIcon() {
    button = new Button();
    button.setIcon(new Icon(VaadinIcon.ARROW_RIGHT));
    button.addThemeVariants(ButtonVariant.LUMO_SUCCESS);
    Set<String> themeNames = button.getThemeNames();
    Assert.assertTrue(themeNames.contains("icon"));
    Assert.assertTrue(themeNames.contains(ButtonVariant.LUMO_SUCCESS.getVariantName()));
}
Also used : Button(com.vaadin.flow.component.button.Button) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Test(org.junit.Test)

Example 92 with Icon

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

the class ButtonTest method setText_setIcon_changeOrder.

@Test
public void setText_setIcon_changeOrder() {
    icon = new Icon();
    button = new Button();
    button.setText(TEST_STRING);
    button.setIcon(icon);
    assertIconBeforeText();
    button.setIconAfterText(true);
    assertIconAfterText();
}
Also used : Button(com.vaadin.flow.component.button.Button) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Test(org.junit.Test)

Example 93 with Icon

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

the class ButtonTest method iconCtor.

@Test
public void iconCtor() {
    Icon icon = new Icon();
    button = new Button(icon);
    Assert.assertEquals("", button.getText());
    Assert.assertEquals(icon, button.getIcon());
}
Also used : Button(com.vaadin.flow.component.button.Button) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Test(org.junit.Test)

Example 94 with Icon

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

the class ButtonTest method textAndIconCtor.

@Test
public void textAndIconCtor() {
    Icon icon = new Icon();
    button = new Button("foo", icon);
    Assert.assertEquals("foo", button.getText());
    Assert.assertEquals(icon, button.getIcon());
}
Also used : Button(com.vaadin.flow.component.button.Button) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Test(org.junit.Test)

Example 95 with Icon

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

the class IconView method createBasicIconsView.

private void createBasicIconsView() {
    // Creating an icon from the Vaadin icons collection
    Icon close = new Icon(VaadinIcon.CLOSE);
    // Creating an icon from the Lumo icons collection
    Icon clock = new Icon("lumo", "clock");
    close.getStyle().set("marginRight", "5px");
    addCard("Creating a new icon", new HorizontalLayout(close, clock));
    close.setId("close-icon");
    clock.setId("clock-icon");
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) 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