Search in sources :

Example 11 with Icon

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

the class ButtonTest method addThemeVariant_setIcon_themeAttributeContiansThemeVariantAndIcon.

@Test
public void addThemeVariant_setIcon_themeAttributeContiansThemeVariantAndIcon() {
    button = new Button();
    button.addThemeVariants(ButtonVariant.LUMO_SUCCESS);
    button.setIcon(new Icon(VaadinIcon.ARROW_RIGHT));
    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 12 with Icon

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

the class ButtonTest method changeIcon_iconThemeIsPreserved.

@Test
public void changeIcon_iconThemeIsPreserved() {
    button = new Button();
    button.setIcon(new Icon(VaadinIcon.ARROW_RIGHT));
    Assert.assertEquals("icon", button.getThemeName());
    button.setIcon(new Icon(VaadinIcon.ALARM));
    Assert.assertEquals("icon", button.getThemeName());
}
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 13 with Icon

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

the class ButtonTest method setIcon.

@Test
public void setIcon() {
    button = new Button("foo", new Icon());
    icon = new Icon();
    button.setIcon(icon);
    assertIconBeforeText();
    button.setIcon(null);
    Assert.assertNull(button.getIcon());
    Assert.assertFalse(button.getChildren().anyMatch(child -> child.equals(icon)));
}
Also used : Text(com.vaadin.flow.component.Text) StateNode(com.vaadin.flow.internal.StateNode) ButtonVariant(com.vaadin.flow.component.button.ButtonVariant) Set(java.util.Set) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) HashMap(java.util.HashMap) Test(org.junit.Test) Serializable(java.io.Serializable) Button(com.vaadin.flow.component.button.Button) Element(com.vaadin.flow.dom.Element) Assert(org.junit.Assert) Icon(com.vaadin.flow.component.icon.Icon) ElementAttributeMap(com.vaadin.flow.internal.nodefeature.ElementAttributeMap) 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 14 with Icon

use of com.vaadin.flow.component.icon.Icon in project furms by unity-idm.

the class ResourceAllocationsGrid method showAllocateButton.

private Component showAllocateButton(ResourceAllocationsGridItem item) {
    if (item.getRemaining() == null || (ZERO.compareTo(item.getRemaining().getAmount()) != 0) && !ZonedDateTime.now(zoneId).isAfter(item.getValidTo())) {
        final Button plus = new Button(new Icon(PLUS_CIRCLE));
        plus.addClickListener(event -> allocateButtonAction.accept(item));
        plus.addThemeVariants(LUMO_TERTIARY);
        return plus;
    }
    return new Div();
}
Also used : Div(com.vaadin.flow.component.html.Div) Button(com.vaadin.flow.component.button.Button) Icon(com.vaadin.flow.component.icon.Icon)

Example 15 with Icon

use of com.vaadin.flow.component.icon.Icon in project furms by unity-idm.

the class ProjectsView method createNameComponent.

private HorizontalLayout createNameComponent(ProjectViewGridModel projectViewModel) {
    HorizontalLayout nameComponent = new HorizontalLayout();
    if (projectViewModel.expired) {
        final Icon warningIcon = TIME_BACKWARD.create();
        final Tooltip warningTooltip = new Tooltip(warningIcon, TooltipPosition.BOTTOM, TooltipAlignment.CENTER);
        warningTooltip.add(getTranslation("view.community-admin.projects.grid.column.1.expired.project.tooltip"));
        getContent().add(warningTooltip);
        nameComponent.add(warningIcon);
    }
    nameComponent.add(new RouterGridLink(projectViewModel.name, projectViewModel.id, ProjectView.class, PARAM_NAME, ADMINISTRATORS_PARAM));
    return nameComponent;
}
Also used : RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) Tooltip(com.vaadin.componentfactory.Tooltip) 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