From 5976e16f0dfbf8f4031290ca685efd4867874141 Mon Sep 17 00:00:00 2001 From: Seil0 Date: Wed, 1 May 2019 22:38:30 +0200 Subject: [PATCH] Client: add ImportView and clean up StartupView --- .../org/hso/texturesyncclient/app/Main.kt | 1 + .../view/importView/ImportView.kt | 72 ++++++++++++++++++- .../view/importView/ImportViewController.kt | 4 ++ .../view/startupView/StartupView.kt | 38 +++++----- 4 files changed, 90 insertions(+), 25 deletions(-) diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt b/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt index 8649ce5..8094315 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt @@ -1,5 +1,6 @@ package org.hso.texturesyncclient.app +import org.hso.texturesyncclient.view.importView.ImportView import org.hso.texturesyncclient.view.startupView.StartupView import tornadofx.App 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 577573f..9ecbe4b 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 @@ -1,10 +1,76 @@ package org.hso.texturesyncclient.view.importView -import javafx.scene.Parent +import com.jfoenix.controls.JFXButton +import com.jfoenix.controls.JFXChipView +import com.jfoenix.controls.JFXTextField +import javafx.geometry.Pos +import javafx.scene.control.Label +import javafx.scene.layout.Priority +import javafx.scene.text.Font +import javafx.scene.text.FontWeight import tornadofx.* class ImportView : View() { - override val root: Parent - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + val labelHeading = Label("Textur hinzufügen") + val tfFilePath = JFXTextField() + val btnFileChooser = JFXButton("Datei öffnen") + val labelName = Label("Name") + val tfName = JFXTextField() + val labelTags = Label("Tags") + val cvTags = JFXChipView() + + private val ivc: ImportViewController by inject() + + + override val root = borderpane { + minWidth = 1000.0 + minHeight = 500.0 + + center = vbox(50) { + maxWidth = 350.0 + alignment = Pos.CENTER + + add(labelHeading) + + vbox(20) { + hbox(10) { + add(tfFilePath) + add(btnFileChooser) + } + + vbox(5) { + add(labelName) + add(tfName) + } + + vbox(5) { + add(labelTags) + add(cvTags) + } + } + + + } + + style { + labelHeading.font = Font.font("Verdana", FontWeight.MEDIUM, 40.0) + + tfFilePath.promptText = "Pfad ..." + tfFilePath.hgrow = Priority.ALWAYS + btnFileChooser.style = "-fx-button-type: RAISED; -fx-background-color: #FAAFFF; -fx-text-fill: BLACK;" + + labelName.style = "-fx-font: 14px Verdana; -fx-text-fill: BLACK;" + tfName.promptText = "Name ..." + + labelTags.style = "-fx-font: 14px Verdana; -fx-text-fill: BLACK;" + cvTags.style = "-fx-background-color: #FFFFFF;" + } + + btnFileChooser.setOnAction { + ivc.btnFileChooserAction() + } + + } + } \ No newline at end of file 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 54c3493..aa09ec0 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 @@ -3,4 +3,8 @@ package org.hso.texturesyncclient.view.importView import tornadofx.Controller class ImportViewController : Controller() { + + fun btnFileChooserAction() { + println("btn click") + } } \ No newline at end of file diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupView.kt index 91154d2..a61ba7c 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupView.kt @@ -16,18 +16,16 @@ import tornadofx.* class StartupView : View() { val labelStatus = Label("Verbinden") - val spinnerStatus = JFXSpinner() - val labelServerIP = Label("Server-IP") - val tfServerIP = JFXTextField() - val btnConnect = JFXButton("Manuell Verbinden") - private val svc: StartupViewController by inject() + private val svc: StartupViewController by inject() override val root = borderpane { + minWidth = 1000.0 + minHeight = 500.0 center = vbox(50) { maxWidth = 150.0 @@ -36,35 +34,31 @@ class StartupView : View() { add(labelStatus) add(spinnerStatus) - labelStatus.apply { - this.background = Background(BackgroundFill(Color.YELLOWGREEN, CornerRadii.EMPTY, Insets.EMPTY)) - } - - spinnerStatus.isVisible = false - - vbox(10){ + vbox(10) { alignment = Pos.CENTER add(labelServerIP) add(tfServerIP) add(btnConnect) - - btnConnect.apply { action { svc.btnConnectAction(tfServerIP.text)} } - tfServerIP.setOnKeyPressed { - if (it.code == KeyCode.ENTER){ - svc.btnConnectAction(tfServerIP.text) - } - } } } style { - minWidth = 900.px - minHeight = 600.px + labelStatus.background = Background(BackgroundFill(Color.YELLOWGREEN, CornerRadii.EMPTY, Insets.EMPTY)) + spinnerStatus.isVisible = false + } + + btnConnect.setOnAction { + svc.btnConnectAction(tfServerIP.text) + } + + tfServerIP.setOnKeyPressed { + if (it.code == KeyCode.ENTER) { + svc.btnConnectAction(tfServerIP.text) + } } } - } \ No newline at end of file