Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms]Unusual Model element creation
[EMF Forms]Unusual Model element creation [message #1755136] Tue, 28 February 2017 11:25 Go to next message
saravanakumar Mohanasundaram is currently offline saravanakumar MohanasundaramFriend
Messages: 17
Registered: February 2017
Junior Member
I have a model in which class A has a association with class B (with cardinality 0..1).

Now i am trying to render this using a View Model. In my View Model, On setting value for reference of Class B in Class A, some other field has to become visible.

Therefore i am using Show Rule set to false with Condition where Value in Class B = Others

Now because of this Show Rule, by default whenever i create Class A, a Class B is automatically created and reference is set.

This is an unusual behaviour, but if i remove the Show Rule, then it doesnt get created.

I have attached sample project for reference.

Any support to understand this behaviour would help.







Regards,
Saravanakumar



[Updated on: Wed, 01 March 2017 04:56]

Report message to a moderator

Re: [EMF Forms]Unusual Model element creation [message #1755220 is a reply to message #1755136] Wed, 01 March 2017 09:41 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 58
Registered: September 2016
Member
Hi,

I assume that the domain model reference used in the show rule points to something in B. If that is the case, the domain model resolvement will automatically create missing elements. Otherwise it cannot bind to the value in B.

Best regards
Jonas

--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms]Unusual Model element creation [message #1755231 is a reply to message #1755220] Wed, 01 March 2017 11:02 Go to previous messageGo to next message
Rahul Upadhyay is currently offline Rahul UpadhyayFriend
Messages: 10
Registered: February 2017
Junior Member
Thanks Jonas for your response ,

We want to solve this scenario something like as soon as A is created B should not be created. Can we achieve this scenario by having some rule . Is there any approach by which this ECP behaviour can be resolved.


Thanks in advance.
Re: [EMF Forms]Unusual Model element creation [message #1755236 is a reply to message #1755231] Wed, 01 March 2017 11:31 Go to previous messageGo to next message
saravanakumar Mohanasundaram is currently offline saravanakumar MohanasundaramFriend
Messages: 17
Registered: February 2017
Junior Member
Thanks for your response Jonas.

Is there any approach to change the behaviour of automatic model element creation?

If i try to remove the model element in reference then it will add another one model element instead of removing the same.

is this the default behaviour of EMF Forms?

Please support me to resolve the same.






Regards,
Saravanakumar
Re: [EMF Forms]Unusual Model element creation [message #1755722 is a reply to message #1755236] Tue, 07 March 2017 09:01 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 58
Registered: September 2016
Member
Yes, that is the default behavior. EMF Forms will create elements that the view model binds to. Otherwise, there would be UI elements, which bind to missing parts of the domain model.
I do not fully understand your use case. However, it might make sense to adapt this default behavior of EMF Forms and skip the automatic creation of sub elements.

It is actually triggered in the method ViewModelContextImpl#resolveDomainReference

The actual behavior is delegated to a service called EMFFormsDomainExpander. So by adapting or overriding this service, you can adapt the behavior as you wish.

Please note, that missing elements might lead to NPEs or other errors, so you should check which elements are really required.

Best regards
Jonas

--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms]Unusual Model element creation [message #1756380 is a reply to message #1755722] Thu, 16 March 2017 08:18 Go to previous message
saravanakumar Mohanasundaram is currently offline saravanakumar MohanasundaramFriend
Messages: 17
Registered: February 2017
Junior Member
Thanks for your response Jonas.
Previous Topic:[EMF Transaction] How to correctly handle changes on the file level in EMF?
Next Topic:EMF Forms: PackageNotFoundException for view proxy model
Goto Forum:
  


Current Time: Wed Nov 22 05:49:05 GMT 2017

Powered by FUDForum. Page generated in 0.03001 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software