Project

General

Profile

Download (2.01 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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.UUID;
12

    
13
import org.eclipse.swt.widgets.Shell;
14

    
15
import eu.etaxonomy.cdm.api.service.IAgentService;
16
import eu.etaxonomy.cdm.model.agent.AgentBase;
17
import eu.etaxonomy.cdm.model.agent.Institution;
18
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
19
import eu.etaxonomy.taxeditor.newWizard.NewInstitutionWizard;
20
import eu.etaxonomy.taxeditor.store.CdmStore;
21

    
22
/**
23
 * @author n.hoffmann
24
 * @created Dec 15, 2010
25
 */
26
public class InstitutionSelectionDialog extends
27
		AbstractFilteredCdmResourceSelectionDialog<Institution> {
28

    
29
	public static Institution select(Shell shell,
30
	        Institution institution){
31
		InstitutionSelectionDialog dialog = new InstitutionSelectionDialog(shell, //conversation,
32
				"Choose Institution", false, TeamSelectionDialog.class.getCanonicalName(), institution);
33
		return getSelectionFromDialog(dialog);
34
	}
35

    
36
	protected InstitutionSelectionDialog(Shell shell,
37
	        String title, boolean multi,
38
			String settings, Institution cdmObject) {
39
		super(shell, title, multi, settings, cdmObject);
40
	}
41

    
42
	@Override
43
	protected Institution getPersistentObject(UUID uuid) {
44
		AgentBase<?> agentBase = CdmStore.getService(IAgentService.class).load(uuid);
45

    
46
		if(agentBase instanceof Institution){
47
			return (Institution) agentBase;
48
		}
49
		return null;
50
	}
51

    
52
	@Override
53
	protected void callService(String pattern) {
54
	       model = CdmStore.getService(IAgentService.class)
55
	               .getUuidAndTitleCache(Institution.class, limitOfInitialElements, pattern);
56
	}
57

    
58
	@Override
59
	protected String[] getNewWizardText() {
60
		return new String[]{"New Institution"};
61
	}
62

    
63
	@Override
64
	protected AbstractNewEntityWizard<Institution> getNewEntityWizard(String parameter) {
65
		return new NewInstitutionWizard();
66
	}
67
}
(21-21/46)