From c36d81aa92d022cba12a06fc85d38293f406aab6 Mon Sep 17 00:00:00 2001 From: Seil0 Date: Mon, 3 Jun 2019 16:46:57 +0200 Subject: [PATCH] add addAllElements --- .../org/hso/texturesyncclient/app/Main.kt | 4 +-- .../controller/Controller.kt | 30 +++++++++++-------- .../view/mainView/MainViewController.kt | 7 +++-- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt b/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt index 1542cd7..f4a42da 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt @@ -6,8 +6,8 @@ import org.hso.texturesyncclient.view.mainView.MainView import org.hso.texturesyncclient.view.startupView.StartupView import tornadofx.App -class Main: App(MainView::class){ +class Main: App(ImportView::class){ - val controller = Controller() + //val controller = Controller() } \ No newline at end of file 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 4870f4d..7cebbfb 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/controller/Controller.kt @@ -1,27 +1,31 @@ package org.hso.texturesyncclient.controller -import javafx.scene.image.Image +import org.hso.texturesyncclient.controller.net.Connection import org.hso.texturesyncclient.model.GUIModel +import org.hso.texturesyncclient.model.Texture +import org.hso.texturesyncclient.view.importView.ImportViewController import org.hso.texturesyncclient.view.mainView.MainViewController +import org.hso.texturesyncclient.view.startupView.StartupViewController import tornadofx.Controller +import java.net.InetAddress class Controller : Controller() { private val mvc: MainViewController by inject() - //private val mvc: = MainViewController() - //private val mvc: = MainViewController() + private val svc: StartupViewController by inject() + private val ivc: ImportViewController by inject() + private val con = Connection(InetAddress.getByName("127.0.0.1")) init { - //TODO FIX ME! - /*var test1 = GUIModel() // TODO get image from server with get_texture_preview - test1.setImage(Image("textures/sample_texture_1.jpg")) - test1.setText("Texture 1") - mvc.addElement(test1) + /*var data = Texture() + var img = con.getTexturePreview(data.textureHash) + var test = GUIModel(data, img) + mvc.addElement(test) + + data = Texture() + img = con.getTexturePreview(data.textureHash) + test = GUIModel(data, img) + mvc.addElement(test)*/ - var test2 = GUIModel() - test2.setImage(Image("textures/sample_texture_2.jpg")) - test2.setText("Texture 2") - mvc.addElement(test2) - */ } } \ 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 1307a8e..b762f49 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 @@ -4,7 +4,6 @@ import javafx.collections.ObservableList import javafx.scene.image.Image import org.hso.texturesyncclient.model.GUIModel import tornadofx.Controller -import tornadofx.add class MainViewController : Controller() { @@ -21,7 +20,11 @@ class MainViewController : Controller() { // FolderView functions fun addElement(element: GUIModel) { - folderView.add(element) + folderView.children.add(element) + } + + fun addAllElements(elementList: List) { + folderView.children.addAll(elementList) }