You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
package nova.monadic_sfx.implicits
|
|
|
|
import com.jfoenix.{controls => jfoenixc}
|
|
import monix.execution.Scheduler
|
|
import monix.reactive.Observable
|
|
import scalafx.Includes._
|
|
import scalafx.collections.ObservableBuffer
|
|
import scalafx.scene.control.ListView
|
|
|
|
object JFXListView {
|
|
implicit def sfxListView2jfx[T](l: JFXListView[T]): jfoenixc.JFXListView[T] =
|
|
if (l != null) l.delegate else null
|
|
}
|
|
|
|
// extends Control(delegate)
|
|
// with SFXDelegate[jfoenixc.JFXListView[T]]
|
|
|
|
class JFXListView[T](
|
|
override val delegate: jfoenixc.JFXListView[T] = new jfoenixc.JFXListView[T]
|
|
) extends ListView[T] {
|
|
|
|
// def items_=(
|
|
// v: Observable[ObservableBuffer[T]]
|
|
// )(implicit s: Scheduler): Unit = {
|
|
// v.foreach { items() = _ }
|
|
// }
|
|
|
|
def items_=(
|
|
v: Observable[Seq[T]]
|
|
)(implicit s: Scheduler): Unit = {
|
|
v
|
|
.map {
|
|
// case buf: ObservableBuffer[T] => buf
|
|
case other => ObservableBuffer.from(other)
|
|
}
|
|
// .map(myDiff(items(), _))
|
|
.foreach { items() = _ }
|
|
}
|
|
|
|
def depth = delegate.depthProperty()
|
|
def depth_=(depth: Int) = delegate.setDepth(depth)
|
|
|
|
def expanded = delegate.expandedProperty()
|
|
def expanded_=(v: Boolean) = expanded() = v
|
|
|
|
|
|
|
|
}
|