diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/DetailView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/DetailView.kt index fb41d84..67d3a5e 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/DetailView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/DetailView.kt @@ -14,12 +14,12 @@ import tornadofx.* class DetailView: View() { val preview = Preview3D() - val metaLabel = Label("Auflösung: 8MP\n Name: Texture.png\n Andere: was anderes") + val metaLabel = Label("Auflösung: 8MP\nName: Texture.png\nAndere: was anderes") val cvTags = JFXChipView() init { // set a default texture - preview.setTexture(Image("textures/sample_texture.jpg")) + preview.setTexture(Image("textures/sample_texture_1.jpg")) } override val root = form { diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/FolderView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/FolderView.kt index 6ed3611..a025996 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/FolderView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/FolderView.kt @@ -1,5 +1,6 @@ package org.hso.texturesyncclient.view.mainView +import com.jfoenix.controls.JFXButton import javafx.geometry.Insets import javafx.scene.control.TextField import javafx.scene.layout.Background @@ -10,12 +11,22 @@ import tornadofx.* class FolderView : View("FolderView"){ - val tf = TextField("FolderView") + val btn1 = JFXButton("Button 1") + val btn2 = JFXButton("Button 2") - override val root = gridpane { + override val root = flowpane { + hgap = 5.0 + vgap = 5.0 + paddingAll = 5.0 prefWidth = 750.0 background = Background(BackgroundFill(Paint.valueOf("#cfcfcf"), CornerRadii.EMPTY, Insets.EMPTY)) - add(tf) + add(btn1) + add(btn2) + + style { + btn1.style = "-fx-button-type: RAISED; -fx-background-color: #3c3f41; -fx-text-fill: #2b7bbb;" + btn2.style = "-fx-button-type: RAISED; -fx-background-color: #3c3f41; -fx-text-fill: #2b7bbb;" + } } } \ No newline at end of file diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt index 00282a3..b3dc78d 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt @@ -1,11 +1,13 @@ package org.hso.texturesyncclient.view.mainView +import javafx.collections.ListChangeListener +import javafx.scene.image.Image import tornadofx.* class MainView : View() { - private val folderView = find(FolderView::class) - private val detailView = find(DetailView::class) + val folderView = find(FolderView::class) + val detailView = find(DetailView::class) private val mvc: MainViewController by inject() @@ -21,6 +23,22 @@ class MainView : View() { } // actions + folderView.btn1.setOnAction { + mvc.setPreview3DTexture(Image("textures/sample_texture_1.jpg")) + mvc.setMeta("texture 1", "8MP", "Quelle: wikipedia") + mvc.setTags(observableList("Stein", "Rot", "super")) + } + + folderView.btn2.setOnAction { + mvc.setPreview3DTexture(Image("textures/sample_texture_2.jpg")) + mvc.setMeta("texture 2", "300 x 400", "Quelle: Internet") + mvc.setTags(observableList("Reality", "is", "an", "illusion")) + } + + detailView.cvTags.chips.addListener { change: ListChangeListener.Change? -> + mvc.updateTags() + } + } diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt index 6b30469..1c7c328 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt @@ -1,6 +1,37 @@ package org.hso.texturesyncclient.view.mainView +import javafx.collections.ObservableList +import javafx.scene.image.Image import tornadofx.Controller class MainViewController : Controller() { + + private val mv = find(MainView::class) + + // FolderView elements + + // DetailView elements + private val preview = mv.detailView.preview + private val metaLabel = mv.detailView.metaLabel + private val cvTags = mv.detailView.cvTags + + + fun setPreview3DTexture(img: Image) { + preview.setTexture(img) + } + + fun setMeta(name: String, res: String, etc: String) { + metaLabel.text = "Name: $name\nAuflösung: $res\nAnderes: $etc" + } + + fun setTags(chips: ObservableList) { + cvTags.chips.clear() + cvTags.chips.addAll(chips) + } + + // update the tags for the selected element + fun updateTags() { + println(cvTags.chips) + } + } \ No newline at end of file diff --git a/client/src/main/resources/textures/sample_texture.jpg b/client/src/main/resources/textures/sample_texture_1.jpg similarity index 100% rename from client/src/main/resources/textures/sample_texture.jpg rename to client/src/main/resources/textures/sample_texture_1.jpg diff --git a/client/src/main/resources/textures/sample_texture_2.jpg b/client/src/main/resources/textures/sample_texture_2.jpg new file mode 100644 index 0000000..5f98215 Binary files /dev/null and b/client/src/main/resources/textures/sample_texture_2.jpg differ