All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.marid.fx.property.NestedObservableProperty.kt Maven / Gradle / Ivy

There is a newer version: 0.9.8.10
Show newest version
package org.marid.fx.property

import javafx.beans.InvalidationListener
import javafx.beans.Observable
import javafx.beans.property.SimpleObjectProperty

class NestedObservableProperty : SimpleObjectProperty {

  constructor() : super()
  constructor(initialValue: T) : super(initialValue)
  constructor(bean: Any, name: String) : super(bean, name)
  constructor(bean: Any, name: String, initialValue: T) : super(bean, name, initialValue)

  private val observer = InvalidationListener { fireValueChangedEvent() }

  init {
    value?.also { it.addListener(observer) }
    addListener { _, o, n ->
      o?.removeListener(observer)
      n?.addListener(observer)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy