public class ViewModelContextImpl extends Object implements ViewModelContext
Constructor and Description |
---|
ViewModelContextImpl(VElement view,
org.eclipse.emf.ecore.EObject domainObject)
Instantiates a new view model context impl.
|
ViewModelContextImpl(VElement view,
org.eclipse.emf.ecore.EObject domainObject,
ViewModelContext parent,
VElement parentVElement)
Instantiates a new view model context impl.
|
ViewModelContextImpl(VElement view,
org.eclipse.emf.ecore.EObject domainObject,
ViewModelContext parent,
VElement parentVElement,
ViewModelService... modelServices)
Instantiates a new view model context impl with a parent context.
|
ViewModelContextImpl(VElement view,
org.eclipse.emf.ecore.EObject domainObject,
ViewModelService... modelServices)
Instantiates a new view model context impl.
|
Modifier and Type | Method and Description |
---|---|
void |
addContextUser(Object user)
Inner method for registering context users (not
ViewModelService ). |
void |
changeDomainModel(org.eclipse.emf.ecore.EObject newDomainModel)
Changes the domain model of this view context to the given
EObject . |
void |
dispose()
Dispose.
|
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)
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)
Inner method for unregistering the 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 ViewModelContextImpl(VElement view, org.eclipse.emf.ecore.EObject domainObject)
view
- the viewdomainObject
- the domain objectpublic ViewModelContextImpl(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelContext parent, VElement parentVElement)
view
- the viewdomainObject
- the domain objectparent
- The parent ViewModelContext
parentVElement
- the parent VElement
public ViewModelContextImpl(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelService... modelServices)
view
- the viewdomainObject
- the domain objectmodelServices
- an array of services to use in the ViewModelContext
public ViewModelContextImpl(VElement view, org.eclipse.emf.ecore.EObject domainObject, ViewModelContext parent, VElement parentVElement, ViewModelService... modelServices)
view
- the viewdomainObject
- the domain objectmodelServices
- an array of services to use in the ViewModelContext
parent
- The parent ViewModelContext
parentVElement
- The parent VElement
@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 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 dispose()
dispose
in interface ViewModelContext
public void registerViewChangeListener(ModelChangeListener modelChangeListener)
ViewModelContext
registerViewChangeListener
in interface ViewModelContext
registerViewChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerpublic void unregisterViewChangeListener(ModelChangeListener modelChangeListener)
ViewModelContext
unregisterViewChangeListener
in interface ViewModelContext
unregisterViewChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerpublic void registerDomainChangeListener(ModelChangeListener modelChangeListener)
ViewModelContext
registerDomainChangeListener
in interface ViewModelContext
registerDomainChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerpublic void unregisterDomainChangeListener(ModelChangeListener modelChangeListener)
ViewModelContext
unregisterDomainChangeListener
in interface ViewModelContext
unregisterDomainChangeListener
in interface EMFFormsViewContext
modelChangeListener
- the model change listenerpublic <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)
public void addContextUser(Object user)
ViewModelService
).addContextUser
in interface ViewModelContext
user
- the user of the contextpublic void removeContextUser(Object user)
removeContextUser
in interface ViewModelContext
user
- the user of the contextpublic 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)
public ViewModelContext getChildContext(org.eclipse.emf.ecore.EObject eObject, VElement parent, VView vView, ViewModelService... viewModelServices)
ViewModelContext
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
viewModelServices
- The list of ViewModelService
which should be part of a child contextViewModelContext
witch is a child of the current contextpublic 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 registerDisposeListener(ViewModelContextDisposeListener listener)
registerDisposeListener
in interface ViewModelContext
listener
- The ViewModelContextDisposeListener
to registerViewModelContext.registerDisposeListener(org.eclipse.emf.ecp.view.spi.context.ViewModelContextDisposeListener)
public void registerEMFFormsContextListener(EMFFormsContextListener contextListener)
EMFFormsViewContext
EMFFormsContextListener
.registerEMFFormsContextListener
in interface EMFFormsViewContext
contextListener
- the EMFFormsContextListener
to registerpublic void unregisterEMFFormsContextListener(EMFFormsContextListener contextListener)
EMFFormsViewContext
EMFFormsContextListener
.unregisterEMFFormsContextListener
in interface EMFFormsViewContext
contextListener
- the EMFFormsContextListener
to unregisterpublic 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 © 2017. All rights reserved.