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 />

We can see that the title and heading are indeed displaying separate information. Since<br />

we haven't made any edits yet, the Save button is disabled, while the Refresh button is<br />

available, and would roll back any changes made since the last commit.<br />

The back button is enabled as well, and clicking it would navigate back to the Customer<br />

list. This is a very powerful feature which enables browser like navigation in your application<br />

with very little effort on your part. The Workspace keeps a navigation stack of configurable<br />

depth. By default it will contain 10 previously docked views. You can configure the<br />

maxViewStackDepth to change the number of views held in the navigation stack.<br />

Alternative to overriding onSave and<br />

onRefresh<br />

Some times you want to access an object in one of the workbench button actions but you<br />

want to avoid creating a variable for that object. Instead you can use the whenSaved and<br />

whenRefreshed callbacks, which can be configured from anywhere. Important: They are<br />

alternatives to onSave and onRefresh so you should only do one or the other. Let's say we<br />

want to refresh a TableView when the Refresh button is clicked. We can configure this<br />

inside the builder for the TableView:<br />

237

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

Saved successfully!

Ooh no, something went wrong!