Reload search results after adding a new texture

Closes #54
This commit is contained in:
Lukas Fürderer 2019-06-17 20:19:54 +02:00
parent 74565e5744
commit f026a0dcf7
3 changed files with 10 additions and 3 deletions

View File

@ -310,9 +310,12 @@ class RootController : Controller() {
} }
} }
fun switchImportToMain() { fun switchImportToMain(needsReload: Boolean) {
Platform.runLater { Platform.runLater {
find(ImportView::class).replaceWith(MainView::class, ViewTransition.FadeThrough(0.01.seconds)) find(ImportView::class).replaceWith(MainView::class, ViewTransition.FadeThrough(0.01.seconds))
if (needsReload) {
find(MainView::class).repeatSearch()
}
} }
} }
} }

View File

@ -48,7 +48,7 @@ class ImportViewController : Controller() {
fun btnImportAction() { fun btnImportAction() {
rootc.importTexture(iv.tfFilePath.text, iv.tfName.text, iv.cvTags.chips) rootc.importTexture(iv.tfFilePath.text, iv.tfName.text, iv.cvTags.chips)
RootController.switchImportToMain() RootController.switchImportToMain(true)
reset() reset()
} }
@ -58,7 +58,7 @@ class ImportViewController : Controller() {
} }
fun btnBackAction() { fun btnBackAction() {
RootController.switchImportToMain() RootController.switchImportToMain(false)
reset() reset()
} }

View File

@ -19,6 +19,10 @@ class MainView : View("TextureSync") {
private val mvc: MainViewController by inject() private val mvc: MainViewController by inject()
fun repeatSearch() {
mvc.cvSearchAction(cvSearch.chips)
}
override val root = anchorpane { override val root = anchorpane {
background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY)) background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))