Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Use a List of eObject in a table
Use a List of eObject in a table [message #1804917] Wed, 03 April 2019 09:46 Go to next message
Michael C is currently offline Michael CFriend
Messages: 25
Registered: April 2019
Junior Member
Hello, I'm not able to use a java service that returns a List in a cell of a table diagram.
So this works :
    public Person getFirstCousin(Person person){
        List<Person> cousins = new ArrayList<Person>();
        List<Person> parents = person.getParents();

        for (Person parent : parents) {
            for (Person grandParent : parent.getParents()) {
                for (Person uncleOrAunt : grandParent.getChildren()) {
                    if (!parents.contains(uncleOrAunt)) {
                        for (Person cousin : uncleOrAunt.getChildren()) {
                            if (!cousins.contains(cousin))
                                cousins.add(cousin);
                        }
                    }
                }
            }
        }
        return cousins.get(0);

With featureParentExpression :
service:getFirstCousin()
& feature name : name
But this does not work :
    public List<Person> getCousins(Person person){
        List<Person> cousins = new ArrayList<Person>();
        List<Person> parents = person.getParents();

        for (Person parent : parents) {
            for (Person grandParent : parent.getParents()) {
                for (Person uncleOrAunt : grandParent.getChildren()) {
                    if (!parents.contains(uncleOrAunt)) {
                        for (Person cousin : uncleOrAunt.getChildren()) {
                            if (!cousins.contains(cousin))
                                cousins.add(cousin);
                        }
                    }
                }
            }
        }
        return cousins;
    }

With featureParentExpression :
service:getCousins()
& feature name : name

Is it possible to display a List in a cell ?
Also I'm not sure what "Associated elements expression does".

Thanks for your help.
Re: Use a List of eObject in a table [message #1804953 is a reply to message #1804917] Wed, 03 April 2019 16:20 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi Michael,

It is not possible to put many elements in a cell. What you can do thought is to compute the label from the Person context. From there you can retrieve the cousins and display a list as a String in the label expression. Associated elements are used to display associated elements in the properties view of the line selected and to refresh these elements when a modification is done on the element behind the line.

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Use a List of eObject in a table [message #1805256 is a reply to message #1804953] Wed, 10 April 2019 12:53 Go to previous message
Michael C is currently offline Michael CFriend
Messages: 25
Registered: April 2019
Junior Member
Thanks it worked. By the way the "Feature Parent Expression" tooltip mentions that the expected return type should be EObject or Collection<EObject>, but in my case it did not took the Collection so maybe it should be modified.
Previous Topic:Conditional style in tree description
Next Topic:Graphical Description Problem
Goto Forum:
  


Current Time: Tue Oct 15 11:38:57 GMT 2019

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

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

Back to the top