Interface ViewModelContext

    • Method Detail

      • getDomainModel

        org.eclipse.emf.ecore.EObject getDomainModel()
        Gets the domain model.
        Specified by:
        getDomainModel in interface EMFFormsViewContext
        Returns:
        the domain model
      • dispose

        void dispose()
        Disposes the context.
      • hasService

        <T> boolean hasService​(java.lang.Class<T> serviceType)
        Whether the context has a service of the given type serviceType.
        Type Parameters:
        T - the type of the desired service
        Parameters:
        serviceType - the type of the service
        Returns:
        true, if the context has a service of the given type, false otherwise
      • getService

        <T> T getService​(java.lang.Class<T> serviceType)
        Retrieve an ViewModelService of type serviceType.
        Specified by:
        getService in interface EMFFormsViewContext
        Type Parameters:
        T - the type of the desired service
        Parameters:
        serviceType - the type of the service to be retrieved
        Returns:
        the service
      • getControlsFor

        @Deprecated
        java.util.Set<VControl> getControlsFor​(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
        Returns all controls which are associated with the provided EStructuralFeature.Setting. The EStructuralFeature.Setting is converted to a UniqueSetting.
        Parameters:
        setting - the EStructuralFeature.Setting to search controls for
        Returns:
        the Set of all controls associated with the provided setting or null if no controls can be found
        Since:
        1.3
      • getContextValue

        java.lang.Object getContextValue​(java.lang.String key)
        Returns the value of the context for the passed key.
        Parameters:
        key - the key of the value to get
        Returns:
        the Object for the provided key
        Since:
        1.4
      • putContextValue

        void putContextValue​(java.lang.String key,
                             java.lang.Object value)
        Puts the value for the provided key into the context.
        Parameters:
        key - the key to set
        value - the Object to set into the context
        Since:
        1.4
      • getChildContext

        ViewModelContext getChildContext​(org.eclipse.emf.ecore.EObject eObject,
                                         VElement parent,
                                         VView vView,
                                         ViewModelService... viewModelServices)

        This returns the childContext for the provided EObject and the provided VElement. If a child context already exists it will be returned otherwise a new ViewModelContext will be created.

        Note that the injection of viewModelServices is useful for services that are not registered externally (via extension point or OSGi). If any of these services locally override registered implementations of the same interface, then it is better to use a ViewModelServiceProvider that can propagate the override to child contexts.

        Parameters:
        eObject - The EObject to get the child context for
        parent - The VElement which requests the child context
        vView - The VView of the EObject
        viewModelServices - The list of ViewModelService which should be part of a child context
        Returns:
        a ViewModelContext witch is a child of the current context
        Since:
        1.5
        See Also:
        getChildContext(EObject, VElement, VView, ViewModelServiceProvider)
      • getChildContext

        ViewModelContext getChildContext​(org.eclipse.emf.ecore.EObject eObject,
                                         VElement parent,
                                         VView vView,
                                         ViewModelServiceProvider viewModelServiceProvider)
        This returns a child context for the provided EObject and VElement. If a child context already exists it will be returned otherwise a new ViewModelContext will be created.
        Parameters:
        eObject - The EObject to get the child context for
        parent - The VElement which requests the child context
        vView - The VView of the EObject
        viewModelServiceProvider - a provider of view model services to inject into the child context, which will only be used in the case that it is necessary to create the context. Thus no services will be created if not needed. May be null if additional local service overrides are not needed
        Returns:
        a ViewModelContext which is a child of the current context
        Since:
        1.16
      • getParentContext

        ViewModelContext getParentContext()
        This returns the parent context. This may be null for the topmost context.
        Returns:
        the parent
        Since:
        1.9
      • getParentVElement

        VElement getParentVElement()
        If this context has a parent context this method will return the parent VElement which requested the creation of this context. Otherwise this method will return null.
        Returns:
        the parent
        Since:
        1.9
      • addContextUser

        void addContextUser​(java.lang.Object user)
        Adds a user of the context.
        Parameters:
        user - The context user to add
        Since:
        1.5
      • removeContextUser

        void removeContextUser​(java.lang.Object user)
        Removes a context user.
        Parameters:
        user - The context user to remove
        Since:
        1.5
      • pause

        void pause()
        Pauses the Context by not reacting to any notifications anymore.
        Since:
        1.25
      • reactivate

        void reactivate()
        Reactive the Context by reacting to notifications again. Please be aware that reactiving the ViewModelContext will not rereport the notifications that were ignored during pause. In order to update the state after reactivation you should call EMFFormsViewContext.changeDomainModel(EObject) or trigger an event that fires a notification.
        Since:
        1.25