Comprehensive Java web application development framework that enables server-side Java development with modern web UI components and automatic client-server communication.
npx @tessl/cli install tessl/maven-com-vaadin--vaadin@24.9.0Vaadin 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.
pom.xml:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>24.9.0</version>
</dependency>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;@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);
}
}Vaadin Platform follows a server-side component architecture where:
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);
}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);
}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);
}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);
}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);
}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);
}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);
}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 {
}// 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);
}