mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 19:35:00 -04:00
fix some crashes with bi map observation, bump kutil
This commit is contained in:
parent
737e4166b9
commit
bfacab5277
2
pom.xml
2
pom.xml
@ -457,7 +457,7 @@
|
||||
<dependency>
|
||||
<groupId>de.bixilon</groupId>
|
||||
<artifactId>kutil</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -1,6 +1,6 @@
|
||||
package de.bixilon.minosoft.config.profile
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||
import de.bixilon.kutil.exception.ExceptionUtil.tryCatch
|
||||
import de.bixilon.kutil.file.FileUtil
|
||||
@ -44,7 +44,7 @@ interface ProfileManager<T : Profile> {
|
||||
val icon: Ikon
|
||||
get() = FontAwesomeSolid.QUESTION
|
||||
|
||||
val profiles: HashBiMap<String, T>
|
||||
val profiles: AbstractMutableBiMap<String, T>
|
||||
var selected: T
|
||||
|
||||
@Deprecated("Should not be accessed") var currentLoadingPath: String?
|
||||
@ -195,7 +195,7 @@ interface ProfileManager<T : Profile> {
|
||||
}
|
||||
|
||||
fun getName(profile: T): String {
|
||||
return profiles.inverse()[profile] ?: "Unknown profile"
|
||||
return profiles.getKey(profile) ?: "Unknown profile"
|
||||
}
|
||||
|
||||
fun load(selected: String?) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.account
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object AccountProfileManager : ProfileManager<AccountProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, AccountProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, AccountProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: AccountProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.audio
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -19,7 +21,7 @@ object AudioProfileManager : ProfileManager<AudioProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, AudioProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, AudioProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: AudioProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.block
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object BlockProfileManager : ProfileManager<BlockProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, BlockProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, BlockProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: BlockProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.connection
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object ConnectionProfileManager : ProfileManager<ConnectionProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, ConnectionProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, ConnectionProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: ConnectionProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.controls
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object ControlsProfileManager : ProfileManager<ControlsProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, ControlsProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, ControlsProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: ControlsProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.entity
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object EntityProfileManager : ProfileManager<EntityProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, EntityProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, EntityProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: EntityProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.eros
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.delegate.BackingDelegate
|
||||
@ -29,7 +31,7 @@ object ErosProfileManager : ProfileManager<ErosProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, ErosProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, ErosProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: ErosProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.hud
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object HUDProfileManager : ProfileManager<HUDProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, HUDProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, HUDProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: HUDProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.other
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object OtherProfileManager : ProfileManager<OtherProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, OtherProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, OtherProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: OtherProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.particle
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object ParticleProfileManager : ProfileManager<ParticleProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, ParticleProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, ParticleProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: ParticleProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.rendering
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object RenderingProfileManager : ProfileManager<RenderingProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, RenderingProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, RenderingProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: RenderingProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles.resources
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.watchedBiMap
|
||||
import de.bixilon.minosoft.config.profile.GlobalProfileManager
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
@ -18,7 +20,7 @@ object ResourcesProfileManager : ProfileManager<ResourcesProfile> {
|
||||
|
||||
|
||||
override var currentLoadingPath: String? = null
|
||||
override val profiles: HashBiMap<String, ResourcesProfile> = HashBiMap.create()
|
||||
override val profiles: AbstractMutableBiMap<String, ResourcesProfile> by watchedBiMap(synchronizedBiMapOf())
|
||||
|
||||
override var selected: ResourcesProfile = null.unsafeCast()
|
||||
set(value) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.data.world.container.palette
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.data.world.container.palette.data.PaletteData
|
||||
import de.bixilon.minosoft.data.world.container.palette.palettes.Palette
|
||||
|
||||
@ -31,6 +32,6 @@ class PalettedContainer<T>(
|
||||
for (i in array.indices) {
|
||||
array[i] = palette.get(data.get(i)) as V
|
||||
}
|
||||
return array as Array<V>
|
||||
return array.unsafeCast()
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import de.bixilon.minosoft.gui.eros.dialog.profiles.ProfileCreateDialog
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil.ctext
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import de.bixilon.minosoft.util.delegate.JavaFXDelegate.observeMapFX
|
||||
import de.bixilon.minosoft.util.delegate.JavaFXDelegate.observeBiMapFX
|
||||
import javafx.fxml.FXML
|
||||
import javafx.geometry.HPos
|
||||
import javafx.geometry.Insets
|
||||
@ -75,7 +75,7 @@ class ProfilesListController : EmbeddedJavaFXController<Pane>() {
|
||||
}
|
||||
|
||||
fun initWatch() {
|
||||
profileManager!!::profiles.observeMapFX(this) {
|
||||
profileManager!!::profiles.observeBiMapFX(this) {
|
||||
profilesListViewFX.items -= it.removes.values()
|
||||
profilesListViewFX.items += it.adds.values()
|
||||
profilesListViewFX.refresh()
|
||||
|
@ -13,16 +13,22 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.eros.main.profiles.type
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.watcher.map.MapChange
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.observeBiMap
|
||||
import de.bixilon.minosoft.Minosoft
|
||||
import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.gui.eros.card.AbstractCardController
|
||||
import de.bixilon.minosoft.gui.eros.card.CardFactory
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil.text
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import de.bixilon.minosoft.util.delegate.JavaFXDelegate.observeFX
|
||||
import javafx.fxml.FXML
|
||||
import javafx.scene.text.TextFlow
|
||||
import org.kordamp.ikonli.javafx.FontIcon
|
||||
import kotlin.reflect.KProperty0
|
||||
|
||||
class ProfilesTypeCardController : AbstractCardController<ProfileManager<*>>() {
|
||||
@FXML private lateinit var iconFX: FontIcon
|
||||
@ -44,7 +50,7 @@ class ProfilesTypeCardController : AbstractCardController<ProfileManager<*>>() {
|
||||
headerFX.text = Minosoft.LANGUAGE_MANAGER.translate(item.namespace)
|
||||
|
||||
recalculate(item)
|
||||
item::profiles.observeFX(this) { recalculate(item) } // ToDo: Not a watchable map yet
|
||||
item::profiles.observeBiMapFX(this) { recalculate(item) }
|
||||
}
|
||||
|
||||
private fun recalculate(item: ProfileManager<*>) {
|
||||
@ -60,5 +66,10 @@ class ProfilesTypeCardController : AbstractCardController<ProfileManager<*>>() {
|
||||
|
||||
companion object : CardFactory<ProfilesTypeCardController> {
|
||||
override val LAYOUT = "minosoft:eros/main/profiles/profiles_type_card.fxml".toResourceLocation()
|
||||
|
||||
|
||||
private fun <K> KProperty0<AbstractMutableBiMap<K, *>>.observeBiMapFX(owner: Any, observer: (MapChange<K, Profile>) -> Unit) {
|
||||
this.unsafeCast<KProperty0<AbstractMutableBiMap<K, Profile>>>().observeBiMap(owner) { JavaFXUtil.runLater { observer(it) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package de.bixilon.minosoft.util.delegate
|
||||
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractBiMap
|
||||
import de.bixilon.kutil.watcher.DataWatcher.Companion.observe
|
||||
import de.bixilon.kutil.watcher.list.ListChange
|
||||
import de.bixilon.kutil.watcher.list.ListDataWatcher.Companion.observeList
|
||||
import de.bixilon.kutil.watcher.map.MapChange
|
||||
import de.bixilon.kutil.watcher.map.MapDataWatcher.Companion.observeMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.observeBiMap
|
||||
import de.bixilon.kutil.watcher.set.SetChange
|
||||
import de.bixilon.kutil.watcher.set.SetDataWatcher.Companion.observeSet
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
|
||||
@ -31,4 +33,9 @@ object JavaFXDelegate {
|
||||
fun <K, V> KProperty0<Map<K, V>>.observeMapFX(owner: Any, observer: (MapChange<K, V>) -> Unit) {
|
||||
this.observeMap(owner) { JavaFXUtil.runLater { observer(it) } }
|
||||
}
|
||||
|
||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
fun <K, V> KProperty0<AbstractBiMap<K, V>>.observeBiMapFX(owner: Any, observer: (MapChange<K, V>) -> Unit) {
|
||||
this.observeBiMap(owner) { JavaFXUtil.runLater { observer(it) } }
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package de.bixilon.minosoft.util.delegate
|
||||
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractBiMap
|
||||
import de.bixilon.kutil.watcher.DataWatcher.Companion.observe
|
||||
import de.bixilon.kutil.watcher.list.ListChange
|
||||
import de.bixilon.kutil.watcher.list.ListDataWatcher.Companion.observeList
|
||||
import de.bixilon.kutil.watcher.map.MapChange
|
||||
import de.bixilon.kutil.watcher.map.MapDataWatcher.Companion.observeMap
|
||||
import de.bixilon.kutil.watcher.map.bi.BiMapDataWatcher.Companion.observeBiMap
|
||||
import de.bixilon.kutil.watcher.set.SetChange
|
||||
import de.bixilon.kutil.watcher.set.SetDataWatcher.Companion.observeSet
|
||||
import de.bixilon.minosoft.gui.rendering.RenderWindow
|
||||
@ -49,4 +51,10 @@ object RenderingDelegate {
|
||||
val context = requireContext()
|
||||
this.observeMap(owner) { runInContext(context, it, observer) }
|
||||
}
|
||||
|
||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
fun <K, V> KProperty0<AbstractBiMap<K, V>>.observeBiMapRendering(owner: Any, observer: (MapChange<K, V>) -> Unit) {
|
||||
val context = requireContext()
|
||||
this.observeBiMap(owner) { runInContext(context, it, observer) }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user