09.04.2018 Views

tornadofx-guide

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Workspaces<br />

Navigating between docked views<br />

Our Customer List is configured so that whenever you double click a customer you will be<br />

taken to an editor for that customer. The TableView binds the selected user to a<br />

CustomerModel view model object, and the action is performed like this:<br />

tableview(customers) {<br />

column("First Name", Customer::firstNameProperty)<br />

column("Last Name", Customer::lastNameProperty)<br />

bindSelected(model)<br />

onUserSelect { workspace.dock() }<br />

}<br />

The only thing we need to do is actually dock the CustomerEditor when the user selects a<br />

row. Since the CustomerEditor will be looked up in the same scope we are currently in, it<br />

will have access to the selected customer as well:<br />

235

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!