2019-04-30 16:49:02 +02:00
package org.hso.texturesyncclient.view.importView
2019-05-01 22:38:30 +02:00
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
2019-06-14 01:12:33 +02:00
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
2019-06-14 01:12:33 +02:00
import javafx.scene.layout.Priority
2019-06-12 22:42:28 +02:00
import org.hso.texturesyncclient.view.mainView.Preview3D
2019-04-30 16:49:02 +02:00
import tornadofx.*
2019-06-08 14:39:18 +02:00
class ImportView : View ( " TextureSync " ) {
2019-04-30 16:49:02 +02:00
2019-05-01 22:38:30 +02:00
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 " )
2019-05-01 22:38:30 +02:00
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
}
2019-05-01 22:38:30 +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 ) )
2019-05-01 22:38:30 +02:00
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-05-01 22:38:30 +02:00
2019-06-12 22:42:28 +02:00
add ( preview )
2019-05-01 22:38:30 +02:00
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 ( )
}
}
2019-05-01 22:38:30 +02:00
}
vbox ( 5 ) {
2019-06-03 17:33:23 +02:00
label ( " Name " ) {
style = " -fx-font: 14px Verdana; -fx-text-fill: #2b7bbb; "
}
2019-05-01 22:38:30 +02:00
add ( tfName )
}
vbox ( 5 ) {
2019-06-03 17:33:23 +02:00
label ( " Tags " ) {
style = " -fx-font: 14px Verdana; -fx-text-fill: #2b7bbb; "
}
2019-05-01 22:38:30 +02:00
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
}
2019-05-01 22:38:30 +02:00
}
}
style {
2019-05-09 12:03:49 +02:00
tfFilePath . style = " -fx-text-fill: #b15b2e; "
2019-05-05 23:45:13 +02:00
tfFilePath . promptText = " Pfad zur Datei "
2019-05-01 22:38:30 +02:00
tfFilePath . hgrow = Priority . ALWAYS
2019-05-05 23:45:13 +02:00
tfName . style = " -fx-text-fill: #b15b2e; "
2019-05-09 12:03:49 +02:00
tfName . promptText = " Name eingeben "
2019-05-05 23:45:13 +02:00
2019-06-08 13:25:55 +02:00
cvTags . style = " -fx-background-color: #53585b; -fx-text-inner-color: #b15b2e; "
2019-06-03 18:08:48 +02:00
//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-05-01 22:38:30 +02:00
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; "
2019-06-14 01:12:33 +02:00
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
}
2019-06-14 01:12:33 +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-05-01 22:38:30 +02:00
}
2019-06-03 17:33:23 +02:00
btnImport . setOnAction {
ivc . btnImportAction ( )
2019-05-01 22:38:30 +02:00
}
2019-06-07 13:25:33 +02:00
btnBack . setOnAction {
ivc . btnBackAction ( )
}
2019-05-01 22:38:30 +02:00
}
2019-04-30 16:49:02 +02:00
}