Skip to content
Scala API for Vaadin Framework
Scala Java
Find file

README.md

Scaladin

Scaladin makes easier to use Vaadin Framework with Scala programming language. It's a wrapper library that provides a pure Scala API for Vaadin Framework.

Build Status

Discussion

Vaadin Forum is the place for discussion about Scaladin. You can use the existing Vaadin & Scala thread or create your own.

How to use it?

Scaladin 3.2 requires Vaadin 7.5 and Scala 2.11.

1. Add dependencies to Scaladin and Vaadin to your Scala project (using sbt here):

resolvers += "Scaladin Snapshots" at "http://henrikerola.github.io/repository/snapshots/"

libraryDependencies ++= Seq(
  "org.vaadin.addons" %% "scaladin" % "3.2-SNAPSHOT",
  "com.vaadin" % "vaadin-server" % "7.5.10",
  "com.vaadin" % "vaadin-client-compiled" % "7.5.10",
  "com.vaadin" % "vaadin-themes" % "7.5.10"
)

2. Scaladin applications are deployed as servlets, during the development time you could use xsb-web-plugin.

3. Define a servlet and a Scaladin UI:

package com.example

import javax.servlet.annotation.WebServlet
import vaadin.scala._
import vaadin.scala.server.ScaladinServlet

@WebServlet(urlPatterns = Array("/*"))
class Servlet extends ScaladinServlet(
  ui = classOf[HelloWorldUI]
)

class HelloWorldUI extends UI(theme = ValoTheme.ThemeName) {

  content = new VerticalLayout { layout =>
    margin = true
    spacing = true

    addComponent(new Label {
      value = "Hello World!"
      styleNames += ValoTheme.LabelH1
    })

    addComponent(Button("Click Me", { e =>
      layout.addComponent(Label("Thanks for clicking!"))
    }))
  }
}

4. If you use xsbt-web-plugin, start a web server by saying sbt ~jetty:start and your Scaladin application should be available at http://localhost:8080:

Screenshot

License

Scaladin is licensed under the Apache 2.0 License.

Something went wrong with that request. Please try again.