Vaadin Framework - 1.0
Extension ID
com.castsoftware.vaadin
What’s new?
See Release Notes.
Description
This extension provides support for Vaadin Framework - Vaadin is a web app development framework for Java that includes a large library of UI components.
In what situation should you install this extension?
The main purpose of this extension is to provide support for views and events provided in the Vaadin Framework and link them to the relevant java objects (resolved by the JEE Analyzer).
Supported versions
The following table displays the list of version that this extension supports.
Framework Name | Version | Supported |
---|---|---|
Vaadin | 7.x.x 8.x.x |
✅ |
Vaadin Flow | 10.x.x 14.x.x 22.x.x 23.x.x 24.x.x |
✅ |
Supported APIs responsible for creating a Vaadin View Object
Framework | Vaadin API responsible | Type of support | Supported |
---|---|---|---|
Vaadin |
com.vaadin.navigator.View com.vaadin.ui.UI com.vaadin.ui.Panel com.vaadin.ui.Window com.vaadin.ui.CssLayout com.vaadin.ui.HorizontalLayout com.vaadin.ui.VerticalLayout com.vaadin.ui.GridLayout com.vaadin.ui.FormLayout |
Class inheritance Since 1.0.0-alpha2:
|
|
Vaadin Flow | com.vaadin.flow.component.orderedlayout.* com.vaadin.flow.component.applayout.* com.vaadin.flow.component.html.* com.vaadin.flow.router.Route |
Presence of Route annotation Since 1.0.0-alpha2:
|
Supported APIs responsible for creating a Vaadin Event Handler Object
Colored cell are the latest additions:
Framework | API | Signature to support | Version added | Handling listener | ||||
Lambda expression | Method reference | Anonymous class | Custom Instance of Click/Focus/Blur/Listener API class | Regular Method Call* | ||||
Vaadin | com.vaadin.ui.Button.Button | (text, listener) or (icon, listener) | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.Button.addClickListener | listener | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.AbstractFocusable.addFocusListener | listener | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.AbstractFocusable.addBlurListener | listener | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.AbstractField.addValueChangeListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.CheckBox.addFocusListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.CheckBox.addBlurListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.event.FieldEvents.FocusNotifier.addFocusListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.event.FieldEvents.BlurNotifier.addBlurListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.ComboBox.addValueChangeListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.ComboBox.addFocusListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin | com.vaadin.ui.ComboBox.addBlurListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin Flow | com.vaadin.flow.component.button.Button.Button | (text, listener) or (icon, listener) | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ |
(text, icon, listener) | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ | ||
Vaadin Flow | com.vaadin.flow.component.ClickNotifier.addClickListener | listener | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin Flow | com.vaadin.flow.component.FocusNotifier.addFocusListener | listener | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin Flow | com.vaadin.flow.component.BlurNotifier.addBlurListener | listener | 1.0.0-alpha1 & 1.0.0-alpha2 | ✅ | ✅ | ✅ | ✅ | ✅ |
Vaadin Flow | com.vaadin.flow.component.checkbox.Checkbox.Checkbox | (boolean, listener) or (str, listener) | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
(str, boolean, listener) | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ | ||
Vaadin Flow | com.vaadin.flow.component.combobox.ComboBox.ComboBox | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
(str, listener) or (str, listener, items) | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ | ||
Vaadin Flow | com.vaadin.flow.component.AbstractField.addValueChangeListener | listener | 1.0.0-beta1 | ✅ | ✅ | ✅ | ✅ | ✅ |
Note
- Providing a regular methodcall* as listener implies that there must by a return statement of type Click/Focus/Blur/Listener that declares the Click/Focus/Blur/Event to be executed on action.
- Vaadin implicitly treats Lambdas and Method references patterns such that the body of the Lambda or Method are seen as XxxEvents.
- When custom (or anonymous XxxListener) classes are explicitly instantiated then the according action methods is executed for example, the method “ButtonClick” for a Click, “blur” for a focus loss and “focus” for a focus gained.
Function Point, Quality and Sizing support
- Function Points (transactions): a green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
- Quality and Sizing: a green tick indicates that CAST can measure size and that a minimum set of Quality Rules exist
Function Points (transactions) | Quality and Sizing |
---|---|
✅ | ❌ |
Compatibility
Release | Operating System | Supported |
---|---|---|
v3/8.4.x | Microsoft Windows / Linux | ✅ |
v2/8.3.x | Microsoft Windows | ✅ |
Dependencies with other extensions
Some CAST extensions require the presence of other CAST extensions in order to function correctly. The Vaadin Framework extension requires that the following other CAST extensions are also installed:
- CAST AIP Internal extension (internal technical extension)
- JEE Analyzer
Download and installation instructions
The extension will not be automatically installed by CAST Console, therefore you should ensure that the extension is manually installed using the Application - Extensions interface:
What results can you expect?
Once the analysis/snapshot generation has completed, you can view the results in the normal manner. The following objects and links will be resolved:
Objects
Icon | Description | Name |
---|---|---|
Vaadin View | Name of the java class inheriting Vaadin views or annotated with @Route. | |
Vaadin Event Handler | name_of_component.name_of_event, e.g.:
|
|
Java Method (com.castsoftware.java.internal) | since alpha2: For overrided methods:
A new object is created when one of those methods name is found within a listener parameter declare with an Anonymous Vaadin Class. |
Links
Link Type | Source | Destination | Action |
---|---|---|---|
callLink |
|
|
link created by com.castsoftware.vaadin |
callLink |
|
|
link created by com.castsoftware.vaadin |
Access Exec |
|
|
link created by com.castsoftware.jee link deleted by com.castsoftware.vaadin |
Mention |
|
|
link created by com.castsoftware.jee link deleted by com.castsoftware.vaadin |
Example code scenarios
Example of Support for View and Event Handler
vaadin8 Expand source
package org.example;
import com.vaadin.navigator.View;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
public class MyView extends VerticalLayout implements View {
public MyView() {
// Create the content of your VerticalLayout view
Label label = new Label("This is a VerticalLayout-based view!");
addComponent(label);
Button button = new Button("Go to Home View");
button.addClickListener(event -> {
getUI().getNavigator().navigateTo("");
});
addComponent(button);
}
}
Result in Enlighten:
For this result the current extension adds or removed the following Objects, Links and Properties:
Objects
Icon | Type of Object | Name of Object | With guid ending if same fullname |
---|---|---|---|
Vaadin View |
MyView | N/A | |
Vaadin Event Handler | Button.Click | parent.Button.Click_1 |
Created Links
Caller |
Caller name |
Type of Link |
Callee |
Callee name |
Callee GUID |
---|---|---|---|---|---|
|
MyView | callLink |
|
Button.Click | parent.Button.Click_1 |
|
Button.Click (Click_1) | callLink |
|
MyView$lambda$0 | N/A |
Removed Links
Caller |
Caller name |
Type of Link |
Callee |
Callee name |
---|---|---|---|---|
|
MyView | Access Exec |
|
MyView$lambda$0 |
Example of Support for View and Event Handler in Vaadin Flow with Method Reference
handlerMethod Expand source
package com.example.application.views.list;
import com.vaadin.flow.component.BlurNotifier;
import com.vaadin.flow.component.ClickEvent;
import com.vaadin.flow.component.FocusNotifier;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
@Route(value = "RefButton", layout = MainLayout.class)
public class ViewWithMethodReference extends VerticalLayout {
public ViewWithMethodReference() {
// Button 1 method ref within the Button component
Button button1 = new Button("click me!",this::NotifTrigger);
// Button 2 method ref with add*Listener
Button button2 = new Button("Click and Look");
// see the same nofitication handler for both buttons
button2.addClickListener(this::NotifTrigger);
button2.addFocusListener(this::RedBackground);
button2.addBlurListener(this::GoBackToDefault);
add(button1,button2);
}
private void NotifTrigger(ClickEvent<Button> event) {
Notification.show("Clicked!");
}
private void RedBackground(FocusNotifier.FocusEvent<Button> event) {
event.getSource().getStyle().set("background-color", "red");
}
private void GoBackToDefault(BlurNotifier.BlurEvent<Button> event) {
event.getSource().getStyle().remove("background-color");
}
}
Result in Enlighten:
For this result the current extension adds or removed the following Objects, Links and Properties:
Objects
Icon | Type of Object | Name of Object | With GUID ending if same fullname |
---|---|---|---|
Vaadin View |
ViewWithMethodReference | N/A | |
Vaadin Event Handler | Button.Click | parent.Button.Click_1 | |
Vaadin Event Handler | Button.Click | parent.Button.Click_2 | |
Vaadin Event Handler | Button.Focus | parent.Button.Focus_1 | |
Vaadin Event Handler | Button.Blur | parent.Button.Blur_1 |
Created Links
Caller |
Caller name |
Type of Link |
Callee |
Callee name |
Callee GUID |
---|---|---|---|---|---|
|
HomeView | callLink |
|
Button.Click | parent.Button.Click_1 |
|
HomeView | callLink |
|
Button.Click | parent.Button.Click_2 |
|
HomeView | callLink |
|
Button.Focus | parent.Button.Focus_1 |
|
HomeView | callLink |
|
Button.Blur | parent.Button.Blur_1 |
|
Button.Click (Click_1) | callLink |
|
NotifTrigger | N/A |
|
Button.Click (Click_2) | callLink |
|
NotifTrigger | N/A |
|
Button.Focus | callLink |
|
RedBackground | N/A |
|
Button.Blur | callLink |
|
GoBackToDefault | N/A |
Removed Links
Caller |
Caller name |
Type of Link |
Callee |
Callee name |
---|---|---|---|---|
|
ViewWithMethodReference | Mention |
|
NotifTrigger |
|
ViewWithMethodReference | Mention |
|
RedBackground |
|
ViewWithMethodReference | Mention |
|
GoBackToDefault |
Example of Support for View and Event Handler with MethodOfAnonymousClass
handlerMethod Expand source
package org.example;
import com.vaadin.navigator.View;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.VerticalLayout;
public class AnonymousView extends VerticalLayout implements View {
public AnonymousView() {
// Create the content of your home page view
Label label = new Label("Welcome to the Anonymous Page!");
addComponent(label);
// Create the content root layout for the UI
HorizontalLayout content = new HorizontalLayout();
// Display the greeting
content.addComponent(new Label("Hello World!"));
// Have a clickable button
content.addComponent(new Button("Push Me!",
click -> Notification.show("Pushed!")));
Button button = new Button("Go to My View");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
// Handle the button click event in Vaadin 8.20
// You can perform actions here
getUI().getNavigator().navigateTo("my-view");
}
});
addComponent(button);
MyForm myform = new MyForm();
addComponent(myform);
}
}
Result in Enlighten:
For this result the current extension adds or removes the following Objects, Links and Properties:
Objects
Icon | Type of Object | Name of Object | With GUID ending if same fullname |
---|---|---|---|
Vaadin View |
AnonymousView | N/A | |
Vaadin Event Handler | Button.Click | parent.Button.Click_1 | |
Vaadin Event Handler | Button.Click | parent.Button.Click_2 | |
Method of Anonymous Class | buttonClick | parent.buttonClick_1 |
Created Links
Caller |
Caller name |
Type of Link |
Callee |
Callee name |
Callee GUID |
---|---|---|---|---|---|
|
AnonymousView |
callLink |
|
Button.Click | parent.Button.Click_1 |
|
AnonymousView |
callLink |
|
Button.Click | parent.Button.Click_2 |
|
Button.Click | callLink |
|
AnonymousView$lambda$0 | N/A |
|
Button.Click | callLink |
|
buttonClick | parent.buttonClick_1 |
|
buttonClick | callLink |
|
getUI | N/A |
Removed Links
Caller |
Caller name |
Type of Link |
Callee |
Callee name |
---|---|---|---|---|
|
AnonymousView | Access Exec |
|
AnonymousView$lambda$0 |
|
AnonymousView | Access Exec |
|
getUI |
Complex binding between View, Event Handler and Action to perform.
ComboBoxView10.java Expand source
package org.example2.combobox;
import com.vaadin.data.HasValue;
import com.vaadin.navigator.View;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Notification;
import com.vaadin.ui.VerticalLayout;
import static org.example2.combobox.MyCustomComboBoxCls.MyCustomComboBox;
public class ComboBoxView10 extends VerticalLayout implements View {
public ComboBoxView10() {
final ComboBox<String> ComboBox10 = MyCustomComboBox("MyComboBox",ComboBoxCustomListener::myComboBoxListener);
addComponent(ComboBox10);
}
}
MyCustomComboBoxCls.java Expand source
package org.example2.combobox;
import com.vaadin.data.HasValue;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComboBox;
public class MyCustomComboBoxCls {
public static ComboBox<String> MyCustomComboBox(final String caption, final HasValue.ValueChangeListener<String> clickListener ) {
final ComboBox<String> cmbx = new ComboBox<>(caption);
cmbx.setItems("Chrome", "Edge", "Firefox", "Safari");
cmbx.setTextInputAllowed(true);
cmbx.addValueChangeListener(clickListener);
return cmbx;
}
}
ComboBoxCustomListener.java Expand source
package org.example2.combobox;
import com.vaadin.data.HasValue;
import com.vaadin.ui.Notification;
public class ComboBoxCustomListener {
public static void myComboBoxListener(HasValue.ValueChangeEvent<String> stringValueChangeEvent) {
Notification.show("ComboBox 10");
}
public static HasValue.ValueChangeListener<String> myComboBoxListenerbis() {
return e -> Notification.show("ComboBox11");
}
}
Result in Enlighten:
Objects
Icon | Type of Object | Name of Object | With GUID ending if same fullname |
---|---|---|---|
Vaadin View |
ComboBoxView10 | N/A | |
Vaadin Event Handler | ComboBox<String>.ValueChange | ComboBox<String>.ValueChange_1 |
Created Links
Caller |
Caller name |
Type of Link |
Callee |
Callee name |
Callee GUID |
---|---|---|---|---|---|
|
ComboBoxView10 |
callLink |
|
ComboBox<String>.ValueChange | ComboBox<String>.ValueChange_1 |
|
Button.Click | callLink |
|
myComboBoxListener | N/A |
Removed Links
None