TextureSync/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportView.kt

116 lines
3.6 KiB
Kotlin
Raw Normal View History

package org.hso.texturesyncclient.view.importView
import com.jfoenix.controls.JFXButton
import com.jfoenix.controls.JFXChipView
import com.jfoenix.controls.JFXTextField
import javafx.geometry.Pos
2019-05-05 23:45:13 +02:00
import javafx.scene.layout.Background
import javafx.geometry.Insets
2019-05-05 23:45:13 +02:00
import javafx.scene.layout.BackgroundFill
import javafx.scene.layout.CornerRadii
2019-06-14 01:09:30 +02:00
import javafx.scene.paint.Paint
import javafx.scene.layout.Priority
2019-06-12 22:42:28 +02:00
import org.hso.texturesyncclient.view.mainView.Preview3D
import tornadofx.*
class ImportView : View("TextureSync") {
val tfFilePath = JFXTextField()
val tfName = JFXTextField()
val cvTags = JFXChipView<String>()
2019-06-03 17:33:23 +02:00
val btnImport = JFXButton("Importieren")
2019-06-12 22:42:28 +02:00
val preview = Preview3D()
2019-06-09 13:38:11 +02:00
private val btnBack = JFXButton("Zurück")
private val ivc: ImportViewController by inject()
2019-06-03 17:33:23 +02:00
init {
btnImport.isVisible = false
2019-06-12 22:42:28 +02:00
preview.root.isVisible = false
2019-06-03 17:33:23 +02:00
}
override val root = borderpane {
2019-06-09 13:38:11 +02:00
prefWidth = FX.primaryStage.width
prefHeight = FX.primaryStage.height
2019-05-05 23:45:13 +02:00
background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))
center = vbox(50) {
maxWidth = 350.0
alignment = Pos.CENTER
2019-06-03 17:33:23 +02:00
label("Textur hinzufügen") {
style = "-fx-font: 20px Verdana; -fx-text-fill: #2b7bbb;"
}
2019-06-12 22:42:28 +02:00
add(preview)
vbox(20) {
hbox(10) {
add(tfFilePath)
2019-06-03 17:33:23 +02:00
button("Datei öffnen") {
style = "-fx-button-type: RAISED; -fx-background-color: #3c3f41; -fx-text-fill: #2b7bbb;"
setOnAction {
ivc.btnFileChooserAction()
ivc.validateImport()
}
}
}
vbox(5) {
2019-06-03 17:33:23 +02:00
label("Name") {
style = "-fx-font: 14px Verdana; -fx-text-fill: #2b7bbb;"
}
add(tfName)
}
vbox(5) {
2019-06-03 17:33:23 +02:00
label("Tags") {
style = "-fx-font: 14px Verdana; -fx-text-fill: #2b7bbb;"
}
add(cvTags)
}
2019-06-03 17:33:23 +02:00
vbox(5) {
alignment = Pos.CENTER
add(btnImport)
2019-06-07 13:25:33 +02:00
add(btnBack)
2019-06-03 17:33:23 +02:00
}
}
}
style {
tfFilePath.style = "-fx-text-fill: #b15b2e;"
2019-05-05 23:45:13 +02:00
tfFilePath.promptText = "Pfad zur Datei"
tfFilePath.hgrow = Priority.ALWAYS
2019-05-05 23:45:13 +02:00
tfName.style = "-fx-text-fill: #b15b2e;"
tfName.promptText = "Name eingeben"
2019-05-05 23:45:13 +02:00
cvTags.style = "-fx-background-color: #53585b; -fx-text-inner-color: #b15b2e;"
//TODO change color of Chip´s see: https://github.com/jfoenixadmin/JFoenix/blob/master/jfoenix/src/main/resources/com/jfoenix/assets/css/controls/jfx-chip-view.css#L52
2019-06-17 23:00:19 +02:00
btnImport.style = "-fx-button-type: RAISED; -fx-background-color: #b15b2e; -fx-text-fill: #3c3f41; -fx-font-size: 15;"
btnBack.style = "-fx-button-type: RAISED; -fx-background-color: #3c3f41; -fx-text-fill: #2b7bbb; -fx-padding: 10;"
2019-06-03 17:33:23 +02:00
}
tfFilePath.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
tfName.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
2019-06-03 17:33:23 +02:00
2019-06-07 14:01:16 +02:00
cvTags.chips.onChange {
2019-06-03 17:33:23 +02:00
ivc.validateImport()
}
2019-06-03 17:33:23 +02:00
btnImport.setOnAction {
ivc.btnImportAction()
}
2019-06-07 13:25:33 +02:00
btnBack.setOnAction {
ivc.btnBackAction()
}
}
}