public interface ViewModelContext extends EMFFormsViewContext
Modifier and Type | Method and Description |
---|---|
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 . |
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 . |
Object |
getContextValue(String key)
Returns the value of the context for the passed key.
|
Set<VControl> |
getControlsFor(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
Deprecated.
please use
EMFFormsSettingToControlMapper#getControlsFor(Setting) |
Set<VElement> |
getControlsFor(UniqueSetting setting)
Deprecated.
|
org.eclipse.emf.ecore.EObject |
getDomainModel()
Gets the domain model.
|
ViewModelContext |
getParentContext()
This returns the parent context.
|
VElement |
getParentVElement()
If this context has a
parent context this method will return the parent VElement
which requested the creation of this context. |
<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.
|
changeDomainModel, registerEMFFormsContextListener, registerRootDomainModelChangeListener, unregisterEMFFormsContextListener, unregisterRootDomainModelChangeListener
void registerDomainChangeListener(ModelChangeListener modelChangeListener)
registerDomainChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenervoid unregisterDomainChangeListener(ModelChangeListener modelChangeListener)
unregisterDomainChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerVElement getViewModel()
getViewModel
in interface EMFFormsViewContext
org.eclipse.emf.ecore.EObject getDomainModel()
getDomainModel
in interface EMFFormsViewContext
void registerViewChangeListener(ModelChangeListener modelChangeListener)
registerViewChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenervoid unregisterViewChangeListener(ModelChangeListener modelChangeListener)
unregisterViewChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenervoid dispose()
<T> boolean hasService(Class<T> serviceType)
serviceType
.T
- the type of the desired serviceserviceType
- the type of the servicetrue
, if the context has a service of the given type, false
otherwise<T> T getService(Class<T> serviceType)
ViewModelService
of type serviceType
.getService
in interface EMFFormsViewContext
T
- the type of the desired serviceserviceType
- the type of the service to be retrieved@Deprecated Set<VControl> getControlsFor(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
EMFFormsSettingToControlMapper#getControlsFor(Setting)
EStructuralFeature.Setting
. The EStructuralFeature.Setting
is converted to
a UniqueSetting
.setting
- the EStructuralFeature.Setting
to search controls for@Deprecated Set<VElement> getControlsFor(UniqueSetting setting)
EMFFormsSettingToControlMapper#getControlsFor(UniqueSetting)
UniqueSetting
.setting
- the UniqueSetting
to search controls forObject getContextValue(String key)
key
- the key of the value to getvoid putContextValue(String key, Object value)
key
- the key to setvalue
- the Object to set into the contextViewModelContext 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.
eObject
- The EObject
to get the child context forparent
- The VElement
which requests the child contextvView
- The VView
of the EObject
viewModelServices
- The list of ViewModelService
which should be part of a child contextViewModelContext
witch is a child of the current contextgetChildContext(EObject, VElement, VView, ViewModelServiceProvider)
ViewModelContext getChildContext(org.eclipse.emf.ecore.EObject eObject, VElement parent, VView vView, ViewModelServiceProvider viewModelServiceProvider)
EObject
and VElement
. If a child context
already exists it will be returned otherwise a new ViewModelContext
will be created.eObject
- The EObject
to get the child context forparent
- The VElement
which requests the child contextvView
- 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
neededViewModelContext
which is a child of the current contextViewModelContext getParentContext()
null
for the topmost context.VElement getParentVElement()
parent context
this method will return the parent VElement
which requested the creation of this context. Otherwise this method will return null
.void registerDisposeListener(ViewModelContextDisposeListener listener)
listener
- The ViewModelContextDisposeListener
to registervoid addContextUser(Object user)
user
- The context user to addvoid removeContextUser(Object user)
user
- The context user to removeCopyright © 2019. All rights reserved.