added back button in importview

This commit is contained in:
Hendrik Schutter 2019-06-07 13:25:33 +02:00
parent b2a84db5a7
commit 8e7ba1cb46
2 changed files with 17 additions and 4 deletions

View File

@ -19,6 +19,7 @@ class ImportView : View() {
val tfName = JFXTextField()
val cvTags = JFXChipView<String>()
val btnImport = JFXButton("Importieren")
val btnBack = JFXButton("Zurück")
private val ivc: ImportViewController by inject()
@ -69,9 +70,8 @@ class ImportView : View() {
vbox(5) {
alignment = Pos.CENTER
add(btnImport)
add(btnBack)
}
}
}
@ -87,6 +87,7 @@ class ImportView : View() {
//TODO change color of Chip´s see: https://github.com/jfoenixadmin/JFoenix/blob/master/jfoenix/src/main/resources/com/jfoenix/assets/css/controls/jfx-chip-view.css#L52
btnImport.style = "-fx-button-type: RAISED; -fx-background-color: #3c3f41; -fx-text-fill: #2b7bbb;"
btnBack.style = "-fx-button-type: RAISED; -fx-background-color: #3c3f41; -fx-text-fill: #2b7bbb; -fx-padding: 10 10 10 10;"
}
tfFilePath.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
@ -100,6 +101,10 @@ class ImportView : View() {
ivc.btnImportAction()
}
btnBack.setOnAction {
ivc.btnBackAction()
}
}
}

View File

@ -28,6 +28,14 @@ class ImportViewController : Controller() {
}
fun validateImport() {
iv.btnImport.isVisible = iv.tfFilePath.text.isNotEmpty() && iv.tfName.text.isNotEmpty() && iv.cvTags.chips.isNotEmpty() && iv.cvTags.chips.stream().allMatch { x -> x.length < 32 }
iv.btnImport.isVisible =
iv.tfFilePath.text.isNotEmpty() && iv.tfName.text.isNotEmpty() && iv.cvTags.chips.isNotEmpty() && iv.cvTags.chips.stream().allMatch { x -> x.length < 32 }
}
}
fun btnBackAction() {
rootc.switchImportToMain()
iv.tfFilePath.clear()
iv.tfName.clear()
iv.cvTags.chips.clear()
}
}