This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

Extension ID

com.castsoftware.vaadin

What's new?

See Vaadin Framework - 1.0 - Release Notes for more information.

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 NameVersionSupported
Vaadin7.x.x(tick)
8.x.x(tick)
Vaadin Flow10.x.x(tick)
14.x.x(tick)
22.x.x(tick)
23.x.x(tick)
24.x.x(tick)

Supported APIs responsible for creating a Vaadin View Object

FrameworkVaadin API responsibleType of supportSupported
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:

  • intermediary class inheriting from Vaadin API are no longer Vaadin Views,only the top most class is one.
(tick) 1.0.0-alpha1
Vaadin Flowcom.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:

  • add recursive class inheritance support for Vaadin Event Handler Object to be bind to Views 
(tick) 1.0.0-alpha1

Supported APIs responsible for creating a Vaadin Event Handler Object

Colored cell are the latest additions:

FrameworkAPISignature to supportVersion addedHandling listener
Lambda expression

Method reference

Anonymous classCustom 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(tick) (tick) (tick) (tick) (tick) 
Vaadin

com.vaadin.ui.Button.addClickListener

listener

1.0.0-alpha1 & 1.0.0-alpha2(tick) (tick) (tick) (tick) (tick) 
Vaadin

com.vaadin.ui.AbstractFocusable.addFocusListener

listener

1.0.0-alpha1 & 1.0.0-alpha2(tick) (tick) (tick) (tick) (tick) 
Vaadin

com.vaadin.ui.AbstractFocusable.addBlurListener

listener

1.0.0-alpha1 & 1.0.0-alpha2(tick) (tick) (tick) (tick) (tick) 
Vaadincom.vaadin.ui.AbstractField.addValueChangeListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadincom.vaadin.ui.CheckBox.addFocusListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadincom.vaadin.ui.CheckBox.addBlurListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadincom.vaadin.event.FieldEvents.FocusNotifier.addFocusListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadincom.vaadin.event.FieldEvents.BlurNotifier.addBlurListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadincom.vaadin.ui.ComboBox.addValueChangeListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadincom.vaadin.ui.ComboBox.addFocusListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadincom.vaadin.ui.ComboBox.addBlurListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadin Flow

com.vaadin.flow.component.button.Button.Button

(text, listener) or (icon, listener)

1.0.0-alpha1 & 1.0.0-alpha2(tick) (tick) (tick) (tick) (tick) 
(text, icon, listener)1.0.0-alpha1 & 1.0.0-alpha2(tick) (tick) (tick) (tick) (tick) 
Vaadin Flow

com.vaadin.flow.component.ClickNotifier.addClickListener

listener

1.0.0-alpha1 & 1.0.0-alpha2(tick) (tick) (tick) (tick) (tick) 
Vaadin Flow

com.vaadin.flow.component.FocusNotifier.addFocusListener

listener

1.0.0-alpha1 & 1.0.0-alpha2(tick) (tick) (tick) (tick) (tick) 
Vaadin Flow

com.vaadin.flow.component.BlurNotifier.addBlurListener

listener

1.0.0-alpha1 & 1.0.0-alpha2(tick) (tick) (tick) (tick) (tick) 
Vaadin Flowcom.vaadin.flow.component.checkbox.Checkbox.Checkbox(boolean, listener) or (str, listener1.0.0-beta1(tick) (tick)(tick) (tick) (tick) 
(str, boolean, listener)1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadin Flowcom.vaadin.flow.component.combobox.ComboBox.ComboBoxlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
(str, listener) or (str, listener, items)1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 
Vaadin Flowcom.vaadin.flow.component.AbstractField.addValueChangeListenerlistener1.0.0-beta1(tick) (tick) (tick) (tick) (tick) 

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.

AIP Core compatibility

AIP Core release

Supported

8.3.x(tick)

Supported DBMS servers

DBMSSupported
CSS/PostgreSQL      (tick)

Dependencies with other extensions

  • 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

IconDescriptionName

Vaadin ViewName of the java class inheriting Vaadin views or annotated with @Route. 

Vaadin Event Handlername_of_component.name_of_event, e.g.:
  • Button.Click
  • CheckBox.Click
  • Button.Blur
  • Button.Focus
  • CheckBox.ValueChange
  • ComboBox<String>.ValueChange

Java Method (com.castsoftware.java.internal)

since alpha2:

For overrided methods:

  • buttonClick
  • focus
  • blur
  • valueChange (Vaadin) 
  • valueChanged (Vaadin Flow)

A new object is created when one of those methods name is found within a listener parameter declare with an Anonymous Vaadin Class.    

Link TypeSource DestinationAction 
callLink

Vaadin View

Vaadin Event Handler

link created by com.castsoftware.vaadin
callLink

Vaadin Event Handler

Java Lambda Expression

Java Method (com.castsoftware.jee)

Method of Anonymous Class/Java Method (com.castsoftware.internal.java)

link created by com.castsoftware.vaadin
Access Exec

Java Constructor

Java Method

 Java Lambda Expression

link created by com.castsoftware.jee

link deleted by com.castsoftware.vaadin

Mention

Java Constructor

Java Method

Java Method

link created by com.castsoftware.jee

link deleted by com.castsoftware.vaadin

Example code scenarios

Example of Support for View and Event Handler

vaadin8
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

IconType of ObjectName of ObjectWith guid ending if same fullname

Vaadin View

MyViewN/A

Vaadin Event HandlerButton.Clickparent.Button.Click_1

Caller

Caller name

Type of Link

Callee

Callee name

Callee GUID

 Vaadin View

MyViewcallLink

Vaadin Event Handler

Button.Clickparent.Button.Click_1

Vaadin Event Handler

Button.Click (Click_1)callLink

Java Lambda Expression 

MyView$lambda$0N/A

Caller

Caller name

Type of Link

Callee

Callee name

Java Constructor

MyViewAccess Exec

Java Lambda Expression 

MyView$lambda$0

Example of Support for View and Event Handler in Vaadin Flow with Method Reference

handlerMethod
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

IconType of ObjectName of ObjectWith GUID ending if same fullname

Vaadin View

ViewWithMethodReferenceN/A

Vaadin Event HandlerButton.Clickparent.Button.Click_1

Vaadin Event HandlerButton.Clickparent.Button.Click_2

Vaadin Event HandlerButton.Focusparent.Button.Focus_1

Vaadin Event HandlerButton.Blurparent.Button.Blur_1

Created Links

Caller

Caller name

Type of Link

Callee

Callee name

Callee GUID

Vaadin View

HomeViewcallLink

Vaadin Event Handler 

Button.Clickparent.Button.Click_1

Vaadin View

HomeViewcallLink

Vaadin Event Handler

Button.Clickparent.Button.Click_2

Vaadin View

HomeViewcallLink

Vaadin Event Handler

Button.Focusparent.Button.Focus_1

Vaadin View

HomeViewcallLink

Vaadin Event Handler

Button.Blurparent.Button.Blur_1

Vaadin Event Handler

Button.Click (Click_1)callLink

Java Method

NotifTriggerN/A

Vaadin Event Handler

Button.Click (Click_2)callLink

Java Method

NotifTriggerN/A

Vaadin Event Handler

Button.FocuscallLink

Java Method

RedBackgroundN/A

Vaadin Event Handler

Button.BlurcallLink

Java Method

GoBackToDefaultN/A

Removed Links

Caller

Caller name

Type of Link

Callee

Callee name

Java Constructor

ViewWithMethodReferenceMention

Java Method

NotifTrigger

Java Constructor

ViewWithMethodReferenceMention

Java Method

RedBackground

Java Constructor

ViewWithMethodReferenceMention

Java Method

GoBackToDefault

Example of Support for View and Event Handler with MethodOfAnonymousClass

handlerMethod
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

IconType of ObjectName of ObjectWith GUID ending if same fullname

Vaadin View

AnonymousViewN/A

Vaadin Event HandlerButton.Clickparent.Button.Click_1

Vaadin Event HandlerButton.Clickparent.Button.Click_2

Method of Anonymous ClassbuttonClickparent.buttonClick_1

Created Links

Caller

Caller name

Type of Link

Callee

Callee name

Callee GUID

Vaadin View

AnonymousView

callLink

Vaadin Event Handler

Button.Clickparent.Button.Click_1

Vaadin View

AnonymousView

callLink

Vaadin Event Handler

Button.Clickparent.Button.Click_2

Vaadin Event Handler

Button.ClickcallLink

Java Lambda Expression 

AnonymousView$lambda$0N/A

Vaadin Event Handler

Button.ClickcallLink

Method of Anonymous Class

buttonClickparent.buttonClick_1

Method of Anonymous Class

buttonClickcallLink

Java Method

getUIN/A

Removed Links

Caller

Caller name

Type of Link

Callee

Callee name

Java Constructor

AnonymousViewAccess Exec

Java Lambda Expression 

AnonymousView$lambda$0

Java Constructor

AnonymousViewAccess Exec

Java Method

getUI

Complex binding between View, Event Handler and Action to perform.

ComboBoxView10.java
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
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
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

IconType of ObjectName of ObjectWith GUID ending if same fullname

Vaadin View

ComboBoxView10N/A

Vaadin Event HandlerComboBox<String>.ValueChangeComboBox<String>.ValueChange_1

Created Links

Caller

Caller name

Type of Link

Callee

Callee name

Callee GUID

Vaadin View

ComboBoxView10

callLink

Vaadin Event Handler

ComboBox<String>.ValueChangeComboBox<String>.ValueChange_1

Vaadin Event Handler

Button.ClickcallLink

Java Method 

myComboBoxListenerN/A

Removed Links

None