or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

components.mddata-binding.mddata-components.mdindex.mdlayouts.mdrouting.mdsecurity.mdserver-communication.mdtheming.md
tile.json

tessl/maven-com-vaadin--vaadin

Comprehensive Java web application development framework that enables server-side Java development with modern web UI components and automatic client-server communication.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/com.vaadin/vaadin@24.9.x

To install, run

npx @tessl/cli install tessl/maven-com-vaadin--vaadin@24.9.0

index.mddocs/

Vaadin Platform

Vaadin Platform is a comprehensive Java web application development framework that enables developers to build modern, interactive web applications using server-side Java without writing JavaScript or HTML. The platform combines a complete set of UI components, routing, data binding, and state management capabilities, allowing developers to create full-stack applications using only Java while automatically generating optimized client-side code.

Package Information

  • Package Name: com.vaadin:vaadin
  • Package Type: maven
  • Language: Java
  • Version: 24.9.0
  • License: Apache-2.0/Commercial
  • Installation: Add to Maven pom.xml:
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin</artifactId>
        <version>24.9.0</version>
    </dependency>

Core Imports

import com.vaadin.flow.component.*;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.data.binder.Binder;

Basic Usage

@Route("hello")
@PageTitle("Hello World")
public class HelloView extends VerticalLayout {

    public HelloView() {
        TextField name = new TextField("Your name");
        Button button = new Button("Say hello");

        button.addClickListener(e -> {
            Notification.show("Hello " + name.getValue());
        });

        add(new H1("Hello World"), name, button);
        setSpacing(true);
        setPadding(true);
    }
}

Architecture

Vaadin Platform follows a server-side component architecture where:

  • UI Components: Server-side Java objects represent client-side UI elements
  • Automatic Synchronization: Changes to server-side components are automatically synchronized to the browser
  • Event Handling: User interactions in the browser trigger server-side event handlers
  • Data Binding: Two-way data binding between UI components and Java beans
  • Routing: Annotation-based routing maps URLs to Java views

Capabilities

Core UI Components

Complete set of form inputs, displays, and interaction components for building web applications.

// Basic input components
public class Button extends Component implements ClickNotifier<Button> {
    public Button();
    public Button(String text);
    public Button(String text, ComponentEventListener<ClickEvent<Button>> clickListener);
    public void setText(String text);
    public String getText();
    public Registration addClickListener(ComponentEventListener<ClickEvent<Button>> listener);
}

public class TextField extends AbstractField<TextField, String> {
    public TextField();
    public TextField(String label);
    public TextField(String label, String placeholder);
    public void setPlaceholder(String placeholder);
    public void setReadOnly(boolean readOnly);
    public void setRequired(boolean required);
}

UI Components

Layout Components

Flexible layout system for arranging UI components with responsive design support.

public class VerticalLayout extends Component implements HasOrderedComponents<VerticalLayout> {
    public VerticalLayout();
    public VerticalLayout(Component... children);
    public void add(Component... components);
    public void setSpacing(boolean spacing);
    public void setPadding(boolean padding);
    public void setAlignItems(FlexComponent.Alignment alignment);
}

public class HorizontalLayout extends Component implements HasOrderedComponents<HorizontalLayout> {
    public HorizontalLayout();
    public HorizontalLayout(Component... children);
    public void add(Component... components);
    public void setSpacing(boolean spacing);
    public void setPadding(boolean padding);
}

Layout System

Data Grid and Virtual Lists

High-performance data display components with sorting, filtering, and selection.

public class Grid<T> extends Component implements HasDataProvider<T> {
    public Grid();
    public Grid(Class<T> beanType);
    public Grid.Column<T> addColumn(ValueProvider<T, ?> valueProvider);
    public Grid.Column<T> addComponentColumn(ValueProvider<T, Component> componentProvider);
    public void setItems(Collection<T> items);
    public void setDataProvider(DataProvider<T, ?> dataProvider);
    public void setSelectionMode(Grid.SelectionMode selectionMode);
}

Data Components

Routing and Navigation

Annotation-based routing system for single-page application navigation.

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Route {
    String value() default "";
    Class<? extends RouterLayout> layout() default RouterLayout.class;
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface PageTitle {
    String value();
}

public class RouterLink extends Component implements HasText {
    public RouterLink();
    public RouterLink(String text, Class<? extends Component> navigationTarget);
    public void setRoute(Class<? extends Component> route);
}

Routing and Navigation

Data Binding and Forms

Two-way data binding system for connecting UI components to Java beans with validation.

public class Binder<BEAN> {
    public Binder();
    public Binder(Class<BEAN> beanType);
    public <FIELDVALUE> Binder.Binding<BEAN, FIELDVALUE> forField(HasValue<?, FIELDVALUE> field);
    public void setBean(BEAN bean);
    public boolean validate();
    public boolean writeBeanIfValid(BEAN bean);
}

public interface Validator<T> {
    ValidationResult apply(T value, ValueContext context);
}

Data Binding

Themes and Styling

Built-in theme system with Lumo and Material themes, plus CSS custom properties support.

public enum ButtonVariant implements ThemeVariant {
    LUMO_PRIMARY,
    LUMO_SUCCESS,
    LUMO_ERROR,
    LUMO_CONTRAST,
    LUMO_TERTIARY,
    LUMO_TERTIARY_INLINE,
    LUMO_ICON,
    LUMO_SMALL,
    LUMO_LARGE;
}

public interface HasTheme {
    void addThemeVariants(ThemeVariant... variants);
    void removeThemeVariants(ThemeVariant... variants);
}

Theming and Styling

Server Communication

Server push, WebSocket support, and automatic client-server synchronization.

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Push {
    PushMode value() default PushMode.AUTOMATIC;
    Transport transport() default Transport.WEBSOCKET;
}

public class UI {
    public static UI getCurrent();
    public void access(Command command);
    public void push();
    public Registration setPollInterval(int intervalInMillis);
}

Server Communication

Security Integration

Built-in security annotations and integration with Spring Security and other frameworks.

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface AnonymousAllowed {
}

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface RolesAllowed {
    String[] value();
}

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PermitAll {
}

Security

Types

// Core component interfaces
public interface Component extends Serializable {
    Element getElement();
    Optional<UI> getUI();
    void setVisible(boolean visible);
    boolean isVisible();
}

public interface HasValue<E extends HasValue.ValueChangeEvent<V>, V> {
    V getValue();
    void setValue(V value);
    Registration addValueChangeListener(HasValue.ValueChangeListener<? super E> listener);
    void setReadOnly(boolean readOnly);
    boolean isReadOnly();
    void setRequiredIndicatorVisible(boolean requiredIndicatorVisible);
}

public interface ClickNotifier<T extends Component> {
    Registration addClickListener(ComponentEventListener<ClickEvent<T>> listener);
}

// Event types
public class ClickEvent<T extends Component> extends ComponentEvent<T> {
    public ClickEvent(T source, boolean fromClient);
}

public class ValueChangeEvent<V> extends ComponentEvent<HasValue<?, V>> {
    public V getValue();
    public V getOldValue();
    public boolean isFromClient();
}

// Layout interfaces
public interface HasOrderedComponents<T> {
    void add(Component... components);
    void addComponentAsFirst(Component component);
    void remove(Component... components);
    void removeAll();
}

// Data provider interfaces
public interface DataProvider<T, F> {
    Stream<T> fetch(Query<T, F> query);
    int size(Query<T, F> query);
    void refreshAll();
    void refreshItem(T item);
}

// Navigation interfaces
public interface RouterLayout extends Component {
    void showRouterLayoutContent(HasElement content);
}

public interface BeforeEnterObserver {
    void beforeEnter(BeforeEnterEvent event);
}

public interface AfterNavigationObserver {
    void afterNavigation(AfterNavigationEvent event);
}