09.04.2018 Views

tornadofx-guide

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Wizard<br />

class CustomerWizard : Wizard() {<br />

val customer: CustomerModel by inject()<br />

override val canGoNext = currentPageComplete<br />

override val canFinish = allPagesComplete<br />

}<br />

init {<br />

add(BasicData::class)<br />

add(AddressInput::class)<br />

}<br />

class BasicData : View("Basic Data") {<br />

val customer: CustomerModel by inject()<br />

override val complete = customer.valid(customer.name)<br />

}<br />

override val root = form {<br />

fieldset(title) {<br />

field("Type") {<br />

combobox(customer.type, Customer.Type.values().toList())<br />

}<br />

field("Name") {<br />

textfield(customer.name).required()<br />

}<br />

}<br />

}<br />

class AddressInput : View("Address") {<br />

val customer: CustomerModel by inject()<br />

override val complete = customer.valid(customer.zip, customer.city)<br />

}<br />

override val root = form {<br />

fieldset(title) {<br />

field("Zip/City") {<br />

textfield(customer.zip) {<br />

prefColumnCount = 5<br />

required()<br />

}<br />

textfield(customer.city).required()<br />

}<br />

}<br />

}<br />

Styling and adapting the look and feel<br />

275

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

Saved successfully!

Ooh no, something went wrong!