some clean up
This commit is contained in:
		@ -1,8 +0,0 @@
 | 
				
			|||||||
package org.hso.texturesyncclient.controller
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class NetworkController {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -241,29 +241,31 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        when (val pkg = Package.read(io.first)) {
 | 
					        when (val pkg = Package.read(io.first)) {
 | 
				
			||||||
            is JsonPackage -> {
 | 
					            is JsonPackage -> {
 | 
				
			||||||
                if (pkg.content == JsonPrimitive(true)) {
 | 
					                when {
 | 
				
			||||||
                    // everthing is fine!
 | 
					                    pkg.content == JsonPrimitive(true) -> // everthing is fine!
 | 
				
			||||||
                    return
 | 
					                        return
 | 
				
			||||||
                } else if (image != null) {
 | 
					                    image != null -> {
 | 
				
			||||||
                    // should be  { "get_texture_file": { texture_hash : <Hash> }}
 | 
					                        // should be  { "get_texture_file": { texture_hash : <Hash> }}
 | 
				
			||||||
                    // we don't check, since there is no good way to handle it.
 | 
					                        // we don't check, since there is no good way to handle it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    BinaryPackage(image).write(io.second)
 | 
					                        BinaryPackage(image).write(io.second)
 | 
				
			||||||
                    when (val ipkg = Package.read(io.first)) {
 | 
					                        when (val ipkg = Package.read(io.first)) {
 | 
				
			||||||
                        is JsonPackage -> {
 | 
					                            is JsonPackage -> {
 | 
				
			||||||
                            if (ipkg.content != JsonPrimitive(true)) {
 | 
					                                if (ipkg.content != JsonPrimitive(true)) {
 | 
				
			||||||
                                // Protokoll Assertion failed
 | 
					                                    // Protokoll Assertion failed
 | 
				
			||||||
                                throw ConnectionUnexpectedPacketException()
 | 
					                                    throw ConnectionUnexpectedPacketException()
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					                            is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
				
			||||||
 | 
					                            is ErrorPackage -> throw ConnectionErrorException(ipkg)
 | 
				
			||||||
 | 
					                            else -> throw RuntimeException("Unreachable")
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
					 | 
				
			||||||
                        is ErrorPackage -> throw ConnectionErrorException(ipkg)
 | 
					 | 
				
			||||||
                        else -> throw RuntimeException("Unreachable")
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } else {
 | 
					                    else -> {
 | 
				
			||||||
                    ErrorPackage(404, "Texture not found!").write(io.second)
 | 
					                        ErrorPackage(404, "Texture not found!").write(io.second)
 | 
				
			||||||
                    close() // gets re-opened on next request.
 | 
					                        close() // gets re-opened on next request.
 | 
				
			||||||
                    throw IllegalArgumentException("Image Argument was needed.")
 | 
					                        throw IllegalArgumentException("Image Argument was needed.")
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
					            is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ package org.hso.texturesyncclient.view.importView
 | 
				
			|||||||
import com.jfoenix.controls.JFXButton
 | 
					import com.jfoenix.controls.JFXButton
 | 
				
			||||||
import com.jfoenix.controls.JFXChipView
 | 
					import com.jfoenix.controls.JFXChipView
 | 
				
			||||||
import com.jfoenix.controls.JFXTextField
 | 
					import com.jfoenix.controls.JFXTextField
 | 
				
			||||||
import javafx.collections.ListChangeListener
 | 
					 | 
				
			||||||
import javafx.geometry.Pos
 | 
					import javafx.geometry.Pos
 | 
				
			||||||
import javafx.scene.layout.Background
 | 
					import javafx.scene.layout.Background
 | 
				
			||||||
import javafx.geometry.Insets
 | 
					import javafx.geometry.Insets
 | 
				
			||||||
@ -93,7 +92,7 @@ class ImportView : View() {
 | 
				
			|||||||
        tfFilePath.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
 | 
					        tfFilePath.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
 | 
				
			||||||
        tfName.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
 | 
					        tfName.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cvTags.chips.addListener { change: ListChangeListener.Change<out String>? ->
 | 
					        cvTags.chips.onChange {
 | 
				
			||||||
            ivc.validateImport()
 | 
					            ivc.validateImport()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
package org.hso.texturesyncclient.view.importView
 | 
					package org.hso.texturesyncclient.view.importView
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javafx.stage.FileChooser.ExtensionFilter
 | 
					 | 
				
			||||||
import org.hso.texturesyncclient.controller.RootController
 | 
					import org.hso.texturesyncclient.controller.RootController
 | 
				
			||||||
import tornadofx.Controller
 | 
					import tornadofx.Controller
 | 
				
			||||||
import javafx.stage.FileChooser
 | 
					import javafx.stage.FileChooser
 | 
				
			||||||
 | 
				
			|||||||
@ -26,7 +26,6 @@ class MainViewController : Controller() {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fun addAllElements(elementList: ArrayList<GUIModel>) {
 | 
					    fun addAllElements(elementList: ArrayList<GUIModel>) {
 | 
				
			||||||
        elementList.get(0).data
 | 
					 | 
				
			||||||
        folderView.children.addAll(elementList)
 | 
					        folderView.children.addAll(elementList)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,6 @@ package org.hso.texturesyncclient.view.startupView
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import org.hso.texturesyncclient.controller.RootController
 | 
					import org.hso.texturesyncclient.controller.RootController
 | 
				
			||||||
import org.hso.texturesyncclient.controller.SettingsController
 | 
					import org.hso.texturesyncclient.controller.SettingsController
 | 
				
			||||||
import org.hso.texturesyncclient.view.mainView.MainView
 | 
					 | 
				
			||||||
import tornadofx.ConfigProperties
 | 
					 | 
				
			||||||
import tornadofx.Controller
 | 
					import tornadofx.Controller
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -42,7 +40,7 @@ class StartupViewController : Controller() {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * show spinner and block textfied + button and set label
 | 
					     * show spinner and block textfied + button and set label
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    fun startConnectionUI() {
 | 
					    private fun startConnectionUI() {
 | 
				
			||||||
        sv.labelStatus.text = "Verbinden ..."
 | 
					        sv.labelStatus.text = "Verbinden ..."
 | 
				
			||||||
        sv.tfServerIP.isEditable = false
 | 
					        sv.tfServerIP.isEditable = false
 | 
				
			||||||
        sv.btnConnect.isDisable = true
 | 
					        sv.btnConnect.isDisable = true
 | 
				
			||||||
@ -52,7 +50,7 @@ class StartupViewController : Controller() {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * remove spinner and unblock textfied + button and set label
 | 
					     * remove spinner and unblock textfied + button and set label
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    fun endConnectionUI() {
 | 
					    private fun endConnectionUI() {
 | 
				
			||||||
        sv.spinnerStatus.isVisible = false
 | 
					        sv.spinnerStatus.isVisible = false
 | 
				
			||||||
        sv.labelStatus.text = "Verbindung zum Server einrichten"
 | 
					        sv.labelStatus.text = "Verbindung zum Server einrichten"
 | 
				
			||||||
        sv.tfServerIP.isEditable = true
 | 
					        sv.tfServerIP.isEditable = true
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user