make window resizable, rework MainView code

This commit is contained in:
Jannik 2019-06-09 13:12:56 +02:00
parent 15cbbb1bac
commit 5d223ba72b
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
4 changed files with 45 additions and 51 deletions

View File

@ -13,9 +13,11 @@ class Main: App(StartupView::class){
override fun start(stage: Stage) {
stage.minWidth = 1000.00
stage.minHeight = 500.00
stage.isResizable = false
stage.minWidth = 1008.00
stage.minHeight = 535.00
stage.width = 1008.00
stage.height = 535.00
stage.isResizable = true
stage.icons.add(Image("icons/TextureSync_Icon_256x256.jpeg"))
stage.setOnCloseRequest { System.exit(0) }

View File

@ -1,10 +1,8 @@
package org.hso.texturesyncclient.view.mainView
import com.jfoenix.controls.JFXButton
import com.jfoenix.controls.JFXChipView
import javafx.geometry.Insets
import javafx.geometry.Orientation
import javafx.geometry.Pos
import javafx.scene.control.Label
import javafx.scene.image.Image
import javafx.scene.layout.Background
@ -18,7 +16,6 @@ class DetailView: View() {
val preview = Preview3D()
val metaLabel = Label("Auflösung: 8MP\nName: Texture.png\nAndere: was anderes\nEinfügedatum: 31.02.2019")
val cvTags = JFXChipView<String>()
val btnImport = JFXButton("+")
init {
// set a default texture
@ -49,12 +46,6 @@ class DetailView: View() {
}
field {
hbox(alignment = Pos.CENTER_RIGHT) {
add(btnImport)
}
}
}
style {
@ -63,9 +54,6 @@ class DetailView: View() {
cvTags.minHeight = 145.0
cvTags.paddingAll = 3.0
cvTags.style = "-fx-background-color: #53585b; -fx-text-inner-color: #b15b2e;"
btnImport.buttonType = JFXButton.ButtonType.RAISED
btnImport.styleClass.add("jfx-floating-action-button")
}
}

View File

@ -13,12 +13,7 @@ class FolderView : View("FolderView"){
hgap = 5.0
vgap = 5.0
paddingAll = 10.0
prefWidth = 732.0
prefHeight = 401.0
background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))
style {
}
}
}

View File

@ -1,8 +1,8 @@
package org.hso.texturesyncclient.view.mainView
import com.jfoenix.controls.JFXButton
import com.jfoenix.controls.JFXChipView
import javafx.geometry.Insets
import javafx.scene.control.ScrollPane
import javafx.scene.layout.Background
import javafx.scene.layout.BackgroundFill
@ -13,51 +13,60 @@ import tornadofx.*
class MainView : View("TextureSync") {
val cvSearch = JFXChipView<String>()
val btnImport = JFXButton("+")
val folderView = find(FolderView::class)
val detailView = find(DetailView::class)
private val mvc: MainViewController by inject()
override val root = borderpane {
override val root = anchorpane {
background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))
minWidth = 1000.0
maxWidth = 1000.0
minHeight = 500.0
maxHeight = 500.0
prefWidth = FX.primaryStage.width
prefHeight = FX.primaryStage.height
left = vbox {
//background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))
anchorpane{
this.fitToParentWidth()
paddingAll = 5.0
add(cvSearch)
add(cvSearch)
scrollpane {
style = "-fx-background-color:transparent;"
isFitToWidth = true
isFitToHeight = true
add(folderView.root)
anchorpaneConstraints {
topAnchor = 106
bottomAnchor = 0
leftAnchor = 0
rightAnchor = 255
}
anchorpane {
scrollpane {
this.fitToParentSize()
this.vbarPolicy = ScrollPane.ScrollBarPolicy.ALWAYS
add(folderView.root)
style = "-fx-background-color:transparent;"
}
}
}
right = detailView.root
add(detailView)
add(btnImport)
style {
cvSearch.promptText = "Suche"
cvSearch.paddingAll = 5.0
cvSearch.minHeight = 70.0
cvSearch.minHeight = 65.0
cvSearch.style = "-fx-background-color: #53585b; -fx-text-inner-color: #b15b2e;"
cvSearch.anchorpaneConstraints {
topAnchor = 3
bottomAnchor = 3
leftAnchor = 3
rightAnchor = -5
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
@ -65,12 +74,12 @@ class MainView : View("TextureSync") {
mvc.cvSearchAction(cvSearch.chips)
}
detailView.cvTags.chips.onChange {
mvc.updateTags()
btnImport.setOnAction {
mvc.btnImportAction()
}
detailView.btnImport.setOnAction {
mvc.btnImportAction()
detailView.cvTags.chips.onChange {
mvc.updateTags()
}
}