Class ViewModelContextFactory


  • public final class ViewModelContextFactory
    extends java.lang.Object
    This Factory can be used to instantiate ViewModelContexts.
    Since:
    1.2
    Author:
    Eugen Neufeld
    • Method Detail

      • createViewModelContext

        public ViewModelContext createViewModelContext​(VElement view,
                                                       org.eclipse.emf.ecore.EObject domainObject)
        Instantiates a new view model context.
        Parameters:
        view - the view
        domainObject - the domain object
        Returns:
        the created ViewModelContext
      • createViewModelContext

        public ViewModelContext createViewModelContext​(VElement view,
                                                       org.eclipse.emf.ecore.EObject domainObject,
                                                       ViewModelServiceProvider serviceProvider)
        Instantiates a new view model context with a provider of local service overrides. The serviceProvider is propagated to child contexts to override registered services in their scope, too.
        Parameters:
        view - the view
        domainObject - the domain object
        serviceProvider - a provider of local view-model services to override any statically registered services of the same types. May be null if local service overrides are not needed
        Returns:
        the created ViewModelContext
        Since:
        1.16
      • createViewModelContext

        public ViewModelContext createViewModelContext​(VElement view,
                                                       org.eclipse.emf.ecore.EObject domainObject,
                                                       java.util.Map<java.lang.String,​?> contextValues)
        Instantiates a new view model context with initial context values. The serviceProvider is propagated to child contexts to override registered services in their scope, too.
        Parameters:
        view - the view
        domainObject - the domain object
        contextValues - initial context values to set
        Returns:
        the created ViewModelContext
        Since:
        1.21
        See Also:
        ViewModelContext.getContextValue(String)
      • createViewModelContext

        public ViewModelContext createViewModelContext​(VElement view,
                                                       org.eclipse.emf.ecore.EObject domainObject,
                                                       ViewModelServiceProvider serviceProvider,
                                                       java.util.Map<java.lang.String,​?> contextValues)
        Instantiates a new view model context with a provider of local service overrides and initial context values. The serviceProvider is propagated to child contexts to override registered services in their scope, too.
        Parameters:
        view - the view
        domainObject - the domain object
        serviceProvider - a provider of local view-model services to override any statically registered services of the same types. May be null if local service overrides are not needed
        contextValues - initial context values to set
        Returns:
        the created ViewModelContext
        Since:
        1.21
      • provide

        public static ViewModelServiceProvider provide​(ViewModelService... modelServices)
        Obtain a view-model service provider that statically provides a set of services.
        Parameters:
        modelServices - model services to provider
        Returns:
        the static provider of those services
        Since:
        1.22