Created
January 1, 2019 23:35
-
-
Save bjonnh/eba80a5f7a49b4d0f76444a6bb4f33c0 to your computer and use it in GitHub Desktop.
Exception works in the controller not the view.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tornadofx.Controller | |
import tornadofx.EventBus | |
import tornadofx.FXEvent | |
class LogException(val ex: Exception) : FXEvent(EventBus.RunOn.ApplicationThread) | |
class ExceptionController: Controller() { | |
init { | |
subscribe<LogException> { | |
println("Received an exception "+ it.ex) | |
} | |
} | |
} | |
class LogView : View() { | |
lateinit var table: TableView<Exception> | |
val exceptionsList = mutableListOf<Exception>().observable() | |
override val root = hbox { | |
table = tableview(exceptionsList) { | |
readonlyColumn("cause", Exception::cause) | |
readonlyColumn("message", Exception::message) | |
} | |
} | |
init { | |
println("Setting up") | |
subscribe<LogException> { | |
println("Caught an exception in the logview "+it.ex) | |
exceptionsList.add(it.ex) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment