Class MasterDetailObservables


  • public class MasterDetailObservables
    extends Object
    Allows for the observation of an attribute, the detail, of an observable representing selection or another transient instance, the master.
    Since:
    1.0
    • Constructor Detail

      • MasterDetailObservables

        public MasterDetailObservables()
    • Method Detail

      • detailValue

        public static <M,​T> IObservableValue<T> detailValue​(IObservableValue<M> master,
                                                                  IObservableFactory<? super M,​IObservableValue<T>> detailFactory,
                                                                  Object detailType)
        Creates a detail observable value from a master observable value and a factory. This can be used to create observable values that represent a property of a selected object in a table.
        Type Parameters:
        M - type of the master observable
        T - type of the inner detail observable
        Parameters:
        master - the observable value to track
        detailFactory - a factory for creating IObservableValue instances given a current value of the master
        detailType - the value type of the detail observable value, typically of type java.lang.Class and can be null
        Returns:
        an observable value of the given value type that, for any current value of the given master value, behaves like the observable value created by the factory for that current value.
      • detailList

        public static <M,​E> IObservableList<E> detailList​(IObservableValue<M> master,
                                                                IObservableFactory<? super M,​IObservableList<E>> detailFactory,
                                                                Object detailElementType)
        Creates a detail observable list from a master observable value and a factory. This can be used to create observable lists that represent a list property of a selected object in a table.
        Type Parameters:
        M - type of the master observable
        E - type of the elements in the inner observable set
        Parameters:
        master - the observable value to track
        detailFactory - a factory for creating IObservableList instances given a current value of the master
        detailElementType - the element type of the detail observable list, typically of type java.lang.Class and can be null
        Returns:
        an observable list with the given element type that, for any current value of the given master value, behaves like the observable list created by the factory for that current value.
      • detailSet

        public static <M,​E> IObservableSet<E> detailSet​(IObservableValue<M> master,
                                                              IObservableFactory<? super M,​? extends IObservableSet<E>> detailFactory,
                                                              Object detailElementType)
        Creates a detail observable set from a master observable value and a factory. This can be used to create observable sets that represent a set property of a selected object in a table.
        Type Parameters:
        M - type of the master observable
        E - type of the elements in the inner observable set
        Parameters:
        master - the observable value to track
        detailFactory - a factory for creating IObservableSet instances given a current value of the master
        detailElementType - the element type of the detail observable set, typically of type java.lang.Class and can be null
        Returns:
        an observable set with the given element type that, for any current value of the given master value, behaves like the observable set created by the factory for that current value.
      • detailMap

        public static <M,​K,​V> IObservableMap<K,​V> detailMap​(IObservableValue<M> master,
                                                                              IObservableFactory<M,​IObservableMap<K,​V>> detailFactory)
        Creates a detail observable map from a master observable value and a factory. This can be used to create observable maps that represent a map property of a selected object in a table.
        Type Parameters:
        M - type of the master observable
        K - type of the keys to the inner observable map
        V - type of the values in the inner observable map
        Parameters:
        master - the observable value to track
        detailFactory - a factory for creating IObservableMap instances given a current value of the master
        Returns:
        an observable map that, for any current value of the given master value, behaves like the observable map created by the factory for that current value.
        Since:
        1.1
      • detailMap

        public static <M,​K,​V> IObservableMap<K,​V> detailMap​(IObservableValue<M> master,
                                                                              IObservableFactory<? super M,​IObservableMap<K,​V>> detailFactory,
                                                                              Object detailKeyType,
                                                                              Object detailValueType)
        Creates a detail observable map from a master observable value and a factory. This can be used to create observable maps that represent a map property of a selected object in a table.
        Type Parameters:
        M - type of the master observable
        K - type of the keys to the inner observable map
        V - type of the values in the inner observable map
        Parameters:
        master - the observable value to track
        detailFactory - a factory for creating IObservableMap instances given a current value of the master
        detailKeyType - the element type of the detail observable map's key set, typically of type java.lang.Class and can be null
        detailValueType - the element type of the detail observable map's values collection, typically of type java.lang.Class and can be null
        Returns:
        an observable map that, for any current value of the given master value, behaves like the observable map created by the factory for that current value.
        Since:
        1.2
      • detailValues

        public static <M,​E> IObservableList<E> detailValues​(IObservableList<M> masterList,
                                                                  IObservableFactory<? super M,​IObservableValue<E>> detailFactory,
                                                                  Object detailType)
        Returns a detail observable list where each element is the detail value of the element in the master observable list. The provided factory is used to create the detail observable values for every master element which then define the elements of the detail list. The detail list resides in the same realm as the given master list.

        Note that since the values of the returned list are detail values of the elements of the master list, the only modifications supported are through the IObservableList.set(int, Object) method. Modifications made through the returned list are made through the detail observables created by the specified observable factory.

        Type Parameters:
        M - type of the master observables in the master list
        E - type of the detail elements
        Parameters:
        masterList - The master observable list.
        detailFactory - The factory for creating IObservableValue instances for the elements of the master list which then define the elements of the new detail list.
        detailType - The value type of the detail values, typically of type java.lang.Class. May be null.
        Returns:
        A detail observable list with elements which correspond to the detail values of the elements of the master list.
        Since:
        1.4
      • detailValues

        public static <M,​E> IObservableMap<M,​E> detailValues​(IObservableSet<M> masterSet,
                                                                         IObservableFactory<? super M,​IObservableValue<E>> detailFactory,
                                                                         Object detailType)
        Returns a detail observable map where the map's key set is the same as the given observable set, and where each value is the detail value of the element in the master observable set. The provided factory is used to create the detail observable values for every master key which then define the values of the detail map. The detail map resides in the same realm as the given master set.

        Note that since the values of the returned map are detail values of the elements of the master set, the only modifications supported are through the IObservableMap.put(Object, Object) and Map.putAll(java.util.Map) methods. Therefore, the returned map does not add entries for elements not already contained in the master set. Modifications made through the returned detail map are made through the detail observables created by the specified observable factory.

        Type Parameters:
        M - type of the master observables in the master set
        E - type of the detail elements
        Parameters:
        masterSet - The master observable set.
        detailFactory - The factory for creating IObservableValue instances for the elements of the master set which then define the values of the new detail map.
        detailType - The value type of the detail values, typically of type java.lang.Class. May be null.
        Returns:
        A detail observable map with the given master set as key set and with values which correspond to the detail values of the elements of the master set.
        Since:
        1.4
      • detailValues

        public static <K,​M,​E> IObservableMap<K,​E> detailValues​(IObservableMap<K,​M> masterMap,
                                                                                 IObservableFactory<? super M,​IObservableValue<E>> detailFactory,
                                                                                 Object detailType)
        Returns a detail observable map where the map's key set is the same as the one of the given master observable map, and where each value is the detail value of the corresponding value in the master observable map. The provided factory is used to create the detail observable values for every master value which then define the values of the detail map. The detail map resides in the same realm as the given master map.

        Note that since the values of the returned map are detail values of the values of the master map, the only modifications supported are through the IObservableMap.put(Object, Object) and Map.putAll(java.util.Map) methods. Therefore, the returned map does not add entries for keys not already contained in the master map's key set. Modifications made through the returned detail map are made through the detail observables created by the specified observable factory.

        Type Parameters:
        K - type of the keys (the keys to both the given master observable map and the keys to the returned detail map, both of which are the same set of keys)
        M - type of the master observables in the master set, being the values of the given master observable map
        E - type of the detail elements, being the values of the returned detail map
        Parameters:
        masterMap - The master observable map.
        detailFactory - The factory for creating IObservableValue instances for the values of the master map which then define the values of the new detail map.
        detailType - The value type of the detail values, typically of type java.lang.Class. May be null.
        Returns:
        A detail observable map with the same key set as the given master observable map and with values which correspond to the detail values of the values of the master map.
        Since:
        1.4