public class EMFFormsSpreadsheetViewModelContext extends Object implements ViewModelContext
ViewModelContext
.
This implementation doesn't do anything, it serves only as a container for a VView
and the EObject
.Constructor and Description |
---|
EMFFormsSpreadsheetViewModelContext(VView view,
org.eclipse.emf.ecore.EObject domainModel)
Default Constructor.
|
EMFFormsSpreadsheetViewModelContext(VView view,
org.eclipse.emf.ecore.EObject domainModel,
ViewModelContext parentContext)
Default Constructor for child contexts.
|
Modifier and Type | Method and Description |
---|---|
void |
addContextUser(Object user)
Adds a user of the context.
|
void |
changeDomainModel(org.eclipse.emf.ecore.EObject newDomainModel)
Changes the domain model of this view context to the given
EObject . |
void |
dispose()
Disposes the context.
|
ViewModelContext |
getChildContext(org.eclipse.emf.ecore.EObject eObject,
VElement parent,
VView vView,
ViewModelService... viewModelServices)
Deprecated.
|
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.
|
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 |
registerEMFFormsContextListener(EMFFormsContextListener contextListener)
Register an
EMFFormsContextListener . |
void |
registerRootDomainModelChangeListener(RootDomainModelChangeListener rootDomainModelChangeListener)
Register a
RootDomainModelChangeListener . |
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 |
unregisterEMFFormsContextListener(EMFFormsContextListener contextListener)
Unregister an
EMFFormsContextListener . |
void |
unregisterRootDomainModelChangeListener(RootDomainModelChangeListener rootDomainModelChangeListener)
Unregister a
RootDomainModelChangeListener . |
void |
unregisterViewChangeListener(ModelChangeListener modelChangeListener)
Unregister view change listener.
|
public EMFFormsSpreadsheetViewModelContext(VView view, org.eclipse.emf.ecore.EObject domainModel)
view
- The VView
domainModel
- The EObject
public EMFFormsSpreadsheetViewModelContext(VView view, org.eclipse.emf.ecore.EObject domainModel, ViewModelContext parentContext)
view
- The VView
domainModel
- The EObject
parentContext
- The parent ViewModelContext
public void registerDomainChangeListener(ModelChangeListener modelChangeListener)
registerDomainChangeListener
in interface ViewModelContext
registerDomainChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerViewModelContext.registerDomainChangeListener(org.eclipse.emf.ecp.view.spi.model.ModelChangeListener)
public void unregisterDomainChangeListener(ModelChangeListener modelChangeListener)
unregisterDomainChangeListener
in interface ViewModelContext
unregisterDomainChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerViewModelContext.unregisterDomainChangeListener(org.eclipse.emf.ecp.view.spi.model.ModelChangeListener)
public VElement getViewModel()
getViewModel
in interface ViewModelContext
getViewModel
in interface EMFFormsViewContext
ViewModelContext.getViewModel()
public org.eclipse.emf.ecore.EObject getDomainModel()
getDomainModel
in interface ViewModelContext
getDomainModel
in interface EMFFormsViewContext
ViewModelContext.getDomainModel()
public void registerViewChangeListener(ModelChangeListener modelChangeListener)
registerViewChangeListener
in interface ViewModelContext
registerViewChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerViewModelContext.registerViewChangeListener(org.eclipse.emf.ecp.view.spi.model.ModelChangeListener)
public void unregisterViewChangeListener(ModelChangeListener modelChangeListener)
unregisterViewChangeListener
in interface ViewModelContext
unregisterViewChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerViewModelContext.unregisterViewChangeListener(org.eclipse.emf.ecp.view.spi.model.ModelChangeListener)
public void dispose()
dispose
in interface ViewModelContext
ViewModelContext.dispose()
public <T> boolean hasService(Class<T> serviceType)
serviceType
.hasService
in interface ViewModelContext
T
- the type of the desired serviceserviceType
- the type of the servicetrue
, if the context has a service of the given type, false
otherwiseViewModelContext.hasService(java.lang.Class)
public <T> T getService(Class<T> serviceType)
ViewModelService
of type serviceType
.getService
in interface ViewModelContext
getService
in interface EMFFormsViewContext
T
- the type of the desired serviceserviceType
- the type of the service to be retrievedViewModelContext.getService(java.lang.Class)
@Deprecated public Set<VControl> getControlsFor(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
EStructuralFeature.Setting
. The EStructuralFeature.Setting
is converted to
a UniqueSetting
.getControlsFor
in interface ViewModelContext
setting
- the EStructuralFeature.Setting
to search controls forViewModelContext.getControlsFor(org.eclipse.emf.ecore.EStructuralFeature.Setting)
@Deprecated public Set<VElement> getControlsFor(UniqueSetting setting)
UniqueSetting
.getControlsFor
in interface ViewModelContext
setting
- the UniqueSetting
to search controls forViewModelContext.getControlsFor(org.eclipse.emf.ecp.common.spi.UniqueSetting)
public Object getContextValue(String key)
getContextValue
in interface ViewModelContext
key
- the key of the value to getViewModelContext.getContextValue(java.lang.String)
public void putContextValue(String key, Object value)
putContextValue
in interface ViewModelContext
key
- the key to setvalue
- the Object to set into the contextViewModelContext.putContextValue(java.lang.String, java.lang.Object)
@Deprecated public ViewModelContext getChildContext(org.eclipse.emf.ecore.EObject eObject, VElement parent, VView vView, ViewModelService... viewModelServices)
ViewModelContext
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.
getChildContext
in interface ViewModelContext
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 contextViewModelContext.getChildContext(EObject, VElement, VView, ViewModelServiceProvider)
public ViewModelContext getChildContext(org.eclipse.emf.ecore.EObject eObject, VElement parent, VView vView, ViewModelServiceProvider viewModelServiceProvider)
ViewModelContext
EObject
and VElement
. If a child context
already exists it will be returned otherwise a new ViewModelContext
will be created.getChildContext
in interface ViewModelContext
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 contextpublic void registerDisposeListener(ViewModelContextDisposeListener listener)
registerDisposeListener
in interface ViewModelContext
listener
- The ViewModelContextDisposeListener
to registerViewModelContext.registerDisposeListener(org.eclipse.emf.ecp.view.spi.context.ViewModelContextDisposeListener)
public void addContextUser(Object user)
addContextUser
in interface ViewModelContext
user
- The context user to addViewModelContext.addContextUser(java.lang.Object)
public void removeContextUser(Object user)
removeContextUser
in interface ViewModelContext
user
- The context user to removeViewModelContext.removeContextUser(java.lang.Object)
public void registerEMFFormsContextListener(EMFFormsContextListener contextListener)
EMFFormsContextListener
.registerEMFFormsContextListener
in interface EMFFormsViewContext
contextListener
- the EMFFormsContextListener
to registerEMFFormsViewContext.registerEMFFormsContextListener(org.eclipse.emfforms.spi.core.services.view.EMFFormsContextListener)
public void unregisterEMFFormsContextListener(EMFFormsContextListener contextListener)
EMFFormsContextListener
.unregisterEMFFormsContextListener
in interface EMFFormsViewContext
contextListener
- the EMFFormsContextListener
to unregisterEMFFormsViewContext.unregisterEMFFormsContextListener(org.eclipse.emfforms.spi.core.services.view.EMFFormsContextListener)
public ViewModelContext getParentContext()
ViewModelContext
null
for the topmost context.getParentContext
in interface ViewModelContext
public VElement getParentVElement()
ViewModelContext
parent context
this method will return the parent VElement
which requested the creation of this context. Otherwise this method will return null
.getParentVElement
in interface ViewModelContext
public void changeDomainModel(org.eclipse.emf.ecore.EObject newDomainModel)
EObject
.changeDomainModel
in interface EMFFormsViewContext
newDomainModel
- The new domain modelEMFFormsViewContext.changeDomainModel(org.eclipse.emf.ecore.EObject)
public void registerRootDomainModelChangeListener(RootDomainModelChangeListener rootDomainModelChangeListener)
RootDomainModelChangeListener
.registerRootDomainModelChangeListener
in interface EMFFormsViewContext
rootDomainModelChangeListener
- The RootDomainModelChangeListener
to registerEMFFormsViewContext.registerRootDomainModelChangeListener(org.eclipse.emfforms.spi.core.services.view.RootDomainModelChangeListener)
public void unregisterRootDomainModelChangeListener(RootDomainModelChangeListener rootDomainModelChangeListener)
RootDomainModelChangeListener
.unregisterRootDomainModelChangeListener
in interface EMFFormsViewContext
rootDomainModelChangeListener
- The RootDomainModelChangeListener
to unregisterEMFFormsViewContext.unregisterRootDomainModelChangeListener(org.eclipse.emfforms.spi.core.services.view.RootDomainModelChangeListener)
Copyright © 2019. All rights reserved.