TextureSync/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt

64 lines
1.8 KiB
Kotlin

package org.hso.texturesyncclient.view.mainView
import com.jfoenix.controls.JFXChipView
import com.jfoenix.controls.JFXSpinner
import com.jfoenix.controls.JFXTextField
import javafx.collections.ListChangeListener
import javafx.geometry.Insets
import javafx.scene.image.Image
import javafx.scene.layout.Background
import javafx.scene.layout.BackgroundFill
import javafx.scene.layout.CornerRadii
import javafx.scene.paint.Paint
import tornadofx.*
class MainView : View() {
val cvSearch = JFXChipView<String>()
val spinnerSearch = JFXSpinner()
val folderView = find(FolderView::class)
val detailView = find(DetailView::class)
private val mvc: MainViewController by inject()
override val root = borderpane {
minWidth = 1000.0
maxWidth = 1000.0
minHeight = 500.0
maxHeight = 500.0
background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))
left = vbox {
prefWidth = 750.0
add(cvSearch)
scrollpane {
add(folderView.root)
}
}
right = detailView.root
style {
spinnerSearch.isVisible = false
cvSearch.paddingAll = 7.0
cvSearch.style = "-fx-background-color: #3c3f41; -fx-text-inner-color: #b15b2e;" // TODO fix text color
cvSearch.style {
minHeight = Dimension(74.0, Dimension.LinearUnits.px)
}
}
// actions
cvSearch.chips.addListener { change: ListChangeListener.Change<out String>? ->
mvc.cvSearchAction(cvSearch.chips)
}
detailView.cvTags.chips.addListener { change: ListChangeListener.Change<out String>? ->
mvc.updateTags()
}
}
}