Class AbstractObservable
- java.lang.Object
-
- com.hybris.cockpitng.core.model.impl.AbstractObservable
-
- All Implemented Interfaces:
Observable
- Direct Known Subclasses:
DefaultWidgetModel,FullTextSearchFilter,ObservableMap,ValidationResult
public class AbstractObservable extends java.lang.Object implements Observable
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Objectmutex
-
Constructor Summary
Constructors Constructor Description AbstractObservable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObserver(java.lang.String key, ValueObserver observer)Registers aValueObserverfor changes of values.protected booleanalreadyExists(ValueObserver observer, java.util.List<ValueObserver> observers)voidchanged()Informs observers that some values were changed.voidchanged(java.lang.String key)Informs observers that some value has changed.protected java.util.Set<java.lang.String>getObservedValues()protected java.util.List<ValueObserver>getObservers(java.lang.String key)voidremoveObserver(ValueObserver observer)Removes a previously registeredValueObserverfor any key.voidremoveObserver(java.lang.String key, ValueObserver observer)Removes a previously registeredValueObserver.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.hybris.cockpitng.core.model.Observable
addObserver
-
-
-
-
Method Detail
-
getObservedValues
protected java.util.Set<java.lang.String> getObservedValues()
-
getObservers
protected java.util.List<ValueObserver> getObservers(java.lang.String key)
-
changed
public void changed()
Description copied from interface:ObservableInforms observers that some values were changed.- Specified by:
changedin interfaceObservable
-
changed
public void changed(java.lang.String key)
Description copied from interface:ObservableInforms observers that some value has changed.- Specified by:
changedin interfaceObservable- Parameters:
key- name of value that has changed
-
alreadyExists
protected boolean alreadyExists(ValueObserver observer, java.util.List<ValueObserver> observers)
-
addObserver
public void addObserver(java.lang.String key, ValueObserver observer)Description copied from interface:ObservableRegisters aValueObserverfor changes of values. The observer will be notified each time a value related to the givenkeyis changed.i.e. if the observer is registered for
product.media.codeit will be notified if value on any level of the key (product,product.mediaorproduct.media.code) was changed. Also forproduct.mediait will be notified, ifproduct.media.codehas changed.Each model observer may be registered only once (next registrations will be ignored). Model observers are by default compared by their
#equals(Object)method. To change this behaviour, observer may implementIdentifiableinterface to introduce observer's identity.- Specified by:
addObserverin interfaceObservable- Parameters:
key- attribute for changes of which the observer is interestedobserver- the observer to be notified about changes- See Also:
Observable.addObserver(ValueObserver)
-
removeObserver
public void removeObserver(java.lang.String key, ValueObserver observer)Description copied from interface:ObservableRemoves a previously registeredValueObserver.- Specified by:
removeObserverin interfaceObservable- Parameters:
key- attribute for changes of which the observer was interestedobserver- the observer to be removed- See Also:
Observable.addObserver(String, ValueObserver),Observable.removeObserver(ValueObserver)
-
removeObserver
public void removeObserver(ValueObserver observer)
Description copied from interface:ObservableRemoves a previously registeredValueObserverfor any key.- Specified by:
removeObserverin interfaceObservable- Parameters:
observer- the observer to be removed- See Also:
Observable.addObserver(ValueObserver),Observable.removeObserver(String, ValueObserver)
-
-