Using Vaadin with Scala

    1. Open an existing Vaadin Java project or create a new one as outlined in “Creating and Running a Project with Eclipse”. You can delete the UI class created by the wizard.

    2. Right-click on the project folder in Project Explorer and select Configure Add Scala Nature.

    You should now be able to create a Scala UI class, such as the following:

    scala

    Eclipse and Scala IDE should be able to import the Vaadin classes automatically when you press Ctrl+Shift+O.

    The offers a more Scala-like API for Vaadin. A Vaadin 7 compatible version is under development.

    Scala does not support use of lambda expressions for calling functional interfaces, like Java 8 does. Hence, we can’t just use a lambda expression for the ClickListener in the example above. You can, however, define implicit conversions from lambda expressions to such interface implementations. For example, for click listeners:

    scala

    You could then use a lambda expression as follows: