I am learning how to use kotlin and have started using tornadoFX. I am going through the guide in an attempt to learn it, however I cannot figure out what is meant in the 'TreeView with Differing Types'. It seems to say that I should use star projection, which as I know it when you use a * in the call.
However as soon as I do that, the treeview says that 'Projections are not allowed on type arguments of functions and properties'
This is my code:
class MainView : View("") {
override val root = treeview<*> {
root = TreeItem(Person("Departments", ""))
cellFormat {
text = when (it) {
is String -> it
is Department -> it.name
is Person -> it.name
else -> throw IllegalArgumentException("Invalid Data Type")
}
}
populate { parent ->
val value = parent.value
if (parent == root) departments
else if (value is Department) persons.filter { it.department == value.name }
else null
} }
}
I'm honestly stumped, I don't know what I am meant to be doing.
Also if anyone else could provide me with some useful links for learning both Kotlin and tornadoFX it would be much appreciated :)