Views
6 months ago

tornadofx-guide

11. Editing Models and

11. Editing Models and Validation Figure 11.4 A TableView with dirty state tracking, with rollback() and commit() functionality. Note also there are many other helpful properties and functions on the TableViewEditModel . The items property is an ObservableMap mapping the dirty state of each record item S . If you want to filter out and commit only dirty records so you can persist them somewhere, you can have your "Commit" Button perform this action instead. button("COMMIT").action { tableViewEditModel.items.asSequence() .filter { it.value.isDirty } .forEach { println("Committing ${it.key}") it.value.commit() } } There are also commitSelected() and rollbackSelected() to only commit or rollback the selected records in the TableView . 176

12. TornadoFX IDEA Plugin 13. TornadoFX IDEA Plugin To save time in using TornadoFX, you can install a convenient Intellij IDEA plugin to automatically generate project templates, Views, injections, and other TornadoFX features. Of course, you do not have to use this plugin which was done throughout this book. But it adds some convenience to build TornadoFX applications a little more quickly. Installing the Plugin In the Intellij IDEA workspace, press CONTROL + SHIFT + A and type "Plugins", then press ENTER. You will see a dialog to search and install plugins. Click the Browse Repositories button (Figure 13.1). Figure 13.1 After bringing up the Plugins dialog, click Browse Repositories. 177

GUIDE
GUIDE
GUIDE
GUIDE
Guide
GUIDE
Guide
Guide
Guide
GUIDE
GUIDE
GUIDE
GUIDE
Guide
The Ultimate Guide The Ultimate Guide