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

95 lines
2.5 KiB
Kotlin

package org.hso.texturesyncclient.view.mainView
import com.jfoenix.controls.JFXButton
import com.jfoenix.controls.JFXChipView
import javafx.geometry.Insets
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("TextureSync") {
val cvSearch = JFXChipView<String>()
private val btnImport = JFXButton("+")
val folderView = find(FolderView::class)
val detailView = find(DetailView::class)
private val mvc: MainViewController by inject()
override val root = anchorpane {
background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))
prefWidth = FX.primaryStage.width
prefHeight = FX.primaryStage.height
add(cvSearch)
scrollpane {
style = "-fx-background-color:transparent;"
isFitToWidth = true
isFitToHeight = true
add(folderView.root)
anchorpaneConstraints {
topAnchor = 106
bottomAnchor = 0
leftAnchor = 0
rightAnchor = 255
}
}
add(detailView)
add(btnImport)
style {
cvSearch.promptText = "Suche"
cvSearch.paddingAll = 5.0
cvSearch.minHeight = 65.0
cvSearch.style = "-fx-background-color: #53585b; -fx-text-inner-color: #b15b2e;"
cvSearch.anchorpaneConstraints {
topAnchor = 3
leftAnchor = 3
rightAnchor = 253
}
detailView.root.anchorpaneConstraints {
topAnchor = 0
bottomAnchor = 0
rightAnchor = 0
}
btnImport.buttonType = JFXButton.ButtonType.RAISED
btnImport.styleClass.add("jfx-floating-action-button")
btnImport.anchorpaneConstraints {
bottomAnchor = 5
rightAnchor = 5
}
}
// actions
cvSearch.chips.onChange {
mvc.cvSearchAction(cvSearch.chips)
}
btnImport.setOnAction {
mvc.btnImportAction()
}
detailView.cvTags.chips.onChange {
mvc.updateTags()
}
//keyboard actions
shortcut("Ctrl+I") {
mvc.btnImportAction()
}
shortcut("Ctrl+E") {
mvc.scExport()
}
}
}