Class ListModel<E>

    • Constructor Detail

      • ListModel

        public ListModel()
    • Method Detail

      • discard

        public void discard()
        Description copied from interface: IModel
        Discards the changes stored in the model buffer since last IModel.commit() operation.
        Specified by:
        discard in interface IModel
        Overrides:
        discard in class Model
      • isEqual

        public boolean isEqual​(List<E> other)
        Description copied from interface: IList
        Checks the list for equality with the current stored list.
        Specified by:
        isEqual in interface IList<E>
        Parameters:
        other - the other list to check.
        Returns:
        true if other list is equal to this list, false otherwise.
      • addListListener

        public void addListListener​(IListListener<E> listener)
        Description copied from interface: IList
        Adds the list listener.
        Specified by:
        addListListener in interface IList<E>
        Parameters:
        listener - the listener to add.
      • removeListListener

        public void removeListListener​(IListListener<E> listener)
        Description copied from interface: IList
        Removes the list listener.
        Specified by:
        removeListListener in interface IList<E>
        Parameters:
        listener - the listener to remove.
      • dispose

        public void dispose()
        Description copied from interface: IModel
        Disposes this model.
        Specified by:
        dispose in interface IModel
        Overrides:
        dispose in class Model
      • add

        public boolean add​(E e)
        Specified by:
        add in interface Collection<E>
        Specified by:
        add in interface List<E>
      • addAll

        public boolean addAll​(int index,
                              Collection<? extends E> c)
        Specified by:
        addAll in interface List<E>
      • get

        public E get​(int index)
        Specified by:
        get in interface List<E>
      • set

        public E set​(int index,
                     E element)
        Specified by:
        set in interface List<E>
      • add

        public void add​(int index,
                        E element)
        Specified by:
        add in interface List<E>
      • remove

        public E remove​(int index)
        Specified by:
        remove in interface List<E>
      • subList

        public List<E> subList​(int fromIndex,
                               int toIndex)
        Specified by:
        subList in interface List<E>
      • fill

        public void fill​(Collection<E> collection)
        Description copied from interface: IList
        Clears the current stored list and adds all elements of the given collection to the stored list.
        Specified by:
        fill in interface IList<E>
        Parameters:
        collection - the collection to add.
      • queueNotifyListChanged

        protected void queueNotifyListChanged()
        Queues the runnable that notifies the listeners about a change of this list. In fact it queues a runnable that performs notifyListChanged(ChangeOrigin).
      • getCommittedList

        protected final List<E> getCommittedList()
        Returns:
        the committed list, under normal conditions it should be in sync with data source.
      • getUncommittedList

        protected final List<E> getUncommittedList()
        Returns:
        the buffered but yet uncommitted list.
      • setCommittedList

        protected final void setCommittedList​(List<E> list)
        Sets the committed with the new value.
        Parameters:
        list - the new committed list to set.
      • setUncommitedList

        protected final void setUncommitedList​(List<E> list)
        Sets the uncommitted with the new value.
        Parameters:
        list - the new uncommitted list to set.
      • setList

        protected final void setList​(List<E> list)
        Makes copies of the given list and sets both committed and uncommitted lists at the same time.
        Parameters:
        list - the list to set.
      • notifyListChanged

        protected final void notifyListChanged​(ChangeOrigin changeOrigin)
        Notifies the listeners about a change of this list.
      • isElementEqual

        protected boolean isElementEqual​(E e1,
                                         E e2)
        Checks the equality of the two elements of the list.
        Parameters:
        e1 - the first element
        e2 - the second element
        Returns:
        true if the elements are equals, otherwise - false.