1
|
/**
|
2
|
* Copyright (C) 2019 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.dialog.selection;
|
10
|
|
11
|
import java.util.List;
|
12
|
|
13
|
import org.eclipse.swt.widgets.Shell;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.service.IAgentService;
|
16
|
import eu.etaxonomy.cdm.model.agent.Person;
|
17
|
import eu.etaxonomy.cdm.model.agent.Team;
|
18
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
19
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
20
|
|
21
|
/**
|
22
|
* @author k.luther
|
23
|
* @since 18.03.2019
|
24
|
*/
|
25
|
public class TeamOrPersonBaseSelectionDialog
|
26
|
extends AgentSelectionDialog<TeamOrPersonBase<?>> {
|
27
|
|
28
|
protected TeamOrPersonBaseSelectionDialog(Shell shell, String title, boolean multi, String settings,
|
29
|
TeamOrPersonBase<?> agent, boolean selectTeamMember) {
|
30
|
super(shell, title, multi, settings, agent, selectTeamMember);
|
31
|
}
|
32
|
|
33
|
/**
|
34
|
* <p>select</p>
|
35
|
*
|
36
|
* @param shell a {@link org.eclipse.swt.widgets.Shell} object.
|
37
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
38
|
* @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
|
39
|
* @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
|
40
|
*/
|
41
|
public static TeamOrPersonBase<?> select(Shell shell,
|
42
|
TeamOrPersonBase<?> entity, boolean selectTeamMember) {
|
43
|
TeamOrPersonBaseSelectionDialog dialog = new TeamOrPersonBaseSelectionDialog(shell,
|
44
|
"Choose Team or Person", false, TeamOrPersonBaseSelectionDialog.class.getCanonicalName(), entity, selectTeamMember);
|
45
|
return getSelectionFromDialog(dialog);
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
protected void callService(String pattern) {
|
50
|
model = (List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class, limitOfInitialElements, pattern);
|
51
|
model.addAll((List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class,limitOfInitialElements, pattern));
|
52
|
}
|
53
|
|
54
|
@Override
|
55
|
protected String getTitle(TeamOrPersonBase<?> cdmObject) {
|
56
|
if(cdmObject == null){
|
57
|
return "";
|
58
|
}
|
59
|
return cdmObject.getTitleCache();
|
60
|
}
|
61
|
}
|