Views
7 months ago

tornadofx-guide

12. TornadoFX IDEA

12. TornadoFX IDEA Plugin Do this for each property and your Client class should now look like this. class Client(id: Int, name: String) { var id by property(id) fun idProperty() = getProperty(Client::id) } var name by property(name) fun nameProperty() = getProperty(Client::name) Your Client now uses JavaFX properties instead of plain properties. Notice the primary constructor will pass the intial values to the property() delegates, but you do not have to provide initial values if they are not desired. This is a time-saving feature when creating domain types for data controls. Next we will cover how to generate TableView columns. Generating Columns for a TableView Another handy feature you can do with the plugin also is generating columns for a TableView . If you have a TableView , you can put the cursor on its declaration, press ALT + ENTER, and get a prompt to generate the columns (Figure 13.13). Figure 13.13 186

12. TornadoFX IDEA Plugin You will then see a dialog to confirm which Person properties to generate the columns on (Figure 14.14). Figure 13.14 Press "OK" and the columns will then be generated for you (Figure 13.15). Figure 13.15 187

GUIDE
GUIDE
GUIDE
Guide
Guide
GUIDE
GUIDE
GUIDE
Guide
GUIDE
Guide
GUIDE
Guide
GUIDE
GUIDE
GUIDE