[EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1404206] |
Wed, 30 July 2014 12:43 |
Ranjeeth Rajendran Messages: 17 Registered: July 2009 |
Junior Member |
|
|
REG: Rule Based Enablement TreeMasterDetail View
I have two view defined for entity user and task, want to add rule in the task view based on user entity.
* user.view contains the layout for user.
* task.view contains the layout for the task.
Q: How to define a rule in task view based on user active status feature path domain model reference.
example- rule to enable/disable the fields in the task view based on active status of user rule.
PS: User entity is the parent container for task.
[Updated on: Wed, 30 July 2014 14:30] Report message to a moderator
|
|
|
|
|
Re: [EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1404433 is a reply to message #1404334] |
Fri, 01 August 2014 11:39 |
Ranjeeth Rajendran Messages: 17 Registered: July 2009 |
Junior Member |
|
|
Was cracking a bit on the inner-working of EMF Forms, and noticed that each view is independent of context(meaning doesn't know about the ancestor/descendant view & model). I see this as a huge set back as the view's are not contextually aware.
I made slight modification in the class which looks like a workaround for me, although am not sure 100%(still don't have 100% knowledge about the EMF Forms Architecture yet)
I Tried to copy the root model(am not referring to the root eclass model of view)
ViewModelFileExtensionsManager#createView()
/**
* @param eObject The {@link EObject} to create a view for
* @return a view model for the given eObject
*/
public VView createView(EObject eObject) {
final EObject rootObject = EcoreUtil.getRootContainer(eObject, true);
final List<EObject> list = new ArrayList<EObject>(2);
list.add(rootObject);
list.add(map.get(eObject.eClass()));
final Collection<EObject> collection = EcoreUtil.copyAll(list);
for (final EObject eObject2 : collection) {
if (eObject2 instanceof VView) {
return (VView) eObject2;
}
}
return EcoreUtil.copy(map.get(eObject.eClass()));
}
Tried to modify the task.view and place a rule in the task.view which has Task root eclass.
<attachments xsi:type="org.eclipse.emf.ecp.view.rule.model:ShowRule" hide="true">
<condition xsi:type="org.eclipse.emf.ecp.view.rule.model:LeafCondition" expectedValue="ACED0005737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C7565787001">
<domainModelReference xsi:type="org.eclipse.emf.ecp.view.model:FeaturePathDomainModelReference">
<domainModelEFeature xsi:type="ecore:EAttribute" href="http://eclipse/org/emf/ecp/makeithappen/model/task#//User/active"/>
</domainModelReference>
</condition>
</attachments>
[Updated on: Fri, 01 August 2014 11:40] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02699 seconds