org.eclipse.emf.ecp.view.internal.validation
Class ViewModelGraph

java.lang.Object
  extended by org.eclipse.emf.ecp.view.internal.validation.ViewModelGraph
Direct Known Subclasses:
ViewValidator

public abstract class ViewModelGraph
extends Object

The validation graph is a graph like structure where each VElement is a represented as ViewModelGraphNode with a value of type T. The graph structure follows the EObject hierarchy of the view model (and in that sense conforms to the containment tree of the Renderable). The actually computed values of the nodes are based on domain objects, which are also represented as ViewModelGraphNodes, together with a feature, but in contrast to the nodes containing the VElement s, never have any children. Nodes containing domain objects also can have multiple parent. For instance this is the case if a domain object's feature is visualized by multiple controls.

Author:
emueller

Constructor Summary
ViewModelGraph(VElement viewModel, org.eclipse.emf.ecore.EObject domainModel, Comparator<VDiagnostic> comparator)
          Constructor.
 
Method Summary
 Set<VDiagnostic> getAllValues(org.eclipse.emf.ecore.EObject domainObject)
          Returns all values set for the provided domainObject.
abstract  VDiagnostic getDefaultValue()
          Returns the default value for a cached node.
 VDiagnostic getValue(VElement renderable)
          Returns the computed value for the given VElement.
 Map<org.eclipse.emf.ecore.EStructuralFeature,VDiagnostic> getValuePerFeature(org.eclipse.emf.ecore.EObject domainObject)
          Returns a Map containing all EStructuralFeatures and the corresponding value for the provided domainObject.
 void removeDomainObject(org.eclipse.emf.ecore.EObject domainObject)
          Removes the given domain object from the graph.
 void removeRenderable(VElement renderable)
          Removes the given VElement from the graph.
 void update(VElement renderable, org.eclipse.emf.ecore.EObject domainObject, org.eclipse.emf.ecore.EStructuralFeature feature, VDiagnostic value)
          Updates the cached entry for the given EObject with the given value.
If the cached entry does not yet exist, it will be created.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewModelGraph

public ViewModelGraph(VElement viewModel,
                      org.eclipse.emf.ecore.EObject domainModel,
                      Comparator<VDiagnostic> comparator)
Constructor.

Parameters:
viewModel - the root of the view model
domainModel - the root of the domain model
comparator - the comparator that is used to compute the most distinctive value
Method Detail

getDefaultValue

public abstract VDiagnostic getDefaultValue()
Returns the default value for a cached node.

Returns:
the default value for a cached tree node

getValue

public VDiagnostic getValue(VElement renderable)
Returns the computed value for the given VElement.

Parameters:
renderable - the VElement to fetch the value for
Returns:
the value for the given VElement

getAllValues

public Set<VDiagnostic> getAllValues(org.eclipse.emf.ecore.EObject domainObject)
Returns all values set for the provided domainObject.

Parameters:
domainObject - the EObject to search the values for
Returns:
the set of all values currently associated with the provided EObject

getValuePerFeature

public Map<org.eclipse.emf.ecore.EStructuralFeature,VDiagnostic> getValuePerFeature(org.eclipse.emf.ecore.EObject domainObject)
Returns a Map containing all EStructuralFeatures and the corresponding value for the provided domainObject.

Parameters:
domainObject - the EObject to search the map for
Returns:
a mapping between all EStructuralFeatures and its associated value, currently associated with the provided EObject

update

public void update(VElement renderable,
                   org.eclipse.emf.ecore.EObject domainObject,
                   org.eclipse.emf.ecore.EStructuralFeature feature,
                   VDiagnostic value)
Updates the cached entry for the given EObject with the given value.
If the cached entry does not yet exist, it will be created.

Parameters:
renderable - the VElement that is referencing the feature of the domainObject
domainObject - the domain object that caused the value to be computed
feature - the EStructuralFeature referenced by the Renderable
value - the actual value

removeDomainObject

public void removeDomainObject(org.eclipse.emf.ecore.EObject domainObject)
Removes the given domain object from the graph.

Parameters:
domainObject - the domain object to be removed

removeRenderable

public void removeRenderable(VElement renderable)
Removes the given VElement from the graph.

Parameters:
renderable - the VElement be removed


Copyright © 2014. All Rights Reserved.