Scala/Vaadin IndexedContainers Not Setting Values For Me

I am just starting out learning Scala and Vaadin. I took the basic tutorial of AddressBook that runs good on my computer in Java and converted it to Scala. I am unable to setValue’s for containers after converting to Scala. I tried this on two different computers and still have the same error on both computers.

I created a
vaadin 7 project in Eclipse Java EE
, added
scala nature
and
scala jar
file to the lib directory and am able to successfully run a scala/vaadin app with scala code. As long as I don’t use containers all works good using Scala

Here is my code that isn’t working. I get the same error trying to setValue to a table as well.

The Error is:
type mismatch; found : String required: ?0 where type ?0 (The code erroring is the third and fourth line from the bottom in bold
setValue(fn)
)

package app

import scala.util.Random
import com.vaadin.data.util.IndexedContainer

class DummyDataSource extends IndexedContainer {

val MAIN = new MainView
val FNAME = MAIN.FNAME
val LNAME = MAIN.LNAME
val COMPANY = MAIN.COMPANY
val FIELDNAMES = MAIN.FIELDNAMES
val FNAMES = MAIN.FNAMES
val LNAMES = MAIN.LNAMES

FIELDNAMES.foreach(p => addContainerProperty(p, classOf[String]
, “”))

for (i ← 0 until 1000) {
var id = addItem()
var fn = FNAMES(FNAMES.length * Random.nextInt())
var ln = LNAMES(LNAMES.length * Random.nextInt())

getContainerProperty(id, FNAME).setValue(fn)
getContainerProperty(id, LNAME).setValue(ln)

}
}

I am thinking I must be missing something very simple!

Thanks

Maybe giving excpected types to vals and vars make it more clear

Hi,

Came to post pretty much exactly the same question, but did a quick search first…

I am trying to set the property for a bean item container and getting the same error (and I am just (trying to) learn scala too, and Vaadin for that matter).

My code:

val item = myBeanItemContainer.getItem(myBean)
item.getItemProperty("enabled").setValue(true)

Error: type mismatch; found : Boolean(true) required: ?0 where type ?0

Have googled a bit and it seems to have something to do with existential types… found a few references to “?0 where type ?0” but havn’t found a solution yet…

Any help appreciated…

Regards
Colin

I’ve just run into this myself.

I have two versions of a project I am working on - one with scaladin which ran into difficulties that I’m hoping to get help for (adding buttons to a table) and a version with just straight scala.

I got further with scaladin.

I figured going straight with scala would be easier but I’m stuck on this same problem.

I suspect it is more of an eclipse/vaadin eclipse plugin issue - but really no idea how to move forward.