Search in sources :

Example 76 with Icon

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;
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Example 77 with 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);
}
Also used : ExportSettingsDialog(org.karnak.frontend.monitoring.component.ExportSettingsDialog) Anchor(com.vaadin.flow.component.html.Anchor) StreamResource(com.vaadin.flow.server.StreamResource) Button(com.vaadin.flow.component.button.Button) ByteArrayInputStream(java.io.ByteArrayInputStream) TransferStatusGrid(org.karnak.frontend.monitoring.component.TransferStatusGrid) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Example 78 with Icon

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;
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Example 79 with 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;
}
Also used : Div(com.vaadin.flow.component.html.Div) Button(com.vaadin.flow.component.button.Button) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) H2(com.vaadin.flow.component.html.H2) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Example 80 with Icon

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");
}
Also used : Div(com.vaadin.flow.component.html.Div) Wall(com.dala.data.building.wall.Wall) Button(com.vaadin.flow.component.button.Button) Size(com.dala.data.building.size.Size) ArrayList(java.util.ArrayList) Icon(com.vaadin.flow.component.icon.Icon) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) 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