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 23de3c7..8649ce5 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt @@ -5,4 +5,10 @@ import tornadofx.App class Main: App(StartupView::class){ + + + + + + } \ 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 9262660..91154d2 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 @@ -6,6 +6,7 @@ import com.jfoenix.controls.JFXTextField import javafx.geometry.Insets import javafx.geometry.Pos import javafx.scene.control.Label +import javafx.scene.input.KeyCode import javafx.scene.layout.Background import javafx.scene.layout.BackgroundFill import javafx.scene.layout.CornerRadii @@ -24,23 +25,36 @@ class StartupView : View() { val btnConnect = JFXButton("Manuell Verbinden") + private val svc: StartupViewController by inject() + override val root = borderpane { center = vbox(50) { maxWidth = 150.0 alignment = Pos.CENTER - add(labelStatus).apply { - labelStatus.background = Background(BackgroundFill(Color.YELLOWGREEN, CornerRadii.EMPTY, Insets.EMPTY)) - } + add(labelStatus) add(spinnerStatus) + labelStatus.apply { + this.background = Background(BackgroundFill(Color.YELLOWGREEN, CornerRadii.EMPTY, Insets.EMPTY)) + } + + spinnerStatus.isVisible = false + 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) + } + } } } diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupViewController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupViewController.kt index 51d22eb..90c321d 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupViewController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupViewController.kt @@ -4,6 +4,27 @@ import tornadofx.Controller class StartupViewController : Controller() { + fun btnConnectAction(txt:String){ + println("Connect BTN: $txt") + //TODO check IP4 + spinnterStart() + } + + fun spinnterStart(){ + val startupView = find(StartupView::class) + startupView.spinnerStatus.isVisible = true + } + + + fun spinnerStop(){ + val startupView = find(StartupView::class) + startupView.spinnerStatus.isVisible = false + } + + fun labelStatusSetText (txt:String){ + val startupView = find(StartupView::class) + startupView.labelStatus.text = txt + } } \ No newline at end of file