ObservableList

interface ObservableList<out E> : List<E> , Observable

A list, which can be observed by ListChangeListeners and InvalidationListeners.

Note, the collection names in Glok use Kotlin's naming convention. So an ObservableList is not mutable, whereas MutableObservableList is mutable.

Comparing Glok with JavaFX :

  • Glok : ObservableList -> JavaFX : ReadOnlyObservableList

  • Glok : MutableObservableList -> JavaFX : ObservableList

Class Diagram

                                            ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮
                       ╭╌╌╌╌╌╌╌╌╌╌╌╮        ┆    Observable    ┆           ╭╌╌╌╌╌╌╌╌╌╌╌╌╌╮
┌─────────────────────▶┆   List    ┆        ┆ addListener()    ┆           ┆ObservableInt┆
│                      ╰╌╌╌╌╌╌╌╌╌╌╌╯        ┆ removeListener() ┆           ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╯
│                            △              ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯                  △
│                            │                        △                           │
│                ┌───────────┴──────────────────┐     │                           │
│                │                       ╭╌╌╌╌╌╌┴╌╌╌╌╌┴╌╌╌╌╌╌╌╌╌╌╮       ┏━━━━━━━━┷━━━━━━━━━┓
│           ╭╌╌╌╌┴╌╌╌╌╌╌╮                ┆    ObservableList     ┆       ┃ObservableListSize┃
│  ┌───────▶┆MutableList┆                ┆ addChangeListener()   ┆◀──────┨                  ┃
│  │        ╰╌╌╌╌╌╌╌╌╌╌╌╯                ┆ removeChangeListener()┆       ┃                  ┃
│  │             △                       ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯       ┗━━━━━━━━━━━━━━━━━━┛
│  │             │                                    △
│  │             │                                    │
│  │             │      ┌─────────────────────────────┴──┬─────────────────────────────┐
│  │             │      │                                │                             │
│  │  ╭╌╌╌╌╌╌╌╌╌╌┴╌╌╌╌╌╌┴╌╌╌╮            ┏━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━┓     ┏━━━━━━━━━┷━━━━━━━━━┓
│  │  ┆MutableObservableList┆            ┃ReadOnlyObservableListWrapper┃     ┃EmptyObservableList┃
│  │  ┆                     ┆            ┃  actual : List              ┃     ┃                   ┃
│  │  ┆                     ┆            ┃                             ┃     ┗━━━━━━━━━━━━━━━━━━━┛
│  │  ╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯            ┃                             ┠────────────────────┐
│  │             △                       ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛                    │
│  │             │                                                                          │
│  │             │                                                                          │
│  │ ┏━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┓   ┌──────────────────────────┐ ┌───────────────────┐    │
│  │ ┃MutableObservableListWrapper┃   │    ListChangeListener    │ │    ListChange     │    │
│  └─┨  actual : MutableList      ┃◇──┤                          │ │ from : Int        │    │
│    ┃                            ┃   │ changed(List)│ │ added : List      │    │
│    ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛   └──────────────────────────┘ │ removed : List    │    │
│                                                                  │ isAddition()      │    │
│                                                                  │ isRemoval()       │    │
│                                                                  │ isReplacement()   │    │
│                                                                  └───────────────────┘    │
│                                                                                           │
└───────────────────────────────────────────────────────────────────────────────────────────┘

Created with Blokart

Inheritors

Properties

Link copied to clipboard
abstract override val size: Int

Functions

Link copied to clipboard
open fun addChangeListener(lambda: (list: ObservableList<E>, change: ListChange<E>) -> Unit): ListChangeListener<E>
Link copied to clipboard
abstract fun addListener(listener: InvalidationListener)
Link copied to clipboard
open fun addWeakChangeListener(lambda: (list: ObservableList<E>, change: ListChange<E>) -> Unit): ListChangeListener<E>
Link copied to clipboard
Link copied to clipboard

Wraps a regular list, creating a MutableObservableList.

Link copied to clipboard
abstract operator override fun contains(element: E): Boolean
Link copied to clipboard
abstract override fun containsAll(elements: Collection<E>): Boolean
Link copied to clipboard
abstract operator fun get(index: Int): E
Link copied to clipboard
abstract fun indexOf(element: E): Int
Link copied to clipboard
abstract override fun isEmpty(): Boolean
Link copied to clipboard
abstract operator override fun iterator(): Iterator<E>
Link copied to clipboard
abstract fun lastIndexOf(element: E): Int
Link copied to clipboard
abstract fun listIterator(): ListIterator<E>
abstract fun listIterator(index: Int): ListIterator<E>
Link copied to clipboard
Link copied to clipboard
abstract fun removeListener(listener: InvalidationListener)
Link copied to clipboard
Link copied to clipboard
abstract fun subList(fromIndex: Int, toIndex: Int): List<E>