use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class BadgeIconsOnlyTable method createPermissionIcon.
// tag::snippet2[]
private Icon createPermissionIcon(boolean hasPermission) {
Icon icon;
if (hasPermission) {
icon = createIcon(VaadinIcon.CHECK, "Yes");
icon.getElement().getThemeList().add("badge success");
} else {
icon = createIcon(VaadinIcon.CLOSE_SMALL, "No");
icon.getElement().getThemeList().add("badge error");
}
return icon;
}
use of com.vaadin.flow.component.icon.Icon in project karnak by OsiriX-Foundation.
the class MonitoringView method buildComponents.
/**
* Build components
*/
private void buildComponents() {
// Paginated Grid + data provider
transferStatusGrid = new TransferStatusGrid(transferStatusDataProvider);
transferStatusDataProvider.setFilter(transferStatusGrid.getTransferStatusFilter());
transferStatusGrid.setDataProvider(transferStatusDataProvider);
// Refresh button
refreshGridButton = new Button("Refresh", new Icon(VaadinIcon.REFRESH));
refreshGridButton.addClickListener(buttonClickEvent -> transferStatusDataProvider.refreshAll());
refreshGridButton.setWidthFull();
// Export Settings Dialog
exportSettingsDialog = new ExportSettingsDialog();
// Export Settings Button
exportSettingsButton = new Button("Export Settings", new Icon(VaadinIcon.COGS));
exportSettingsButton.setWidthFull();
exportSettingsButton.addClickListener(buttonClickEvent -> exportSettingsDialog.open());
// Export button
StreamResource streamResource = new StreamResource("export.csv", () -> new ByteArrayInputStream(monitoringLogic.buildCsv(exportSettingsDialog.getExportSettings())));
exportAnchor = new Anchor(streamResource, "");
exportAnchor.setWidthFull();
Button exportButton = new Button("Export", new Icon(VaadinIcon.DOWNLOAD_ALT));
exportButton.setWidthFull();
exportAnchor.getElement().setAttribute("download", true);
exportAnchor.add(exportButton);
}
use of com.vaadin.flow.component.icon.Icon in project confirm-dialog by claspina.
the class VaadinDialogIconFactory method createIconLabel.
private Icon createIconLabel(VaadinIcon vaadinIcon, String color) {
Icon icon = new Icon(vaadinIcon);
icon.setColor(color);
return icon;
}
use of com.vaadin.flow.component.icon.Icon in project layout-examples by vaadin.
the class MarketingView method createCard.
private Component createCard(String cardHeader, String cardContent) {
VerticalLayout layout = new VerticalLayout();
layout.setWidth("30%");
layout.setMinWidth("250px");
H2 header = new H2(cardHeader);
Div content = new Div();
content.setText(cardContent);
Button button = new Button("View details", new Icon(VaadinIcon.ANGLE_DOUBLE_RIGHT));
button.addThemeVariants(ButtonVariant.LUMO_SMALL);
layout.getElement().getStyle().set("flex-grow", "1");
layout.add(header, content, button);
return layout;
}
use of com.vaadin.flow.component.icon.Icon in project DoodleVerse by davidemarcoli.
the class BuildHouseView method setupPage.
public void setupPage() {
Button createButton = new Button();
HorizontalLayout createButtonLayout = new HorizontalLayout();
createButton.setIcon(new Icon(VaadinIcon.HAMMER));
createButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY, ButtonVariant.LUMO_LARGE);
createButtonLayout.setAlignItems(Alignment.END);
createButtonLayout.add(createButton);
add(createButtonLayout);
houseImage.setAlt("The Selected House!");
add(houseImage);
HorizontalLayout dropdownLayout = new HorizontalLayout();
sizeSelect.setLabel("Size");
Size[] sizes = sizeRepository.findAll().toArray(new Size[0]);
ArrayList<String> sizeNames = new ArrayList<>();
Arrays.stream(sizes).forEach(size -> sizeNames.add(size.getType()));
sizeSelect.setItems(sizeNames);
sizeSelect.setValue(sizeNames.get(0));
dropdownLayout.add(sizeSelect);
wallSelect.setLabel("Wall");
Wall[] walls = wallRepository.findAll().toArray(new Wall[0]);
ArrayList<String> wallNames = new ArrayList<>();
Arrays.stream(walls).forEach(wall -> wallNames.add(wall.getType()));
wallSelect.setItems(wallNames);
wallSelect.setValue(wallNames.get(0));
dropdownLayout.add(wallSelect);
colorField.setLabel("Ceiling Color");
colorField.setRequired(true);
String colorHelperText = "Example: blue<br>or 0000ff or 00f<br>or 0, 0, 255";
Div colorHelperDiv = new Div();
colorHelperDiv.getElement().setProperty("innerHTML", colorHelperText);
colorHelperDiv.getStyle().set("text-align", "left");
colorField.setHelperComponent(colorHelperDiv);
dropdownLayout.add(colorField);
add(dropdownLayout);
createButton.addClickListener(buttonClickEvent -> {
saveHouse();
});
colorField.addValueChangeListener(event -> {
updateInfos();
setImageSource();
});
sizeSelect.addValueChangeListener(selectStringComponentValueChangeEvent -> {
updateInfos();
setImageSource();
});
wallSelect.addValueChangeListener(selectStringComponentValueChangeEvent -> {
updateInfos();
setImageSource();
});
updateInfos();
setImageSource();
setSizeFull();
setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
setDefaultHorizontalComponentAlignment(FlexComponent.Alignment.CENTER);
getStyle().set("text-align", "center");
}
Aggregations