use of com.vaadin.flow.component.icon.Icon in project komunumo-server by komunumo.
the class KeywordsView method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(KeywordListEntity::keyword).setHeader("Keyword").setAutoWidth(true).setFlexGrow(0).setKey("keyword");
grid.addColumn(KeywordListEntity::eventCount).setHeader("Events").setAutoWidth(true).setTextAlign(ColumnTextAlign.CENTER).setFlexGrow(0);
grid.addColumn(new ComponentRenderer<>(keyword -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showKeywordDialog(keyword));
editButton.setTitle("Edit this keyword");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteKeyword(keyword));
deleteButton.setTitle("Delete this keyword");
deleteButton.setEnabled(keyword.eventCount() == 0);
return new HorizontalLayout(editButton, deleteButton);
})).setHeader("Actions").setAutoWidth(true).setFlexGrow(0);
grid.setHeightFull();
}
use of com.vaadin.flow.component.icon.Icon in project komunumo-server by komunumo.
the class ConfigurationSetting method configureGrid.
private void configureGrid() {
grid.setSelectionMode(Grid.SelectionMode.NONE);
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER, GridVariant.LUMO_ROW_STRIPES);
grid.addColumn(ConfigurationRecord::getKey).setHeader("Key").setAutoWidth(true).setFlexGrow(0);
grid.addColumn(ConfigurationRecord::getValue).setHeader("Value").setAutoWidth(false).setFlexGrow(1);
grid.addColumn(new ComponentRenderer<>(configurationRecord -> {
final var editButton = new EnhancedButton(new Icon(VaadinIcon.EDIT), clickEvent -> showEditDialog(configurationRecord));
editButton.setTitle("Edit this configuration setting");
final var deleteButton = new EnhancedButton(new Icon(VaadinIcon.TRASH), clickEvent -> deleteConfiguration(configurationRecord));
deleteButton.setTitle("Delete this configuration setting");
return new HorizontalLayout(editButton, deleteButton);
})).setHeader("Actions").setAutoWidth(true).setFlexGrow(0);
grid.setHeightFull();
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class NotificationError method show.
public Notification show() {
// tag::snippet[]
// When creating a notification using the constructor,
// the duration is 0-sec by default which means that
// the notification does not close automatically.
Notification notification = new Notification();
notification.addThemeVariants(NotificationVariant.LUMO_ERROR);
Div text = new Div(new Text("Failed to generate report"));
Button closeButton = new Button(new Icon("lumo", "cross"));
closeButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE);
closeButton.getElement().setAttribute("aria-label", "Close");
closeButton.addClickListener(event -> {
notification.close();
});
HorizontalLayout layout = new HorizontalLayout(text, closeButton);
layout.setAlignItems(Alignment.CENTER);
notification.add(layout);
notification.open();
// end::snippet[]
notification.setPosition(Notification.Position.MIDDLE);
return notification;
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class NotificationLink method show.
public Notification show() {
// tag::snippet[]
// When creating a notification using the constructor,
// the duration is 0-sec by default which means that
// the notification does not close automatically.
Notification notification = new Notification();
Div text = new Div(new Text("Jason Bailey mentioned you in "), new Anchor("#", "Project Q4"));
Button closeButton = new Button(new Icon("lumo", "cross"));
closeButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE);
closeButton.getElement().setAttribute("aria-label", "Close");
closeButton.addClickListener(event -> {
notification.close();
});
HorizontalLayout layout = new HorizontalLayout(text, closeButton);
layout.setAlignItems(Alignment.CENTER);
notification.add(layout);
notification.open();
// end::snippet[]
notification.setPosition(Notification.Position.MIDDLE);
return notification;
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class MenuBarIconOnly method createIconItem.
// tag::createIcon[]
private MenuItem createIconItem(MenuBar menu, VaadinIcon iconName, String ariaLabel) {
Icon icon = new Icon(iconName);
MenuItem item = menu.addItem(icon);
item.getElement().setAttribute("aria-label", ariaLabel);
return item;
}
Aggregations