org.eclipse.emf.ecp.view.internal.context
Class ViewModelContextImpl

java.lang.Object
  extended by org.eclipse.emf.ecp.view.internal.context.ViewModelContextImpl
All Implemented Interfaces:
ViewModelContext
Direct Known Subclasses:
DiffMergeModelContextImpl

public class ViewModelContextImpl
extends Object
implements ViewModelContext

The Class ViewModelContextImpl.

Author:
Eugen Neufeld

Constructor Summary
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, ViewModelService... modelServices)
          Instantiates a new view model context impl.
 
Method Summary
 void addContextUser(Object user)
           
 void dispose()
          Dispose.
 Set<VControl> getControlsFor(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
          Returns all controls which are associated with the provided EStructuralFeature.Setting.
 Set<VControl> 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 registerDomainChangeListener(ModelChangeListener modelChangeListener)
          Register domain change listener.
 void registerViewChangeListener(ModelChangeListener modelChangeListener)
          Register view change listener.
 void removeContextUser(Object user)
           
 void unregisterDomainChangeListener(ModelChangeListener modelChangeListener)
          Unregister domain change listener.
 void unregisterViewChangeListener(ModelChangeListener modelChangeListener)
          Unregister view change listener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewModelContextImpl

public ViewModelContextImpl(VElement view,
                            org.eclipse.emf.ecore.EObject domainObject)
Instantiates a new view model context impl.

Parameters:
view - the view
domainObject - the domain object

ViewModelContextImpl

public ViewModelContextImpl(VElement view,
                            org.eclipse.emf.ecore.EObject domainObject,
                            ViewModelService... modelServices)
Instantiates a new view model context impl.

Parameters:
view - the view
domainObject - the domain object
modelServices - an array of services to use in the ViewModelContext
Method Detail

getControlsFor

public 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.

Specified by:
getControlsFor in interface ViewModelContext
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
See Also:
ViewModelContext.getControlsFor(org.eclipse.emf.ecore.EStructuralFeature.Setting)

getControlsFor

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

Specified by:
getControlsFor in interface ViewModelContext
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
See Also:
ViewModelContext.getControlsFor(org.eclipse.emf.ecp.common.UniqueSetting)

getViewModel

public VElement getViewModel()
Gets the view model.

Specified by:
getViewModel in interface ViewModelContext
Returns:
the view model
See Also:
ViewModelContext.getViewModel()

getDomainModel

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

Specified by:
getDomainModel in interface ViewModelContext
Returns:
the domain model
See Also:
ViewModelContext.getDomainModel()

dispose

public void dispose()
Dispose.

Specified by:
dispose in interface ViewModelContext

registerViewChangeListener

public void registerViewChangeListener(ModelChangeListener modelChangeListener)
Register view change listener.

Specified by:
registerViewChangeListener in interface ViewModelContext
Parameters:
modelChangeListener - the model change listener
See Also:
org.eclipse.emf.ecp.view.spi.context.ViewModelContext#registerViewChangeListener(org.eclipse.emf.ecp.view.spi.context.ViewModelContext.ModelChangeAddRemoveListener)

unregisterViewChangeListener

public void unregisterViewChangeListener(ModelChangeListener modelChangeListener)
Unregister view change listener.

Specified by:
unregisterViewChangeListener in interface ViewModelContext
Parameters:
modelChangeListener - the model change listener
See Also:
org.eclipse.emf.ecp.view.spi.context.ViewModelContext#unregisterViewChangeListener(org.eclipse.emf.ecp.view.spi.context.ViewModelContext.ModelChangeAddRemoveListener)

registerDomainChangeListener

public void registerDomainChangeListener(ModelChangeListener modelChangeListener)
Register domain change listener.

Specified by:
registerDomainChangeListener in interface ViewModelContext
Parameters:
modelChangeListener - the model change listener
See Also:
org.eclipse.emf.ecp.view.spi.context.ViewModelContext#registerDomainChangeListener(org.eclipse.emf.ecp.view.spi.context.ViewModelContext.ModelChangeAddRemoveListener)

unregisterDomainChangeListener

public void unregisterDomainChangeListener(ModelChangeListener modelChangeListener)
Unregister domain change listener.

Specified by:
unregisterDomainChangeListener in interface ViewModelContext
Parameters:
modelChangeListener - the model change listener
See Also:
org.eclipse.emf.ecp.view.spi.context.ViewModelContext#unregisterDomainChangeListener(org.eclipse.emf.ecp.view.spi.context.ViewModelContext.ModelChangeAddRemoveListener)

hasService

public <T> boolean hasService(Class<T> serviceType)
Whether the context has a service of the given type serviceType.

Specified by:
hasService in interface ViewModelContext
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
See Also:
ViewModelContext.hasService(java.lang.Class)

getService

public <T> T getService(Class<T> serviceType)
Retrieve an ViewModelService of type serviceType.

Specified by:
getService in interface ViewModelContext
Type Parameters:
T - the type of the desired service
Parameters:
serviceType - the type of the service to be retrieved
Returns:
the service
See Also:
ViewModelContext.getService(java.lang.Class)

addContextUser

public void addContextUser(Object user)

removeContextUser

public void removeContextUser(Object user)


Copyright © 2014. All Rights Reserved.