Vaadin and Scala

Hello Everybody,

I am a beginner scala, vaadin ( scaladin ) user and would love to be able to deploy a scaladin app to heroku

Is there anyone who could please help ? for example create a g8 template or any other way they see fit ?

I really Hope someone will respond.

Thank you

I am writing an app using scaladin and was wondering about the future of scaladin too.

Is there a way to make case classes work with forms without writing much code?

Yes, it’s possible:

case classs Test(
  @BeanProperty var id: Int,
  @BeanProperty var name: String
)

Thanks, Lukasz!

What is the best way in Scala world to validate models? I decided to try out java class BeanValidator:

validators += { (elem: Option[Any]
) ⇒
        Validator(new BeanValidator(classOf[Shop]
, "name")).validate(elem)
      }

but it fails with exception:

SEVERE: 
javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

    at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)

    at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:110)

    at com.vaadin.data.validator.BeanValidator.getJavaxBeanValidatorFactory(BeanValidator.java:167)

    at com.vaadin.data.validator.BeanValidator.getJavaxBeanValidator(BeanValidator.java:182)

    at com.vaadin.data.validator.BeanValidator.validate(BeanValidator.java:115)

    at vaadin.scala.Validator$$anon$2$$anonfun$1.apply$mcV$sp(Validation.scala:63)

    at vaadin.scala.Validator$$anon$2$$anonfun$1.apply(Validation.scala:63)

    at vaadin.scala.Validator$$anon$2$$anonfun$1.apply(Validation.scala:63)

    at scala.util.control.Exception$Catch$$anonfun$withTry$1.apply(Exception.scala:129)

    at scala.util.control.Exception$Catch$$anonfun$withTry$1.apply(Exception.scala:129)

    at scala.util.control.Exception$Catch.apply(Exception.scala:102)

    at scala.util.control.Exception$Catch.withTry(Exception.scala:129)

    at vaadin.scala.Validator$$anon$2.validate(Validation.scala:63)

In build.sbt I have these:

"javax.validation" % "validation-api" % "1.1.0.Final",
"org.hibernate" % "hibernate-validator-annotation-processor" % "5.1.1.Final"

Maybe, You should use

hibernate-validator

dependency

Yep, added these and it worked!

I will try to use bean validators then :slight_smile:

"org.hibernate" % "hibernate-validator" % "5.1.1.Final",

  "javax.el" % "javax.el-api" % "2.2.5",

  "org.glassfish.web" % "javax.el" % "2.2.6",

Although there was a little trick to make the annotations work:

import scala.beans.BeanProperty
import javax.validation.constraints.NotNull
import javax.validation.constraints.Size
import scala.annotation.target.field

case class Shop(
  @BeanProperty var id: Option[Long]
 = None,
  @(NotNull @field)@(Size @field)(min = 1, max = 255)@BeanProperty var name: String,
  @BeanProperty var address: String) {
}

Hi, I was just trying to use org.tepi.filtertable.FilterTable.
I have compiled it and tried to just simple replace regular Table with FilterTable in some example.
But I am getting:

[error]
 \VaadinScalaUI.scala:24: inferred type arguments [org.tepi.filtertable.FilterTable]

do not conform to method add's type parameter bounds [C <: vaadin.scala.Componenton

on:

[code]
val table = new FilterTable {
addContainerProperty(“Test”, classOf[String]
, None)

}

content = new VerticalLayout {

add(table, ratio = 1)

}
[/code]Would somebody give me a hint what should I do?

Is there likely to be an update to Scaladin for Vaadin 7.5.x?

Thanks.

Hi there,

Is there a Scaladin way to use SQLContainer and TableQuery/FreeformQuery?

Thank you!

Has Scaladin been abandoned? If it hasn’t, does the current version work with Vaadin 7.6.x?

Thanks…

Last update was in Jan.

If you want to checkout the latest code you can use jitpack (as last official release was 3.1)

https://jitpack.io/#henrikerola/scaladin/-SNAPSHOT

Is there a way to add buttons to a table with scaladin?

So far I only get String name of the class eg Vaadin.scala.Button@488bceb

The property is defined like this:

userTable.addContainerProperty(“Password”, classOf[Button]
, None)

and the value set like this:

rowItem.getProperty(“Password”).value_=(btn)

scaladin 3.1.0, vaadin 7.6.4

Found a way that worked.

set the container Property like this:
userTable.addContainerProperty(“Password”, classOf[ com.vaadin.ui.Button ]
, None)

and add the button like this:
val btn = new Button // this is a scala.vaadin.Button - but the .p refers to the wrapped com.vaadin.ui.Button
rowItem.getProperty(“Password”).value_=(btn.p)

Question for Property trait in Scaladin:

I have a Custom component like this:

class MyComponent extends CustomComponent with Property[String]
{
// code to implement the Property trait
}

With Scaladin the problem is that Property Trait has the same p method as CustomComponent to do the encapsulation. So the error is ovverrdie the method in p property for Property trait… is ambiguos and has diferent parameter.

¿Any idea or comment?

Hi there! I have a simple question: does Scaladin work with the latest, 7.7.1 version of Vaadin?

Thanks.

I´m using Vaadin 8.1.0 and I want to know how can use functional interfaces in scala. Something like this:

column.setEditorComponent(component, Account::setStatus)

Mor eprecisely, har do I map the lambda BeanObject::setterMethod in scala. ANy idea?

[font=courier new]
case class Account(@BeanProperty var status)

column.setEditorComponent(component, Account::setStatus)
[/font]

I tryed this. It does not work. The problem is the syntax Account::setStatus. It does not compile (the :: notation is Java 8 lamba notation, not a part pf scala language).

If your read the las pargraph of https://vaadin.com/docs/-/part/framework/getting-started/getting-started-scala.html , it says ‘Scala does not support use of lambda expressiones for calling functional interfaces’. Vaadin expects a com.vaadin.server.Setter funcional interfaces as parameter. It don´t kno how to map the ‘::’ notation to scala.