Client: add ImportView and clean up StartupView

This commit is contained in:
Jannik 2019-05-01 22:38:30 +02:00
parent cd8a3218d5
commit 5976e16f0d
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
4 changed files with 90 additions and 25 deletions

View File

@ -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

View File

@ -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<String>()
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()
}
}
}

View File

@ -3,4 +3,8 @@ package org.hso.texturesyncclient.view.importView
import tornadofx.Controller
class ImportViewController : Controller() {
fun btnFileChooserAction() {
println("btn click")
}
}

View File

@ -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)
}
}
}
}