From 07f2682a2d17112ad197dd232ad2fca9c766c390 Mon Sep 17 00:00:00 2001 From: Seil0 Date: Sun, 9 Jun 2019 13:38:11 +0200 Subject: [PATCH] resize ImportView too --- .../controller/RootController.kt | 47 +++++++++---------- .../view/importView/ImportView.kt | 6 +-- .../view/importView/ImportViewController.kt | 4 +- .../view/mainView/MainView.kt | 2 +- .../view/mainView/MainViewController.kt | 2 +- 5 files changed, 30 insertions(+), 31 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 16fb1d1..8b34881 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt @@ -13,12 +13,12 @@ import org.hso.texturesyncclient.model.Sha256 import org.hso.texturesyncclient.model.Texture import org.hso.texturesyncclient.model.TextureFormat import org.hso.texturesyncclient.view.importView.ImportView -import org.hso.texturesyncclient.view.importView.ImportViewController import org.hso.texturesyncclient.view.mainView.MainView import org.hso.texturesyncclient.view.mainView.MainViewController import org.hso.texturesyncclient.view.startupView.StartupView import org.hso.texturesyncclient.view.startupView.StartupViewController import tornadofx.Controller +import tornadofx.find import tornadofx.observable import java.net.InetAddress import java.util.Calendar @@ -34,12 +34,10 @@ class RootController : Controller() { private val mvc: MainViewController by inject() private val svc: StartupViewController by inject() - private val ivc: ImportViewController by inject() private lateinit var con: Connection private lateinit var selectedTexture: Texture - private var lastExportDir: String = System.getProperty("user.home") /** @@ -167,26 +165,6 @@ class RootController : Controller() { return previewList } - // TODO this could be a companion object - fun switchStartupToMain() { - Platform.runLater { - find(StartupView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true) - } - } - - // These runLater calls should be unnecessary - fun switchMainToImport() { - Platform.runLater { - find(MainView::class).replaceWith(ImportView::class, sizeToScene = true, centerOnScreen = true) - } - } - - fun switchImportToMain() { - Platform.runLater { - find(ImportView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true) - } - } - /** * save the texture file to a local directory * @param data the texture as meta element @@ -286,7 +264,28 @@ class RootController : Controller() { /** * show all available textures at start */ - fun showAll() { + private fun showAll() { queryElements(mvc.getTags()) } + + companion object { + fun switchStartupToMain() { + Platform.runLater { + find(StartupView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true) + } + } + + // These runLater calls should be unnecessary + fun switchMainToImport() { + Platform.runLater { + find(MainView::class).replaceWith(ImportView::class, sizeToScene = true, centerOnScreen = true) + } + } + + fun switchImportToMain() { + Platform.runLater { + find(ImportView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true) + } + } + } } \ No newline at end of file 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 6cae806..20f4ede 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 @@ -18,7 +18,7 @@ class ImportView : View("TextureSync") { val tfName = JFXTextField() val cvTags = JFXChipView() val btnImport = JFXButton("Importieren") - val btnBack = JFXButton("Zurück") + private val btnBack = JFXButton("Zurück") private val ivc: ImportViewController by inject() @@ -27,8 +27,8 @@ class ImportView : View("TextureSync") { } override val root = borderpane { - minWidth = 1000.0 - minHeight = 500.0 + prefWidth = FX.primaryStage.width + prefHeight = FX.primaryStage.height background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY)) center = vbox(50) { 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 1df5ff2..84025c2 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 @@ -34,7 +34,7 @@ class ImportViewController : Controller() { fun btnImportAction() { rootc.importTexture(iv.tfFilePath.text, iv.tfName.text, iv.cvTags.chips) - rootc.switchImportToMain() + RootController.switchImportToMain() iv.tfFilePath.clear() iv.tfName.clear() iv.cvTags.chips.clear() @@ -46,7 +46,7 @@ class ImportViewController : Controller() { } fun btnBackAction() { - rootc.switchImportToMain() + RootController.switchImportToMain() iv.tfFilePath.clear() iv.tfName.clear() iv.cvTags.chips.clear() 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 7784fe5..39e8522 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 @@ -13,7 +13,7 @@ import tornadofx.* class MainView : View("TextureSync") { val cvSearch = JFXChipView() - val btnImport = JFXButton("+") + private val btnImport = JFXButton("+") val folderView = find(FolderView::class) val detailView = find(DetailView::class) 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 9358980..2310209 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 @@ -70,7 +70,7 @@ class MainViewController : Controller() { } fun btnImportAction() { - rootc.switchMainToImport() + RootController.switchMainToImport() } fun removeTextureFromView(data: Texture) {