JavaFXDelegate: don't instantly fire

This fixes a crash when connecting to servers
This commit is contained in:
Bixilon 2022-11-28 17:47:35 +01:00
parent 94571f207f
commit bf33b342aa
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 5 additions and 6 deletions

View File

@ -38,7 +38,6 @@ class ConnectingDialog(
JavaFXUtil.openModalAsync(TITLE, LAYOUT, this) { update(connection.state) }
}
override fun init() {
headerFX.text = HEADER
cancelButtonFX.isDisable = true

View File

@ -35,31 +35,31 @@ object JavaFXDelegate {
}
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
fun <V> KProperty0<V>.observeFX(owner: Any, instant: Boolean = true, observer: (V) -> Unit) {
fun <V> KProperty0<V>.observeFX(owner: Any, instant: Boolean = false, observer: (V) -> Unit) {
checkErosState()
this.observe(owner, instant) { JavaFXUtil.runLater { observer(it) } }
}
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
fun <V> KProperty0<Set<V>>.observeSetFX(owner: Any, instant: Boolean = true, observer: (SetChange<V>) -> Unit) {
fun <V> KProperty0<Set<V>>.observeSetFX(owner: Any, instant: Boolean = false, observer: (SetChange<V>) -> Unit) {
checkErosState()
this.observeSet(owner, instant) { JavaFXUtil.runLater { observer(it) } }
}
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
fun <V> KProperty0<List<V>>.observeListFX(owner: Any, instant: Boolean = true, observer: (ListChange<V>) -> Unit) {
fun <V> KProperty0<List<V>>.observeListFX(owner: Any, instant: Boolean = false, observer: (ListChange<V>) -> Unit) {
checkErosState()
this.observeList(owner, instant) { JavaFXUtil.runLater { observer(it) } }
}
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
fun <K, V> KProperty0<Map<K, V>>.observeMapFX(owner: Any, instant: Boolean = true, observer: (MapChange<K, V>) -> Unit) {
fun <K, V> KProperty0<Map<K, V>>.observeMapFX(owner: Any, instant: Boolean = false, observer: (MapChange<K, V>) -> Unit) {
checkErosState()
this.observeMap(owner, instant) { JavaFXUtil.runLater { observer(it) } }
}
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
fun <K, V> KProperty0<AbstractBiMap<K, V>>.observeBiMapFX(owner: Any, instant: Boolean = true, observer: (MapChange<K, V>) -> Unit) {
fun <K, V> KProperty0<AbstractBiMap<K, V>>.observeBiMapFX(owner: Any, instant: Boolean = false, observer: (MapChange<K, V>) -> Unit) {
checkErosState()
this.observeBiMap(owner, instant) { JavaFXUtil.runLater { observer(it) } }
}