Project

General

Profile

Revision 82a57421

ID82a57421606db7ee734704b0b0d79b1de30daa2d
Parent 291c69d6
Child f51d204a

Added by Patrick Plitzner over 2 years ago

fix #7430 New team members are added at the end of the member list

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/DefaultCdmBaseComparator.java
30 30
        if(o2==null){
31 31
            return 1;
32 32
        }
33
        return o1.getId()-o2.getId();
33
        int diff = o1.getId()-o2.getId();
34
        if(diff==0){
35
            diff = o1.getCreated().compareTo(o2.getCreated());
36
        }
37
        return diff;
34 38
    }
35 39

  
36 40
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamMemberSection.java
11 11

  
12 12
import java.util.Collection;
13 13
import java.util.Comparator;
14
import java.util.List;
14 15

  
15 16
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 17
import eu.etaxonomy.cdm.model.agent.Person;
17 18
import eu.etaxonomy.cdm.model.agent.Team;
18 19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19 20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
21 21
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
22 22

  
23 23
/**
......
87 87

  
88 88
    @Override
89 89
    public Comparator<Person> getComparator() {
90
        return new DefaultCdmBaseComparator<>();
90
        return (p1, p2) -> {
91
            if(p1==null){
92
                return -1;
93
            }
94
            if(p2==null){
95
                return 1;
96
            }
97
            List<Person> teamMembers = getEntity().getTeamMembers();
98
            int indexOfP1 = teamMembers.indexOf(p1);
99
            int indexOfP2 = teamMembers.indexOf(p2);
100
            if(indexOfP1==-1){
101
                return 1;
102
            }
103
            if(indexOfP2==-1){
104
                return -1;
105
            }
106
            return indexOfP1 - indexOfP2;
107
        };
91 108
    }
92 109

  
93 110
    /**

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)