Class DecoratingObservableSet<E>

Type Parameters:
E - the type of the elements in this set
All Implemented Interfaces:
Iterable<E>, Collection<E>, 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 Details

    • 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 Details

    • clear

      public void clear()
      Specified by:
      clear in interface Collection<E>
      Specified by:
      clear in interface Set<E>
      Overrides:
      clear in class DecoratingObservableCollection<E>
    • addSetChangeListener

      public void addSetChangeListener(ISetChangeListener<? super E> listener)
      Specified by:
      addSetChangeListener in interface IObservableSet<E>
      Parameters:
      listener - the change listener to add; not null
    • removeSetChangeListener

      public void removeSetChangeListener(ISetChangeListener<? super E> listener)
      Specified by:
      removeSetChangeListener in interface IObservableSet<E>
      Parameters:
      listener - the change listener to remove; not null
    • fireSetChange

      protected void fireSetChange(SetDiff<E> diff)
    • fireChange

      protected void fireChange()
      Overrides:
      fireChange in class AbstractObservable
    • firstListenerAdded

      protected void firstListenerAdded()
      Overrides:
      firstListenerAdded in class DecoratingObservable
    • lastListenerRemoved

      protected void lastListenerRemoved()
      Overrides:
      lastListenerRemoved in class DecoratingObservable
    • 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(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(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()
    • fireEvent

      protected void fireEvent(ObservableEvent event)
    • getRealm

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

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