diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt b/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt index 07d60d4..c29a3b5 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt @@ -121,12 +121,16 @@ class RootController : Controller() { } } - fun search(tags: ObservableList): ArrayList { + fun queryElements(tags: ObservableList): ArrayList { val previewList = arrayListOf() try { con.query(tags.toTypedArray()).forEach { - previewList.add(GUIModel(it, con.getTexturePreview(it.textureHash))) + runAsync { + Platform.runLater { + mvc.addElement(GUIModel(it, con.getTexturePreview(it.textureHash))) + } + } } } catch (e: Exception) { println(e) 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 deda90f..2953bd8 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 @@ -14,7 +14,6 @@ import tornadofx.* class MainView : View() { val cvSearch = JFXChipView() - val spinnerSearch = JFXSpinner() val folderView = find(FolderView::class) val detailView = find(DetailView::class) @@ -35,7 +34,6 @@ class MainView : View() { this.vbarPolicy = ScrollPane.ScrollBarPolicy.ALWAYS add(folderView.root) } - add(spinnerSearch) } } @@ -43,14 +41,6 @@ class MainView : View() { right = detailView.root style { - spinnerSearch.isVisible = false - spinnerSearch.anchorpaneConstraints { - topAnchor = 150 - bottomAnchor = 150 - leftAnchor = 150 - rightAnchor = 150 - } - cvSearch.paddingAll = 7.0 cvSearch.minHeight = 70.0 cvSearch.style = "-fx-background-color: #3c3f41; -fx-text-inner-color: #b15b2e;" diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt index b61c3bf..5330fb8 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt @@ -51,23 +51,17 @@ class MainViewController : Controller() { // DetailView actions fun cvSearchAction(tags: ObservableList) { - var previewList = arrayListOf() - // show spinner, block ui folderView.children.clear() - mv.spinnerSearch.isVisible = true mv.cvSearch.isDisable = true runAsync { - previewList = rootc.search(tags) + //previewList = rootc.search(tags) + rootc.queryElements(tags) } ui { // when search finished - addAllElements(previewList) - mv.spinnerSearch.isVisible = false mv.cvSearch.isDisable = false } - - } fun btnImportAction() {