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()));
}
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());
}
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)));
}
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();
}
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;
}
Aggregations