org.eclipse.emf.ecp.view.internal.rule
Class RuleRegistry<T extends Rule>

java.lang.Object
  extended by org.eclipse.emf.ecp.view.internal.rule.RuleRegistry<T>
Type Parameters:
T - the actual Rule type

public class RuleRegistry<T extends Rule>
extends Object

Rule registry that maintains which VElements are affected if a setting is changed.

Author:
emueller, jfaltermeier

Constructor Summary
RuleRegistry(ViewModelContext context)
          Default constructor.
 
Method Summary
 Map<T,VElement> getAffectedRenderables(UniqueSetting setting)
          Returns all rules that would be affected if the value of given setting is changed.
 Set<UniqueSetting> getSettings()
          Returns the settings of this registry.
 Set<UniqueSetting> register(VElement renderable, T rule, Condition condition, org.eclipse.emf.ecore.EObject domainModel)
          Creates a setting from the given EObject and the LeafCondition and register it with the VElement.
 VElement removeCondition(Condition condition)
          Removes the given condition from the registry.
 void removeRenderable(VElement renderable)
          Removes the given VElement from the registry.
 VElement removeRule(T rule)
          Removes the given rule from the registry.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleRegistry

public RuleRegistry(ViewModelContext context)
Default constructor.

Parameters:
context - the view model context of the RuleService using this registry
Method Detail

register

public Set<UniqueSetting> register(VElement renderable,
                                   T rule,
                                   Condition condition,
                                   org.eclipse.emf.ecore.EObject domainModel)
Creates a setting from the given EObject and the LeafCondition and register it with the VElement.

Parameters:
renderable - the VElement to be updated in case the condition changes
rule - the parent rule holding the LeafCondition
condition - contains the attribute that the condition is depending on
domainModel - the domain object that owns the attribute possibly being changed
Returns:
the registered UniqueSettings

removeRule

public VElement removeRule(T rule)
Removes the given rule from the registry.

Parameters:
rule - the rule to be removed
Returns:
the VElement that belonged to the removed rule

removeRenderable

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

Parameters:
renderable - the renderable to be removed

removeCondition

public VElement removeCondition(Condition condition)
Removes the given condition from the registry.

Parameters:
condition - the condition to be removed
Returns:
the VElement that belonged to the removed condition

getSettings

public Set<UniqueSetting> getSettings()
Returns the settings of this registry.

Returns:
the settings of this registry.

getAffectedRenderables

public Map<T,VElement> getAffectedRenderables(UniqueSetting setting)
Returns all rules that would be affected if the value of given setting is changed.

Parameters:
setting - the setting
Returns:
a list of VElements that are affected of the setting change


Copyright © 2015. All Rights Reserved.