Class PluggableList<E>

    • Constructor Detail

      • PluggableList

        public PluggableList​(EventList<E> source)
        Constructs a PluggableList which delegates all List methods to the given source. At some future time, the source EventList may be replaced using setSource(EventList) and this PluggableList will produce a ListEvent describing the change in data.
        Parameters:
        source - the source of data to this PluggableList
    • Method Detail

      • setSource

        public void setSource​(EventList<E> source)
        Sets the source EventList to which this PluggableList will delegate all calls. This method is the entire reason that PluggableList exists. It allows the data source of the remaining pipeline to be altered.

        To ensure correct behaviour when this PluggableList is used by multiple threads, the given source must share the same ReadWriteLock and ListEventPublisher with this PluggableList.

        Parameters:
        source - the new source of data for this PluggableList, and all downstream EventLists
        Throws:
        java.lang.IllegalStateException - if this PluggableList is already disposed
        java.lang.IllegalArgumentException - if any of the following are true
        • the given source is null
        • the given source has a different ListEventPublisher than this PluggableList
        • the given source has a different ReadWriteLock than this PluggableList
      • isWritable

        protected boolean isWritable()
        Description copied from class: TransformedList
        Gets whether the source EventList is writable via this API.

        Extending classes must override this method in order to make themselves writable.

        Specified by:
        isWritable in class TransformedList<E,​E>
      • listChanged

        public void listChanged​(ListEvent<E> listChanges)
        Description copied from class: TransformedList
        When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary.

        It is mandatory that the calling thread has obtained the write lock on the source list. This is because the calling thread will have written to the source list to cause this event. This condition guarantees that no writes can occur while the listener is handling this event. It is an error to write to the source list while processing an event.

        Specified by:
        listChanged in interface ListEventListener<E>
        Specified by:
        listChanged in class TransformedList<E,​E>
        Parameters:
        listChanges - a ListEvent describing the changes to the list