There are situations where binding between properties holding primitive Java
types does not work. There is an example of that in this StackOverflow question:
http://stackoverflow.com/questions/21671799/strange-type-mismatch-error
Here is a summary of the code
case class Error(source: String, message: String, fixed: Boolean=false)
var errorFixed: TableColumn[Error, Boolean] = ...
errorFixed.cellValueFactory = features =>
BooleanProperty(features.value.fixed)
This should intuitively work but fails with error:
[error] ...: type mismatch;
[error] found : scalafx.beans.property.BooleanProperty
[error] required: scalafx.beans.value.ObservableValue[Boolean,Boolean]
[error] errorFixed.cellValueFactory = features =>
BooleanProperty(features.value.fixed)
the full type here is
ObservableValue[scala.Boolean, java.lang.Boolean]
Interestingly adding cast:
BooleanProperty(features.value.fixed).asInstanceOf[ObservableValue[Boolean,
Boolean]]
makes it work. This may be a hint on "making" it work in ScalaFX code (?).
Original issue reported on code.google.com by jpsacha on 18 Feb 2014 at 3:37
Original issue reported on code.google.com by
jpsacha
on 18 Feb 2014 at 3:37Attachments: