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 3fbb4e9..044bd05 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt @@ -104,6 +104,7 @@ class RootController : Controller() { con.ping() println("auto Connection to Server successful") switchStartupToMain() + showAll() } else { println("[auto] no server found") } @@ -119,6 +120,7 @@ class RootController : Controller() { con.ping() println("[file] Connection to Server successful") switchStartupToMain() + showAll() } catch (e: Exception) { println(e) println("[file] Connection to Server NOT successful") @@ -135,6 +137,7 @@ class RootController : Controller() { println("Connection to Server successful") SettingsController.setServerAddress(name) //store address in settings file switchStartupToMain() + showAll() println("swithing to MainView @ initCon") } catch (e: Exception) { println(e) @@ -230,7 +233,12 @@ class RootController : Controller() { mvc.setPreview3DTexture(con.getTexturePreview(data.textureHash)) val sdf = SimpleDateFormat("dd.MM.yyyy") - mvc.setMeta(data.name, "${data.resolution.first}px x ${data.resolution.second}px", data.format.toString(), sdf.format(data.addedOn.time)) + mvc.setMeta( + data.name, + "${data.resolution.first}px x ${data.resolution.second}px", + data.format.toString(), + sdf.format(data.addedOn.time) + ) mvc.setTags(data.tags.toList().observable()) selectedTexture = data } @@ -255,7 +263,10 @@ class RootController : Controller() { dialogDelete.showAndWait() } - + /** + * send a changed texture to the server + * @param chips the new tag list + */ fun updateTexture(chips: ObservableList) { val uuid = UUID.randomUUID() val newTexture = Texture( @@ -270,4 +281,10 @@ class RootController : Controller() { con.updateTexture(selectedTexture, newTexture, con.getTextureFile(selectedTexture.textureHash)) } + /** + * show all available textures at start + */ + fun showAll() { + queryElements(mvc.getTags()) + } } \ No newline at end of file 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 0328166..e9f0544 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 @@ -26,11 +26,6 @@ class MainViewController : Controller() { folderView.children.add(element) } - fun addAllElements(elementList: ArrayList) { - folderView.children.addAll(elementList) - } - - // DetailView functions fun setPreview3DTexture(img: Image) { preview.setTexture(img) @@ -47,6 +42,10 @@ class MainViewController : Controller() { lockUpdate = true //allow update with onChange } + fun getTags(): ObservableList{ + return cvTags.chips + } + fun updateTags() { if (lockUpdate) { //the chipView was changed by the user println("Tags changed") @@ -74,7 +73,6 @@ class MainViewController : Controller() { rootc.switchMainToImport() } - fun removeTextureFromView(data: Texture) { // stream all children nodes, filter them as GUIModel with data.id == data.id, for any found object if it's still present remove it from the folderView folderView.children.stream().filter { x -> (x as GUIModel).data.id == data.id }.findAny()