Project

General

Profile

Download (2.5 KB) Statistics
| Branch: | Tag: | Revision:
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 org.eclipse.swt.widgets.Shell;
12

    
13
import eu.etaxonomy.cdm.api.service.IAgentService;
14
import eu.etaxonomy.cdm.model.agent.Person;
15
import eu.etaxonomy.cdm.model.agent.Team;
16
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
17
import eu.etaxonomy.taxeditor.store.CdmStore;
18

    
19
/**
20
 * @author k.luther
21
 * @since 18.03.2019
22
 *
23
 */
24
public class TeamOrPersonBaseSelectionDialog extends AgentSelectionDialog<TeamOrPersonBase>  {
25

    
26
    /**
27
     * @param shell
28
     * @param title
29
     * @param multi
30
     * @param settings
31
     * @param agent
32
     * @param selectTeamMember
33
     */
34
    protected TeamOrPersonBaseSelectionDialog(Shell shell, String title, boolean multi, String settings,
35
            TeamOrPersonBase agent, boolean selectTeamMember) {
36
        super(shell, title, multi, settings, agent, selectTeamMember);
37
        // TODO Auto-generated constructor stub
38
    }
39

    
40

    
41

    
42
    /**
43
     * <p>select</p>
44
     *
45
     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
46
     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
47
     * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
48
     * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
49
     */
50
    public static TeamOrPersonBase select(Shell shell, //ConversationHolder conversation,
51
            TeamOrPersonBase entity, boolean selectTeamMember) {
52
        TeamOrPersonBaseSelectionDialog dialog = new TeamOrPersonBaseSelectionDialog(shell, //conversation,
53
                "Choose Team or Person", false, TeamOrPersonBaseSelectionDialog.class.getCanonicalName(), entity, selectTeamMember);
54
        return (TeamOrPersonBase)getSelectionFromDialog(dialog);
55
    }
56

    
57
    @Override
58
    void callService(String pattern) {
59
        model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class,limitOfInitialElements, pattern);
60
        model.addAll( CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class,limitOfInitialElements, pattern));
61
    }
62

    
63

    
64

    
65
    /**
66
     * @param cdmObject
67
     * @return
68
     */
69
    protected String getTitle(TeamOrPersonBase cdmObject) {
70
        if(cdmObject == null){
71
            return "";
72
        }
73
        return cdmObject.getTitleCache();
74
    }
75
}
(42-42/45)