Class ListEditorWrapper<T,​E extends Editor<? super T>>

  • Type Parameters:
    T - the type of data being edited
    E - the type of Editor
    All Implemented Interfaces:
    java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>

    class ListEditorWrapper<T,​E extends Editor<? super T>>
    extends java.util.AbstractList<T>
    Synchronizes a list of objects and a list of Editors.
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, T element)  
      (package private) void attach()
      Must be called after construction.
      (package private) void detach()  
      (package private) void flush()  
      T get​(int index)  
      (package private) java.util.List<? extends E> getEditors()
      For testing only.
      (package private) boolean isSameValue​(java.util.List<T> value)
      Checks whether that ListEditorWrapper can be reused for the passed list.
      (package private) void refresh()
      Refresh the editors in case the backing list has been modified from outside the ListEditorWrapper list.
      T remove​(int index)  
      T set​(int index, T element)  
      int size()  
      • Methods inherited from class java.util.AbstractList

        add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Method Detail

      • add

        public void add​(int index,
                        T element)
        Specified by:
        add in interface java.util.List<T>
        Overrides:
        add in class java.util.AbstractList<T>
      • get

        public T get​(int index)
        Specified by:
        get in interface java.util.List<T>
        Specified by:
        get in class java.util.AbstractList<T>
      • remove

        public T remove​(int index)
        Specified by:
        remove in interface java.util.List<T>
        Overrides:
        remove in class java.util.AbstractList<T>
      • set

        public T set​(int index,
                     T element)
        Specified by:
        set in interface java.util.List<T>
        Overrides:
        set in class java.util.AbstractList<T>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<T>
        Specified by:
        size in interface java.util.List<T>
        Specified by:
        size in class java.util.AbstractCollection<T>
      • attach

        void attach()
        Must be called after construction. This is a two-phase initialization so that ListEditor can assign its list field before any sub-editors might call ListEditor.getList()
      • detach

        void detach()
      • flush

        void flush()
      • getEditors

        java.util.List<? extends E> getEditors()
        For testing only.
      • isSameValue

        boolean isSameValue​(java.util.List<T> value)
        Checks whether that ListEditorWrapper can be reused for the passed list.

        The ListEditorWrapper can be reused if and only if the backing list is the same instance as the passed list.

      • refresh

        void refresh()
        Refresh the editors in case the backing list has been modified from outside the ListEditorWrapper list.

        This is basically the opposite from flush(). It's used to reuse sub-editors instead of recreating a ListEditorWrapper from scratch.