diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportView.kt index 10ab930..53f62cf 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportView.kt @@ -19,6 +19,7 @@ class ImportView : View() { val tfName = JFXTextField() val cvTags = JFXChipView() 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() + } + } } \ No newline at end of file diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt index 83df2cc..097bb7b 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt @@ -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 } } -} \ No newline at end of file + + fun btnBackAction() { + rootc.switchImportToMain() + iv.tfFilePath.clear() + iv.tfName.clear() + iv.cvTags.chips.clear() + } +}