Class DefaultWidgetModel

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • 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
      void clear()  
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)  
      java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entrySet()  
      java.lang.Object get​(java.lang.Object key)  
      <T> T getValue​(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.
      boolean isEmpty()  
      java.util.Set<java.lang.String> keySet()  
      java.lang.Object put​(java.lang.String attribute, java.lang.Object value)
      Adds given data to this widget model and registers it to the given attribute name.
      void putAll​(java.util.Map<? extends java.lang.String,​?> map)  
      java.lang.Object remove​(java.lang.Object key)  
      java.lang.Object remove​(java.lang.String attribute)
      Removes the object registered to the given attribute name.
      void removeAllObservers()
      Removes a previously registered ModelObservers.
      void removeObserver​(java.lang.Object observerId)
      Removes a previously registered ModelObserver.
      void removeObserver​(java.lang.String key, java.lang.Object observerId)
      Removes a previously registered ModelObserver.
      void setValue​(java.lang.String expression, java.lang.Object value)
      Stores the given value to this model using the given expression.
      int size()  
      protected void updateValueObserver​(java.lang.String attribute, java.lang.Object value)  
      java.util.Collection<java.lang.Object> values()  
      • 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
    • 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: WidgetModel
        Adds given data to this widget model and registers it to the given attribute name.
        Specified by:
        put in interface java.util.Map<java.lang.String,​java.lang.Object>
        Specified by:
        put in interface WidgetModel
        Parameters:
        attribute - the attribute to register given object to
        value - the object to add
        Returns:
        the previously put data
      • remove

        public java.lang.Object remove​(java.lang.String attribute)
        Description copied from interface: WidgetModel
        Removes the object registered to the given attribute name.
        Specified by:
        remove in interface WidgetModel
        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: WidgetModel
        Retrieves 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:
        getValue in interface WidgetModel
        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: WidgetModel
        Stores 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:
        setValue in interface WidgetModel
        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: WidgetModel
        Retrieves the type of the value of this model using the given expression.
        Specified by:
        getValueType in interface WidgetModel
        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: WidgetModel
        Removes a previously registered ModelObserver.
        Specified by:
        removeObserver in interface WidgetModel
        Parameters:
        key - attribute for changes of which the observer was interested
        observerId - 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: WidgetModel
        Removes a previously registered ModelObserver.
        Specified by:
        removeObserver in interface WidgetModel
        Parameters:
        observerId - id of the observer to remove. The object which represents the id should override equals method.
      • size

        public int size()
        Specified by:
        size in interface java.util.Map<java.lang.String,​java.lang.Object>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<java.lang.String,​java.lang.Object>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<java.lang.String,​java.lang.Object>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface java.util.Map<java.lang.String,​java.lang.Object>
      • get

        public java.lang.Object get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<java.lang.String,​java.lang.Object>
      • remove

        public java.lang.Object remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<java.lang.String,​java.lang.Object>
      • putAll

        public void putAll​(java.util.Map<? extends java.lang.String,​?> map)
        Specified by:
        putAll in interface java.util.Map<java.lang.String,​java.lang.Object>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<java.lang.String,​java.lang.Object>
      • keySet

        public java.util.Set<java.lang.String> keySet()
        Specified by:
        keySet in interface java.util.Map<java.lang.String,​java.lang.Object>
      • values

        public java.util.Collection<java.lang.Object> values()
        Specified by:
        values in interface java.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:
        entrySet in interface java.util.Map<java.lang.String,​java.lang.Object>
      • updateValueObserver

        protected void updateValueObserver​(java.lang.String attribute,
                                           java.lang.Object value)