Class DecoratingObservableSet<E>

  • Type Parameters:
    E - the type of the elements in this set
    All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>, IDecoratingObservable, IObservable, IObservableCollection<E>, IObservableSet<E>

    public class DecoratingObservableSet<E>
    extends DecoratingObservableCollection<E>
    implements IObservableSet<E>
    An observable set which decorates another observable set.
    Since:
    1.2
    Implementation Note:
    If methods are added to the interface which this class implements then implementations of those methods must be added to this class.
    • Constructor Detail

      • DecoratingObservableSet

        public DecoratingObservableSet​(IObservableSet<E> decorated,
                                       boolean disposeDecoratedOnDispose)
        Constructs a DecoratingObservableSet which decorates the given observable.
        Parameters:
        decorated - the observable set being decorated
        disposeDecoratedOnDispose - whether the decorated observable should be disposed when the decorator is disposed
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E>
        Specified by:
        clear in interface java.util.Set<E>
        Overrides:
        clear in class DecoratingObservableCollection<E>
      • fireSetChange

        protected void fireSetChange​(SetDiff<E> diff)
      • handleSetChange

        protected void handleSetChange​(SetChangeEvent<? extends E> event)
        Called whenever a SetChangeEvent is received from the decorated observable. By default, this method fires the set change event again, with the decorating observable as the event source. Subclasses may override to provide different behavior.
        Parameters:
        event - the change event received from the decorated observable
      • dispose

        public void dispose()
        Description copied from interface: IObservable
        Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.
        Specified by:
        dispose in interface IObservable
        Overrides:
        dispose in class DecoratingObservableCollection<E>
      • addListener

        protected void addListener​(java.lang.Object listenerType,
                                   IObservablesListener listener)
        Parameters:
        listenerType - arbitrary object to identify a type of the listener
        listener - the listener to add; not null
      • removeListener

        protected void removeListener​(java.lang.Object listenerType,
                                      IObservablesListener listener)
        Parameters:
        listenerType - arbitrary object to identify a type of the listener
        listener - the listener to remove; not null
      • hasListeners

        protected boolean hasListeners()
      • getRealm

        public Realm getRealm()
        Returns:
        Returns the realm.
      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException