org.eclipse.emf.ecp.view.spi.context
Interface ViewModelContext

All Known Subinterfaces:
DiffMergeModelContext
All Known Implementing Classes:
DiffMergeModelContextImpl, EMFFormsSpreadsheetViewModelContext, ViewModelContextImpl

public interface ViewModelContext

The Interface ViewModelContext.

Since:
1.2
Author:
Eugen Neufeld

Method Summary
 void addContextUser(Object user)
          Adds a user of the context.
 void dispose()
          Disposes the context.
 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.
 Object getContextValue(String key)
          Returns the value of the context for the passed key.
 Set<VControl> getControlsFor(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
          Returns all controls which are associated with the provided EStructuralFeature.Setting.
 Set<VElement> getControlsFor(UniqueSetting setting)
          Returns all controls which are associated with the provided UniqueSetting.
 org.eclipse.emf.ecore.EObject getDomainModel()
          Gets the domain model.
<T> T
getService(Class<T> serviceType)
          Retrieve an ViewModelService of type serviceType.
 VElement getViewModel()
          Gets the view model.
<T> boolean
hasService(Class<T> serviceType)
          Whether the context has a service of the given type serviceType.
 void putContextValue(String key, Object value)
          Puts the value for the provided key into the context.
 void registerDisposeListener(ViewModelContextDisposeListener listener)
          Allows to register a dispose listener.
 void registerDomainChangeListener(ModelChangeListener modelChangeListener)
          Register domain change listener.
 void registerViewChangeListener(ModelChangeListener modelChangeListener)
          Register view change listener.
 void removeContextUser(Object user)
          Removes a context user.
 void unregisterDomainChangeListener(ModelChangeListener modelChangeListener)
          Unregister domain change listener.
 void unregisterViewChangeListener(ModelChangeListener modelChangeListener)
          Unregister view change listener.
 

Method Detail

registerDomainChangeListener

void registerDomainChangeListener(ModelChangeListener modelChangeListener)
Register domain change listener.

Parameters:
modelChangeListener - the model change listener
Since:
1.3

unregisterDomainChangeListener

void unregisterDomainChangeListener(ModelChangeListener modelChangeListener)
Unregister domain change listener.

Parameters:
modelChangeListener - the model change listener
Since:
1.3

getViewModel

VElement getViewModel()
Gets the view model.

Returns:
the view model

getDomainModel

org.eclipse.emf.ecore.EObject getDomainModel()
Gets the domain model.

Returns:
the domain model

registerViewChangeListener

void registerViewChangeListener(ModelChangeListener modelChangeListener)
Register view change listener.

Parameters:
modelChangeListener - the model change listener
Since:
1.3

unregisterViewChangeListener

void unregisterViewChangeListener(ModelChangeListener modelChangeListener)
Unregister view change listener.

Parameters:
modelChangeListener - the model change listener
Since:
1.3

dispose

void dispose()
Disposes the context.


hasService

<T> boolean hasService(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(Class<T> serviceType)
Retrieve an ViewModelService of type serviceType.

Type Parameters:
T - the type of the desired service
Parameters:
serviceType - the type of the service to be retrieved
Returns:
the service

getControlsFor

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

getControlsFor

Set<VElement> getControlsFor(UniqueSetting setting)
Returns all controls which are associated with the provided UniqueSetting.

Parameters:
setting - the UniqueSetting 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.5

getContextValue

Object getContextValue(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(String key,
                     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.

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

registerDisposeListener

void registerDisposeListener(ViewModelContextDisposeListener listener)
Allows to register a dispose listener.

Parameters:
listener - The ViewModelContextDisposeListener to register
Since:
1.5

addContextUser

void addContextUser(Object user)
Adds a user of the context.

Parameters:
user - The context user to add
Since:
1.5

removeContextUser

void removeContextUser(Object user)
Removes a context user.

Parameters:
user - The context user to remove
Since:
1.5


Copyright © 2015. All Rights Reserved.