Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8101739

ObservableListBase

XMLWordPrintable


      public abstract class ObservableListBase<E> extends AbstractList<E> implements ObservableList<E>:

      First of all, it will implement following ObservableList methods:

      public final void addListener(InvalidationListener listener)
      public final void removeListener(InvalidationListener listener)
      public final void addListener(ListChangeListener<? super E> listener)
      public final void removeListener(ListChangeListener<? super E> listener)

      ... and will contain these new methods:

      // calls all the listeners of this ObservableList
      protected final void fireChange(ListChangeListener.Change<E> change)
      // true if there are some registered listeners
      protected final boolean hasListeners()

      protected final ListChangeBuilder<E> changeBuilder();

      The ListChangeBuilder class will look like this:

      public final void nextUpdate(int pos)
      public final void nextSet(int idx, E old)
      public final void nextReplace(int from, int to, ArrayList removed)
      public final void nextRemove(int idx, List removed)
      public final void nextRemove(int idx, E removed)
      public final void nextPermutation(int from, int to, int[] perm)
      public final void nextAdd(int from, int to)
      public final void endChange()
      public final void beginChange()

      All next* methods need to be enclosed in beginChange() / endChange() pair. The calls can be also nested and after the outermost endChange() call, callListeners() will be called with the newly created Change.

      public abstract class ModifiableObservableListBase<E> extends ObservableListBase<E>:

      This class introduces three new abstract methods:

       protected abstract void doAdd(int index, E element);
       protected abstract E doSet(int index, E element);
       protected abstract E doRemove(int index);

      These methods are meant to contain simple list manipulations. The ModifiableObservableListBase implementation takes care of Change construction (using ListChangeBuilder methods), but subclasses can override this behaviour.

            msladecek Martin Sládeček
            msladecek Martin Sládeček
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: