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.00
# Vaadin Platform
1
2
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.
3
4
## Package Information
5
6
- **Package Name**: com.vaadin:vaadin
7
- **Package Type**: maven
8
- **Language**: Java
9
- **Version**: 24.9.0
10
- **License**: Apache-2.0/Commercial
11
- **Installation**: Add to Maven `pom.xml`:
12
```xml
13
<dependency>
14
<groupId>com.vaadin</groupId>
15
<artifactId>vaadin</artifactId>
16
<version>24.9.0</version>
17
</dependency>
18
```
19
20
## Core Imports
21
22
```java
23
import com.vaadin.flow.component.*;
24
import com.vaadin.flow.component.button.Button;
25
import com.vaadin.flow.component.textfield.TextField;
26
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
27
import com.vaadin.flow.router.Route;
28
import com.vaadin.flow.data.binder.Binder;
29
```
30
31
## Basic Usage
32
33
```java
34
@Route("hello")
35
@PageTitle("Hello World")
36
public class HelloView extends VerticalLayout {
37
38
public HelloView() {
39
TextField name = new TextField("Your name");
40
Button button = new Button("Say hello");
41
42
button.addClickListener(e -> {
43
Notification.show("Hello " + name.getValue());
44
});
45
46
add(new H1("Hello World"), name, button);
47
setSpacing(true);
48
setPadding(true);
49
}
50
}
51
```
52
53
## Architecture
54
55
Vaadin Platform follows a server-side component architecture where:
56
57
- **UI Components**: Server-side Java objects represent client-side UI elements
58
- **Automatic Synchronization**: Changes to server-side components are automatically synchronized to the browser
59
- **Event Handling**: User interactions in the browser trigger server-side event handlers
60
- **Data Binding**: Two-way data binding between UI components and Java beans
61
- **Routing**: Annotation-based routing maps URLs to Java views
62
63
## Capabilities
64
65
### Core UI Components
66
67
Complete set of form inputs, displays, and interaction components for building web applications.
68
69
```java { .api }
70
// Basic input components
71
public class Button extends Component implements ClickNotifier<Button> {
72
public Button();
73
public Button(String text);
74
public Button(String text, ComponentEventListener<ClickEvent<Button>> clickListener);
75
public void setText(String text);
76
public String getText();
77
public Registration addClickListener(ComponentEventListener<ClickEvent<Button>> listener);
78
}
79
80
public class TextField extends AbstractField<TextField, String> {
81
public TextField();
82
public TextField(String label);
83
public TextField(String label, String placeholder);
84
public void setPlaceholder(String placeholder);
85
public void setReadOnly(boolean readOnly);
86
public void setRequired(boolean required);
87
}
88
```
89
90
[UI Components](./components.md)
91
92
### Layout Components
93
94
Flexible layout system for arranging UI components with responsive design support.
95
96
```java { .api }
97
public class VerticalLayout extends Component implements HasOrderedComponents<VerticalLayout> {
98
public VerticalLayout();
99
public VerticalLayout(Component... children);
100
public void add(Component... components);
101
public void setSpacing(boolean spacing);
102
public void setPadding(boolean padding);
103
public void setAlignItems(FlexComponent.Alignment alignment);
104
}
105
106
public class HorizontalLayout extends Component implements HasOrderedComponents<HorizontalLayout> {
107
public HorizontalLayout();
108
public HorizontalLayout(Component... children);
109
public void add(Component... components);
110
public void setSpacing(boolean spacing);
111
public void setPadding(boolean padding);
112
}
113
```
114
115
[Layout System](./layouts.md)
116
117
### Data Grid and Virtual Lists
118
119
High-performance data display components with sorting, filtering, and selection.
120
121
```java { .api }
122
public class Grid<T> extends Component implements HasDataProvider<T> {
123
public Grid();
124
public Grid(Class<T> beanType);
125
public Grid.Column<T> addColumn(ValueProvider<T, ?> valueProvider);
126
public Grid.Column<T> addComponentColumn(ValueProvider<T, Component> componentProvider);
127
public void setItems(Collection<T> items);
128
public void setDataProvider(DataProvider<T, ?> dataProvider);
129
public void setSelectionMode(Grid.SelectionMode selectionMode);
130
}
131
```
132
133
[Data Components](./data-components.md)
134
135
### Routing and Navigation
136
137
Annotation-based routing system for single-page application navigation.
138
139
```java { .api }
140
@Target(ElementType.TYPE)
141
@Retention(RetentionPolicy.RUNTIME)
142
public @interface Route {
143
String value() default "";
144
Class<? extends RouterLayout> layout() default RouterLayout.class;
145
}
146
147
@Target(ElementType.TYPE)
148
@Retention(RetentionPolicy.RUNTIME)
149
public @interface PageTitle {
150
String value();
151
}
152
153
public class RouterLink extends Component implements HasText {
154
public RouterLink();
155
public RouterLink(String text, Class<? extends Component> navigationTarget);
156
public void setRoute(Class<? extends Component> route);
157
}
158
```
159
160
[Routing and Navigation](./routing.md)
161
162
### Data Binding and Forms
163
164
Two-way data binding system for connecting UI components to Java beans with validation.
165
166
```java { .api }
167
public class Binder<BEAN> {
168
public Binder();
169
public Binder(Class<BEAN> beanType);
170
public <FIELDVALUE> Binder.Binding<BEAN, FIELDVALUE> forField(HasValue<?, FIELDVALUE> field);
171
public void setBean(BEAN bean);
172
public boolean validate();
173
public boolean writeBeanIfValid(BEAN bean);
174
}
175
176
public interface Validator<T> {
177
ValidationResult apply(T value, ValueContext context);
178
}
179
```
180
181
[Data Binding](./data-binding.md)
182
183
### Themes and Styling
184
185
Built-in theme system with Lumo and Material themes, plus CSS custom properties support.
186
187
```java { .api }
188
public enum ButtonVariant implements ThemeVariant {
189
LUMO_PRIMARY,
190
LUMO_SUCCESS,
191
LUMO_ERROR,
192
LUMO_CONTRAST,
193
LUMO_TERTIARY,
194
LUMO_TERTIARY_INLINE,
195
LUMO_ICON,
196
LUMO_SMALL,
197
LUMO_LARGE;
198
}
199
200
public interface HasTheme {
201
void addThemeVariants(ThemeVariant... variants);
202
void removeThemeVariants(ThemeVariant... variants);
203
}
204
```
205
206
[Theming and Styling](./theming.md)
207
208
### Server Communication
209
210
Server push, WebSocket support, and automatic client-server synchronization.
211
212
```java { .api }
213
@Target(ElementType.TYPE)
214
@Retention(RetentionPolicy.RUNTIME)
215
public @interface Push {
216
PushMode value() default PushMode.AUTOMATIC;
217
Transport transport() default Transport.WEBSOCKET;
218
}
219
220
public class UI {
221
public static UI getCurrent();
222
public void access(Command command);
223
public void push();
224
public Registration setPollInterval(int intervalInMillis);
225
}
226
```
227
228
[Server Communication](./server-communication.md)
229
230
### Security Integration
231
232
Built-in security annotations and integration with Spring Security and other frameworks.
233
234
```java { .api }
235
@Target({ElementType.TYPE, ElementType.METHOD})
236
@Retention(RetentionPolicy.RUNTIME)
237
public @interface AnonymousAllowed {
238
}
239
240
@Target({ElementType.TYPE, ElementType.METHOD})
241
@Retention(RetentionPolicy.RUNTIME)
242
public @interface RolesAllowed {
243
String[] value();
244
}
245
246
@Target({ElementType.TYPE, ElementType.METHOD})
247
@Retention(RetentionPolicy.RUNTIME)
248
public @interface PermitAll {
249
}
250
```
251
252
[Security](./security.md)
253
254
## Types
255
256
```java { .api }
257
// Core component interfaces
258
public interface Component extends Serializable {
259
Element getElement();
260
Optional<UI> getUI();
261
void setVisible(boolean visible);
262
boolean isVisible();
263
}
264
265
public interface HasValue<E extends HasValue.ValueChangeEvent<V>, V> {
266
V getValue();
267
void setValue(V value);
268
Registration addValueChangeListener(HasValue.ValueChangeListener<? super E> listener);
269
void setReadOnly(boolean readOnly);
270
boolean isReadOnly();
271
void setRequiredIndicatorVisible(boolean requiredIndicatorVisible);
272
}
273
274
public interface ClickNotifier<T extends Component> {
275
Registration addClickListener(ComponentEventListener<ClickEvent<T>> listener);
276
}
277
278
// Event types
279
public class ClickEvent<T extends Component> extends ComponentEvent<T> {
280
public ClickEvent(T source, boolean fromClient);
281
}
282
283
public class ValueChangeEvent<V> extends ComponentEvent<HasValue<?, V>> {
284
public V getValue();
285
public V getOldValue();
286
public boolean isFromClient();
287
}
288
289
// Layout interfaces
290
public interface HasOrderedComponents<T> {
291
void add(Component... components);
292
void addComponentAsFirst(Component component);
293
void remove(Component... components);
294
void removeAll();
295
}
296
297
// Data provider interfaces
298
public interface DataProvider<T, F> {
299
Stream<T> fetch(Query<T, F> query);
300
int size(Query<T, F> query);
301
void refreshAll();
302
void refreshItem(T item);
303
}
304
305
// Navigation interfaces
306
public interface RouterLayout extends Component {
307
void showRouterLayoutContent(HasElement content);
308
}
309
310
public interface BeforeEnterObserver {
311
void beforeEnter(BeforeEnterEvent event);
312
}
313
314
public interface AfterNavigationObserver {
315
void afterNavigation(AfterNavigationEvent event);
316
}
317
```