Revision 82a57421
Added by Patrick Plitzner almost 6 years ago
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
fix #7430 New team members are added at the end of the member list