amanda.hinchman-dominguez
05/31/2018, 1:14 AMamanda.hinchman-dominguez
05/31/2018, 1:22 AMObservableValue
thing, but if not I'm sure I'll find a workaroundbkenn
05/31/2018, 2:01 AMclass MainView : View("Hello TornadoFX") {
val catModel = CatModel()
val cats = mutableListOf<Cat>().observable()
init {
cats.add(Cat("<https://cdn.pixabay.com/photo/2018/05/04/16/50/cat-3374422_960_720.jpg>"))
cats.add(Cat("<https://cdn.pixabay.com/photo/2018/03/26/20/49/tiger-3264048_960_720.jpg>"))
cats.add(Cat("<https://cdn.pixabay.com/photo/2017/12/26/16/09/lion-3040797_960_720.jpg>"))
cats.add(Cat("<https://cdn.pixabay.com/photo/2017/11/14/13/06/kitty-2948404_960_720.jpg>"))
cats.add(Cat("<https://cdn.pixabay.com/photo/2014/04/13/20/49/cat-323262_960_720.jpg>"))
}
override val root = splitpane {
setPrefSize(1000.0, 600.0)
tableview(cats) {
column("URL", Cat::catImageProperty)
bindSelected(catModel)
}
vbox {
alignment = Pos.TOP_CENTER
label(catModel.catImage) {
style {
fontWeight = FontWeight.BOLD
font = Font.font("Arial Bold")
}
}
imageview(catModel.catImage) {
fitWidth = 500.0
fitHeight = 400.0
isPreserveRatio = true
isCache = true
}
}
}
}
class Cat(cateImage: String) {
val catImageProperty = SimpleStringProperty(cateImage)
var catImage by catImageProperty
override fun toString(): String {
return "Cat (catImage=$catImage)"
}
}
class CatModel : ItemViewModel<Cat>() {
val catImage = bind(Cat::catImageProperty)
}
bkenn
05/31/2018, 2:01 AMbkenn
05/31/2018, 2:01 AMamanda.hinchman-dominguez
05/31/2018, 3:51 AMamanda.hinchman-dominguez
05/31/2018, 3:51 AMamanda.hinchman-dominguez
05/31/2018, 3:52 AMamanda.hinchman-dominguez
05/31/2018, 4:29 AMgtnarg
05/31/2018, 1:28 PMuser
05/31/2018, 3:59 PMpinto18
06/01/2018, 8:22 PMiLobanov
06/02/2018, 1:14 PMedvin
06/02/2018, 2:24 PMiLobanov
06/02/2018, 4:56 PMedvin
06/03/2018, 8:10 AMjava.awt.Button
instead of javafx.scene.control.Button
. In any case, we've talked about removing the suboptimal code examples, which we used kind of to introduce the builders. @thomasnieldmaybe this is something we should address in the next cleanup? 🙂edvin
06/03/2018, 8:13 AMlaunch<MyApp>(args)
now 🙂iLobanov
06/03/2018, 10:26 AMedvin
06/03/2018, 12:25 PMiLobanov
06/03/2018, 12:26 PMedvin
06/03/2018, 12:27 PMiLobanov
06/03/2018, 1:04 PMiLobanov
06/03/2018, 1:06 PMiLobanov
06/03/2018, 1:13 PMtableview(data) {
column("Title ${item.name}", Data::value)
for ((title, value) in data.map) {
column(title, InnerData::value)
}
}
iLobanov
06/03/2018, 1:17 PMianbrandt
06/03/2018, 1:54 PMApplication.launch(MyApp::class.java, *args)
to launch<MyApp>(args)
, it now picks up operator fun EventTarget.plusAssign(node: Node) { addChildIfPossible(node)}
for +=
from Nodes.kt, and works!
import javafx.scene.control.Button
import javafx.scene.layout.VBox
import tornadofx.*
fun main(args: Array<String>) {
launch<MyApp>(args)
}
class MyApp : App(MyView::class)
class MyView : View() {
override val root = VBox()
init {
root += Button("Press Me")
}
}
edvin
06/03/2018, 5:15 PMApplication.launch(MyApp::class.java, *args)
- still works 🙂ianbrandt
06/03/2018, 5:34 PMianbrandt
06/03/2018, 5:35 PMtornadofx-compile-error.png▾
ianbrandt
06/03/2018, 5:37 PMtornadofx-compile-fixed.png▾