Vaadin Framework - 1.0

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 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:

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

  • 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:

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 (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) 
Vaadin com.vaadin.ui.AbstractField.addValueChangeListener listener 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin com.vaadin.ui.CheckBox.addFocusListener listener 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin com.vaadin.ui.CheckBox.addBlurListener listener 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin com.vaadin.event.FieldEvents.FocusNotifier.addFocusListener listener 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin com.vaadin.event.FieldEvents.BlurNotifier.addBlurListener listener 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin com.vaadin.ui.ComboBox.addValueChangeListener listener 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin com.vaadin.ui.ComboBox.addFocusListener listener 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin com.vaadin.ui.ComboBox.addBlurListener listener 1.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 Flow com.vaadin.flow.component.checkbox.Checkbox.Checkbox (boolean, listener) or (str, listener 1.0.0-beta1 (tick)  (tick) (tick)  (tick)  (tick) 
(str, boolean, listener) 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin Flow com.vaadin.flow.component.combobox.ComboBox.ComboBox listener 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
(str, listener) or (str, listener, items) 1.0.0-beta1 (tick)  (tick)  (tick)  (tick)  (tick) 
Vaadin Flow com.vaadin.flow.component.AbstractField.addValueChangeListener listener 1.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.

Compatibility

CAST Imaging Core release Supported
8.3.x ✔️

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.:
  • 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 Type Source  Destination Action 
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 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

Caller

Caller name

Type of Link

Callee

Callee name

Callee GUID

 Vaadin View

MyView callLink

Vaadin Event Handler

Button.Click parent.Button.Click_1

Vaadin Event Handler

Button.Click (Click_1) callLink

Java Lambda Expression 

MyView$lambda$0 N/A

Caller

Caller name

Type of Link

Callee

Callee name

Java Constructor

MyView Access Exec

Java Lambda Expression 

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

Caller

Caller name

Type of Link

Callee

Callee name

Callee GUID

Vaadin View

HomeView callLink

Vaadin Event Handler 

Button.Click parent.Button.Click_1

Vaadin View

HomeView callLink

Vaadin Event Handler

Button.Click parent.Button.Click_2

Vaadin View

HomeView callLink

Vaadin Event Handler

Button.Focus parent.Button.Focus_1

Vaadin View

HomeView callLink

Vaadin Event Handler

Button.Blur parent.Button.Blur_1

Vaadin Event Handler

Button.Click (Click_1) callLink

Java Method

NotifTrigger N/A

Vaadin Event Handler

Button.Click (Click_2) callLink

Java Method

NotifTrigger N/A

Vaadin Event Handler

Button.Focus callLink

Java Method

RedBackground N/A

Vaadin Event Handler

Button.Blur callLink

Java Method

GoBackToDefault N/A

Caller

Caller name

Type of Link

Callee

Callee name

Java Constructor

ViewWithMethodReference Mention

Java Method

NotifTrigger

Java Constructor

ViewWithMethodReference Mention

Java Method

RedBackground

Java Constructor

ViewWithMethodReference Mention

Java Method

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

Caller

Caller name

Type of Link

Callee

Callee name

Callee GUID

Vaadin View

AnonymousView

callLink

Vaadin Event Handler

Button.Click parent.Button.Click_1

Vaadin View

AnonymousView

callLink

Vaadin Event Handler

Button.Click parent.Button.Click_2

Vaadin Event Handler

Button.Click callLink

Java Lambda Expression 

AnonymousView$lambda$0 N/A

Vaadin Event Handler

Button.Click callLink

Method of Anonymous Class

buttonClick parent.buttonClick_1

Method of Anonymous Class

buttonClick callLink

Java Method

getUI N/A

Caller

Caller name

Type of Link

Callee

Callee name

Java Constructor

AnonymousView Access Exec

Java Lambda Expression 

AnonymousView$lambda$0

Java Constructor

AnonymousView Access Exec

Java Method

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

Caller

Caller name

Type of Link

Callee

Callee name

Callee GUID

Vaadin View

ComboBoxView10

callLink

Vaadin Event Handler

ComboBox<String>.ValueChange ComboBox<String>.ValueChange_1

Vaadin Event Handler

Button.Click callLink

Java Method 

myComboBoxListener N/A

None