Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Table: Single column for different EStructuralFeatures
[EMF Forms] Table: Single column for different EStructuralFeatures [message #1767862] Tue, 11 July 2017 17:04 Go to next message
Andreas Fogados is currently offline Andreas FogadosFriend
Messages: 3
Registered: July 2017
Junior Member
Hey everyone,

I have a question regarding the TableControl holding different subtypes of one common supertype.
In my case, some of those subtypes have eAttributes of the same type, let's say String.

Now the only way I see is to create a column with a respective FeaturePathDomainModelReference (FPDMR) for each of the subtype-attributes.
But this leads to exceptions thrown for each element in the table which is not containing that specific FPDMR. Furthermore, this would require columns for each subtype I want to handle in that table (which can get pretty much pretty soon, e.g. if there are 15 different subtypes).

To clarify what i mean, i created a small example model:
index.php/fa/29929/0/
Let's say i want to create a table holding all UniversityMembers. I want to use 3 columns: "name", "firstname" and one called "id". As you can see, the ids are not part of the common supertypes, because only the professor and the student, but not the caretaker got one. Can i now somehow use one column to show and edit the two different ids of Professor and Student (For the caretaker this cell should just stay empty and be not editable)? Because the only way I see is to create 2 columns, one for the Student-ID and one for the Professor-ID, but that doesn't solve the 2 problems mentioned above, meaning the exceptions and the case when there are for example 12 subtypes of UniversityMember containing some kind of an id and 5 subtypes not containing such an id.

(one sidenote: I can not change the structure of the domain-model)

Best Regards,
Andreas
Re: [EMF Forms] Table: Single column for different EStructuralFeatures [message #1767922 is a reply to message #1767862] Wed, 12 July 2017 07:53 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 127
Registered: May 2015
Senior Member
Hi Andreas,

this case is problematic, as the id field has different names and is also not available on all classes.
As EMFForms basically doesn't 'understand' your model, it cannot provide a generic solution for this very specific case.
As you cannot change the model, an easy fix will not be possible which would have been to pull the id field to the UniversityMember class and then just make it not editable for the Caretaker.

So a possible solution for you would be to use the org.eclipse.emfforms.spi.swt.table.TableViewerFactory . This allows you to create a custom table with databinding and all, but that would be a component outside of emfforms. So you can either add it after your EMFForms embedding or create a custom view model element and a custom renderer for this view model element which would then render the table using the org.eclipse.emfforms.spi.swt.table.TableViewerFactory.
Take a look at the source code about how the factory is used.
If you have question about this, we're happy to help.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Table: Single column for different EStructuralFeatures [message #1767956 is a reply to message #1767922] Wed, 12 July 2017 11:45 Go to previous message
Andreas Fogados is currently offline Andreas FogadosFriend
Messages: 3
Registered: July 2017
Junior Member
Hey Eugen,

thanks for your reply. Actually, your approach was the same that came to my mind.
I just wanted to make sure, that I don't miss any generic solution for that problem, before I got into the trouble of creating a custom table. I'll let you know if i have any further questions regarding that topic. Thanks for your help.

Best Regards,
Andreas
Previous Topic:StackOverflowError on EPackageRegistryImpl
Next Topic:[Edapt] Unmodeled XML attributes got lost during migration
Goto Forum:
  


Current Time: Mon Nov 20 05:49:51 GMT 2017

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

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