From f026a0dcf7220989f85f0819f85fac24750316c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20F=C3=BCrderer?= Date: Mon, 17 Jun 2019 20:19:54 +0200 Subject: [PATCH] Reload search results after adding a new texture Closes #54 --- .../org/hso/texturesyncclient/controller/RootController.kt | 5 ++++- .../view/importView/ImportViewController.kt | 4 ++-- .../org/hso/texturesyncclient/view/mainView/MainView.kt | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt index 43046be..b30b0a3 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt @@ -310,9 +310,12 @@ class RootController : Controller() { } } - fun switchImportToMain() { + fun switchImportToMain(needsReload: Boolean) { Platform.runLater { find(ImportView::class).replaceWith(MainView::class, ViewTransition.FadeThrough(0.01.seconds)) + if (needsReload) { + find(MainView::class).repeatSearch() + } } } } 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 fae7398..6c5a23e 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 @@ -48,7 +48,7 @@ class ImportViewController : Controller() { fun btnImportAction() { rootc.importTexture(iv.tfFilePath.text, iv.tfName.text, iv.cvTags.chips) - RootController.switchImportToMain() + RootController.switchImportToMain(true) reset() } @@ -58,7 +58,7 @@ class ImportViewController : Controller() { } fun btnBackAction() { - RootController.switchImportToMain() + RootController.switchImportToMain(false) reset() } diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt index e360b61..2f10ace 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt @@ -19,6 +19,10 @@ class MainView : View("TextureSync") { private val mvc: MainViewController by inject() + fun repeatSearch() { + mvc.cvSearchAction(cvSearch.chips) + } + override val root = anchorpane { background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))