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
2019-06-03 17:33:23 +02:00
import javafx.collections.ListChangeListener
2019-05-01 22:38:30 +02:00
import javafx.geometry.Pos
2019-05-05 23:45:13 +02:00
import javafx.scene.layout.Background
import javafx.geometry.Insets
import javafx.scene.layout.BackgroundFill
import javafx.scene.layout.CornerRadii
import javafx.scene.paint.Paint
2019-05-01 22:38:30 +02:00
import javafx.scene.layout.Priority
2019-04-30 16:49:02 +02:00
import tornadofx.*
class ImportView : View ( ) {
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-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-05-01 22:38:30 +02:00
override val root = borderpane {
minWidth = 1000.0
minHeight = 500.0
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
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-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
cvTags . style = " -fx-background-color: #3c3f41; -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-03 17:33:23 +02:00
btnImport . style = " -fx-button-type: RAISED; -fx-background-color: #3c3f41; -fx-text-fill: #2b7bbb; "
}
tfFilePath . textProperty ( ) . addListener { _ , _ , _ -> ivc . validateImport ( ) }
tfName . textProperty ( ) . addListener { _ , _ , _ -> ivc . validateImport ( ) }
cvTags . chips . addListener { change : ListChangeListener . Change < out String > ? ->
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-04-30 16:49:02 +02:00
}