edvin
02/02/2017, 12:43 PMCountryView
you don't need to create properties for the table, input fields and buttons.edvin
02/02/2017, 12:43 PMhastebrot
02/02/2017, 12:43 PMedvin
02/02/2017, 12:44 PMedvin
02/02/2017, 12:44 PMedvin
02/02/2017, 12:44 PMedvin
02/02/2017, 12:45 PMhastebrot
02/02/2017, 12:45 PMedvin
02/02/2017, 12:45 PMhastebrot
02/02/2017, 12:49 PMedvin
02/02/2017, 12:52 PMedvin
02/02/2017, 12:58 PMtoModel()
since, you have defined countries
as ObservableList<Country>
. Because of this, resources.jsonArray("european-countries.json").toModel()
should do 🙂hastebrot
02/02/2017, 2:04 PMtableview
in a separate function, i.e. to separate the plain form hierarchy and the event handlers. Having separate functions also means I need the boilerplate code for the UI elements (e.g. var capitalField: TextField by singleAssign()
).hastebrot
02/02/2017, 2:09 PMoverride val root: Parent = stackpane {...}
for experimentation and later refactor the code and seperate them into node hierarchy and event handlers.edvin
02/02/2017, 2:39 PMedvin
02/02/2017, 2:40 PMPane.createTable() = tableview { ...
and call it from where you want the tableview to enter the node hierarchy with just createTable()
.edvin
02/02/2017, 2:44 PMmikehearn
02/02/2017, 2:46 PMmikehearn
02/02/2017, 2:47 PMedvin
02/02/2017, 2:48 PMedvin
02/02/2017, 2:49 PMhastebrot
02/02/2017, 5:05 PMWhy would you need boilerplate code for the ui elements?@edvin separation of concerns 😕 some customers want this. I noticed the TornadoFX views contain a lot of logic. I'm open to explore different approaches to organize the code.
hastebrot
02/02/2017, 5:12 PMhastebrot
02/02/2017, 5:12 PMhastebrot
02/02/2017, 5:17 PMclass FooViewTest {
@Rule val robot = FxLifecycle.robot()
@Rule val viewLifecycle = FxLifecycle.before().view(FooView::class)
@Rule val stageLifecycle = FxLifecycle.after().clearAllStages()
@Test fun click_on_button() {
robot.clickOn(".countup")
expect(".counter").has.text("1")
}
}
Looks a bit boilerplatey (not much TornadoFX-like). I really want to prefer `@Rule`s over test class inheritance. Note that `@Rule`s for JUnit4 don't work with their equivalents in JUnit5 (at least that's what I understood when I asked someone from the JUnit5 team in Vienna).edvin
02/02/2017, 7:45 PMthomasnield
02/02/2017, 8:08 PMthomasnield
02/02/2017, 8:19 PMViewModel
stuff?hastebrot
02/02/2017, 8:32 PMorg.junit.platform.engine.*
calls.