some clean up

This commit is contained in:
Jannik 2019-06-07 14:01:16 +02:00
parent f45d807536
commit 2c9a23ec8a
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
6 changed files with 24 additions and 35 deletions

View File

@ -1,8 +0,0 @@
package org.hso.texturesyncclient.controller
class NetworkController {
}

View File

@ -241,29 +241,31 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
when (val pkg = Package.read(io.first)) {
is JsonPackage -> {
if (pkg.content == JsonPrimitive(true)) {
// everthing is fine!
return
} else if (image != null) {
// should be { "get_texture_file": { texture_hash : <Hash> }}
// we don't check, since there is no good way to handle it.
when {
pkg.content == JsonPrimitive(true) -> // everthing is fine!
return
image != null -> {
// should be { "get_texture_file": { texture_hash : <Hash> }}
// we don't check, since there is no good way to handle it.
BinaryPackage(image).write(io.second)
when (val ipkg = Package.read(io.first)) {
is JsonPackage -> {
if (ipkg.content != JsonPrimitive(true)) {
// Protokoll Assertion failed
throw ConnectionUnexpectedPacketException()
BinaryPackage(image).write(io.second)
when (val ipkg = Package.read(io.first)) {
is JsonPackage -> {
if (ipkg.content != JsonPrimitive(true)) {
// Protokoll Assertion failed
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 {
ErrorPackage(404, "Texture not found!").write(io.second)
close() // gets re-opened on next request.
throw IllegalArgumentException("Image Argument was needed.")
else -> {
ErrorPackage(404, "Texture not found!").write(io.second)
close() // gets re-opened on next request.
throw IllegalArgumentException("Image Argument was needed.")
}
}
}
is BinaryPackage -> throw ConnectionUnexpectedPacketException()

View File

@ -3,7 +3,6 @@ package org.hso.texturesyncclient.view.importView
import com.jfoenix.controls.JFXButton
import com.jfoenix.controls.JFXChipView
import com.jfoenix.controls.JFXTextField
import javafx.collections.ListChangeListener
import javafx.geometry.Pos
import javafx.scene.layout.Background
import javafx.geometry.Insets
@ -93,7 +92,7 @@ class ImportView : View() {
tfFilePath.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
tfName.textProperty().addListener{ _, _, _ -> ivc.validateImport() }
cvTags.chips.addListener { change: ListChangeListener.Change<out String>? ->
cvTags.chips.onChange {
ivc.validateImport()
}

View File

@ -1,6 +1,5 @@
package org.hso.texturesyncclient.view.importView
import javafx.stage.FileChooser.ExtensionFilter
import org.hso.texturesyncclient.controller.RootController
import tornadofx.Controller
import javafx.stage.FileChooser

View File

@ -26,7 +26,6 @@ class MainViewController : Controller() {
}
fun addAllElements(elementList: ArrayList<GUIModel>) {
elementList.get(0).data
folderView.children.addAll(elementList)
}

View File

@ -2,8 +2,6 @@ package org.hso.texturesyncclient.view.startupView
import org.hso.texturesyncclient.controller.RootController
import org.hso.texturesyncclient.controller.SettingsController
import org.hso.texturesyncclient.view.mainView.MainView
import tornadofx.ConfigProperties
import tornadofx.Controller
@ -42,7 +40,7 @@ class StartupViewController : Controller() {
/**
* show spinner and block textfied + button and set label
*/
fun startConnectionUI() {
private fun startConnectionUI() {
sv.labelStatus.text = "Verbinden ..."
sv.tfServerIP.isEditable = false
sv.btnConnect.isDisable = true
@ -52,7 +50,7 @@ class StartupViewController : Controller() {
/**
* remove spinner and unblock textfied + button and set label
*/
fun endConnectionUI() {
private fun endConnectionUI() {
sv.spinnerStatus.isVisible = false
sv.labelStatus.text = "Verbindung zum Server einrichten"
sv.tfServerIP.isEditable = true