Package com.hybris.cockpitng.core.impl
Class DefaultWidgetModel
- java.lang.Object
-
- com.hybris.cockpitng.core.model.impl.AbstractObservable
-
- com.hybris.cockpitng.core.impl.DefaultWidgetModel
-
- All Implemented Interfaces:
Observable,WidgetModel,java.io.Serializable,java.util.Map<java.lang.String,java.lang.Object>
public class DefaultWidgetModel extends AbstractObservable implements WidgetModel, java.util.Map<java.lang.String,java.lang.Object>
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.hybris.cockpitng.core.model.impl.AbstractObservable
mutex
-
-
Constructor Summary
Constructors Constructor Description DefaultWidgetModel(java.util.Map<java.lang.String,java.lang.Object> realModel, ModelValueHandler valueHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(java.lang.Object key)booleancontainsValue(java.lang.Object value)java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>entrySet()java.lang.Objectget(java.lang.Object key)<T> TgetValue(java.lang.String expression, java.lang.Class<T> expectedValueType)Retrieves the value from this model using the given expression.<T> java.lang.Class<T>getValueType(java.lang.String expression)Retrieves the type of the value of this model using the given expression.booleanisEmpty()java.util.Set<java.lang.String>keySet()java.lang.Objectput(java.lang.String attribute, java.lang.Object value)Adds given data to this widget model and registers it to the given attribute name.voidputAll(java.util.Map<? extends java.lang.String,?> map)java.lang.Objectremove(java.lang.Object key)java.lang.Objectremove(java.lang.String attribute)Removes the object registered to the given attribute name.voidremoveAllObservers()Removes a previously registeredModelObservers.voidremoveObserver(java.lang.Object observerId)Removes a previously registeredModelObserver.voidremoveObserver(java.lang.String key, java.lang.Object observerId)Removes a previously registeredModelObserver.voidsetValue(java.lang.String expression, java.lang.Object value)Stores the given value to this model using the given expression.intsize()protected voidupdateValueObserver(java.lang.String attribute, java.lang.Object value)java.util.Collection<java.lang.Object>values()-
Methods inherited from class com.hybris.cockpitng.core.model.impl.AbstractObservable
addObserver, alreadyExists, changed, changed, getObservedValues, getObservers, removeObserver, removeObserver
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Methods inherited from interface com.hybris.cockpitng.core.model.Observable
addObserver, addObserver, changed, changed, removeObserver, removeObserver
-
-
-
-
Constructor Detail
-
DefaultWidgetModel
public DefaultWidgetModel(java.util.Map<java.lang.String,java.lang.Object> realModel, ModelValueHandler valueHandler)
-
-
Method Detail
-
put
public java.lang.Object put(java.lang.String attribute, java.lang.Object value)Description copied from interface:WidgetModelAdds given data to this widget model and registers it to the given attribute name.- Specified by:
putin interfacejava.util.Map<java.lang.String,java.lang.Object>- Specified by:
putin interfaceWidgetModel- Parameters:
attribute- the attribute to register given object tovalue- the object to add- Returns:
- the previously put data
-
remove
public java.lang.Object remove(java.lang.String attribute)
Description copied from interface:WidgetModelRemoves the object registered to the given attribute name.- Specified by:
removein interfaceWidgetModel- Parameters:
attribute- the attribute to which the data to be removed are registered- Returns:
- the removed object
-
getValue
public <T> T getValue(java.lang.String expression, java.lang.Class<T> expectedValueType)Description copied from interface:WidgetModelRetrieves the value from this model using the given expression. You can use expressions like 'product.media.code' to navigate through data structures. See implementations for detail.- Specified by:
getValuein interfaceWidgetModel- Parameters:
expression- the expression, can be like 'product.media.code'expectedValueType- expected value type- Returns:
- the value
-
setValue
public void setValue(java.lang.String expression, java.lang.Object value)Description copied from interface:WidgetModelStores the given value to this model using the given expression. You can use expressions like 'product.media.code' to navigate through data structures. See implementations for detail. It also notifies the widget about the change. This is used to keep cockpit NG components like editors and actions uptodate.- Specified by:
setValuein interfaceWidgetModel- Parameters:
expression- the expression, can be like 'product.media.code'value- the value to store
-
getValueType
public <T> java.lang.Class<T> getValueType(java.lang.String expression)
Description copied from interface:WidgetModelRetrieves the type of the value of this model using the given expression.- Specified by:
getValueTypein interfaceWidgetModel- Parameters:
expression- the expression, can be like 'product.media.code'- Returns:
- the type of the value
-
removeObserver
public void removeObserver(java.lang.String key, java.lang.Object observerId)Description copied from interface:WidgetModelRemoves a previously registeredModelObserver.- Specified by:
removeObserverin interfaceWidgetModel- Parameters:
key- attribute for changes of which the observer was interestedobserverId- id of the observer to remove. The object which represents the id should override equals method.
-
removeObserver
public void removeObserver(java.lang.Object observerId)
Description copied from interface:WidgetModelRemoves a previously registeredModelObserver.- Specified by:
removeObserverin interfaceWidgetModel- Parameters:
observerId- id of the observer to remove. The object which represents the id should override equals method.
-
removeAllObservers
public void removeAllObservers()
Description copied from interface:WidgetModelRemoves a previously registeredModelObservers.- Specified by:
removeAllObserversin interfaceWidgetModel
-
size
public int size()
- Specified by:
sizein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKeyin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValuein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
getin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
remove
public java.lang.Object remove(java.lang.Object key)
- Specified by:
removein interfacejava.util.Map<java.lang.String,java.lang.Object>
-
putAll
public void putAll(java.util.Map<? extends java.lang.String,?> map)
- Specified by:
putAllin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
keySet
public java.util.Set<java.lang.String> keySet()
- Specified by:
keySetin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
values
public java.util.Collection<java.lang.Object> values()
- Specified by:
valuesin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
- Specified by:
entrySetin interfacejava.util.Map<java.lang.String,java.lang.Object>
-
updateValueObserver
protected void updateValueObserver(java.lang.String attribute, java.lang.Object value)
-
-