ron
12/24/2016, 9:30 PMedvin
12/24/2016, 9:32 PMedvin
12/24/2016, 9:36 PMedvin
12/24/2016, 9:36 PM00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
edvin
12/24/2016, 9:40 PMgrep VGA
hid it:edvin
12/24/2016, 9:40 PM02:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2)
edvin
12/24/2016, 9:40 PMrun using dedicated graphics
edvin
12/24/2016, 9:53 PMron
12/24/2016, 9:57 PMedvin
12/24/2016, 10:00 PMedvin
12/24/2016, 10:00 PMron
12/24/2016, 10:03 PMron
12/24/2016, 10:03 PMedvin
12/24/2016, 10:03 PMedvin
12/24/2016, 10:04 PMron
12/24/2016, 10:04 PMedvin
12/24/2016, 10:05 PMedvin
12/24/2016, 10:05 PMron
12/24/2016, 10:06 PMedvin
12/24/2016, 10:07 PMedvin
12/24/2016, 10:07 PMedvin
12/24/2016, 10:07 PMgroostav
12/24/2016, 10:41 PMgroostav
12/24/2016, 10:41 PMgroostav
12/24/2016, 10:43 PM<!-- whateverView.fxml -->
<GridPane fx:id="mainView" fx:controller="com.whatever.WhateverController">
<Button fx:id="helloButton" onAction="#onHelloClicked" text="${controller.helloButtonText}/>
</GridPane>
would generate the code:
interface WhateverView {
val mainView: GridPane
val helloButton: Button
}
which you could then implement to "use"
class WhateverController(viewImpl: WhateverView): WhateverView by viewImpl {
val helloButtonText = "hello bindings!"
fun doDomainThing(domainObject: DomainModel){
helloButton.state = compute(domainObject);
}
fun onHelloClicked(event: ActionEvent){
//regular FXML handler handling
}
}
and which would require some kind of factory likely involving dynamic proxies to leverage:
val controller = uiFrameworkFacotry.create<WhateverController>()
this has the design wins that:
- you dont need to use the field name matches FXID scheme, which, of course, are bound and runtime meaning that spelling mistakes can only be found relatively late
- you dont need to mention the type yourself, which probably makes your code a little more refactor safe. Consider mainView
is changed to a VBox
instead of GridPane
, theres a good chance that if you made that change in the view code, you wouldnt need any changes in the kotlin controller class.
- This also makes explicit the fxml resolution strategy. I don't know how other FXML users do it but I almost immediately implemented some reflection to find the view by a naming convention. Here that problem is taken away from us.thomasnield
12/24/2016, 10:46 PMedvin
12/25/2016, 12:08 AMedvin
12/25/2016, 12:14 AMedvin
12/25/2016, 12:16 AMgroostav
12/25/2016, 7:53 AM