Class AbstractObservable

java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
All Implemented Interfaces:
IObservable
Direct Known Subclasses:
AbstractObservableSet, AbstractObservableValue, DecoratingObservable, ObservableList, ObservableMap, ObservableSet

public abstract class AbstractObservable extends Object implements IObservable
Since:
1.0
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

    • AbstractObservable

      public AbstractObservable(Realm realm)
      Parameters:
      realm - the realm to use; not null
  • Method Details

    • addChangeListener

      public void addChangeListener(IChangeListener listener)
      Description copied from interface: IObservable
      Adds the given change listener to the list of change listeners. Change listeners are notified about changes of the state of this observable in a generic way, without specifying the change that happened. To get the changed state, a change listener needs to query for the current state of this observable.
      Specified by:
      addChangeListener in interface IObservable
      Parameters:
      listener - the listener to add; not null
    • removeChangeListener

      public void removeChangeListener(IChangeListener listener)
      Description copied from interface: IObservable
      Removes the given change listener from the list of change listeners. Has no effect if the given listener is not registered as a change listener.
      Specified by:
      removeChangeListener in interface IObservable
      Parameters:
      listener - the listener to remove; not null
    • addStaleListener

      public void addStaleListener(IStaleListener listener)
      Description copied from interface: IObservable
      Adds the given stale listener to the list of stale listeners. Stale listeners are notified when an observable object becomes stale, not when is becomes non-stale.
      Specified by:
      addStaleListener in interface IObservable
      Parameters:
      listener - the listener to add; not null
      See Also:
    • removeStaleListener

      public void removeStaleListener(IStaleListener listener)
      Description copied from interface: IObservable
      Removes the given stale listener from the list of stale listeners. Has no effect if the given listener is not registered as a stale listener.
      Specified by:
      removeStaleListener in interface IObservable
      Parameters:
      listener - the listener to remove; not null
    • addDisposeListener

      public void addDisposeListener(IDisposeListener listener)
      Description copied from interface: IObservable
      Adds the given dispose listener to the list of dispose listeners. Dispose listeners are notified when an observable has been disposed.
      Specified by:
      addDisposeListener in interface IObservable
      Parameters:
      listener - the listener to add
      Since:
      1.2
    • removeDisposeListener

      public void removeDisposeListener(IDisposeListener listener)
      Description copied from interface: IObservable
      Removes the given dispose listener from the list of dispose listeners. Has no effect if the given listener is not registered as a dispose listener.
      Specified by:
      removeDisposeListener in interface IObservable
      Parameters:
      listener - the listener to remove
      Since:
      1.2
    • fireChange

      protected void fireChange()
    • fireStale

      protected void fireStale()
    • isDisposed

      public boolean isDisposed()
      Description copied from interface: IObservable
      Returns whether the observable has been disposed
      Specified by:
      isDisposed in interface IObservable
      Returns:
      whether the observable has been disposed
      Since:
      1.2
    • 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
    • checkRealm

      protected void checkRealm()
      Asserts that the realm is the current realm.
      Throws:
      AssertionFailedException - if the realm is not the current realm
      See Also:
    • 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)
    • firstListenerAdded

      protected void firstListenerAdded()
    • lastListenerRemoved

      protected void lastListenerRemoved()
    • getRealm

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

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