diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt b/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt index 6bdc16c..0468b5d 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt @@ -9,6 +9,7 @@ import org.hso.texturesyncclient.model.GUIModel import org.hso.texturesyncclient.model.Sha256 import org.hso.texturesyncclient.model.Texture import org.hso.texturesyncclient.model.TextureFormat +import org.hso.texturesyncclient.view.importView.ImportView import org.hso.texturesyncclient.view.importView.ImportViewController import org.hso.texturesyncclient.view.mainView.MainView import org.hso.texturesyncclient.view.mainView.MainViewController @@ -16,7 +17,6 @@ import org.hso.texturesyncclient.view.startupView.StartupView import org.hso.texturesyncclient.view.startupView.StartupViewController import tornadofx.Controller import tornadofx.observable -import tornadofx.observableList import java.net.InetAddress import java.util.Calendar import java.io.File @@ -39,14 +39,6 @@ class RootController : Controller() { var test = GUIModel(data, img) test.exportItem.setOnAction { - } - mvc.addElement(test) - - data = Texture() - img = con.getTexturePreview(data.textureHash) - test = GUIModel(data, img) - test.exportItem.setOnAction { - } mvc.addElement(test)*/ } @@ -117,10 +109,16 @@ class RootController : Controller() { } - fun switchToMainView() { - Platform.runLater { //avoid the exception that occurs then this is called from an not tornadoFx thread - find(StartupView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true) - } + fun switchStartupToMain() { + find(StartupView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true) + } + + fun switchMainToImport() { + find(MainView::class).replaceWith(ImportView::class, sizeToScene = true, centerOnScreen = true) + } + + fun switchImportToMain() { + find(ImportView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true) } /** diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt index 6f8d26b..83df2cc 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt @@ -24,6 +24,7 @@ class ImportViewController : Controller() { fun btnImportAction() { rootc.importTexture(iv.tfFilePath.text, iv.tfName.text, iv.cvTags.chips) + rootc.switchImportToMain() } fun validateImport() { 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 785d85a..ee0e546 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 @@ -1,8 +1,10 @@ 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 @@ -16,6 +18,7 @@ class DetailView: View() { val preview = Preview3D() val metaLabel = Label("Auflösung: 8MP\nName: Texture.png\nAndere: was anderes") val cvTags = JFXChipView() + val btnImport = JFXButton("+") init { // set a default texture @@ -39,14 +42,40 @@ class DetailView: View() { } field { + minHeight = 145.0 add(cvTags) + + } + + field { + hbox(alignment = Pos.CENTER_RIGHT) { + add(btnImport) + } } // TODO add "Import" Btn } style { + cvTags.minHeight = 135.0 + cvTags.paddingAll = 3.0 cvTags.style = "-fx-background-color: #3c3f41; -fx-text-inner-color: #b15b2e;" + + btnImport.buttonType = JFXButton.ButtonType.RAISED + // TODO move this to a css file + btnImport.style = "-fx-background-color: #F1F1F1;\n" + + " -fx-background-radius: 50px;\n" + + " -fx-pref-height: 50px;\n" + + " -fx-pref-width: 50px;\n" + + " -fx-min-width: -fx-pref-width;\n" + + " -fx-max-width: -fx-pref-width;\n" + + " -fx-min-height: -fx-pref-height;\n" + + " -fx-max-height: -fx-pref-height;\n" + + "-jfx-button-type: RAISED;" + } + + btnImport.setOnAction { + } } 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 052cc6e..deda90f 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 @@ -65,6 +65,10 @@ class MainView : View() { mvc.updateTags() } + detailView.btnImport.setOnAction { + mvc.btnImportAction() + } + } } \ No newline at end of file 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 b30a3c9..a98e54b 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 @@ -3,14 +3,8 @@ package org.hso.texturesyncclient.view.mainView import javafx.collections.ObservableList import javafx.scene.image.Image import org.hso.texturesyncclient.model.GUIModel -import org.hso.texturesyncclient.model.TextureFormat import tornadofx.Controller -import javafx.stage.DirectoryChooser import org.hso.texturesyncclient.controller.RootController -import tornadofx.clear -import javax.swing.JColorChooser.showDialog -import java.io.File - class MainViewController : Controller() { @@ -25,7 +19,6 @@ class MainViewController : Controller() { private val metaLabel = mv.detailView.metaLabel private val cvTags = mv.detailView.cvTags - // FolderView functions fun addElement(element: GUIModel) { folderView.children.add(element) @@ -50,11 +43,12 @@ class MainViewController : Controller() { cvTags.chips.addAll(chips) } - // update the tags for the selected element fun updateTags() { println(cvTags.chips) } + // DetailView actions + fun cvSearchAction(tags: ObservableList) { var previewList = arrayListOf() @@ -73,6 +67,8 @@ class MainViewController : Controller() { } } - + fun btnImportAction() { + rootc.switchMainToImport() + } } \ No newline at end of file