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
|
|
10
|
package eu.etaxonomy.taxeditor.ui.dialog.selection;
|
11
|
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.eclipse.swt.widgets.Shell;
|
15
|
|
16
|
import eu.etaxonomy.cdm.api.service.IAgentService;
|
17
|
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
18
|
import eu.etaxonomy.cdm.model.agent.Institution;
|
19
|
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
|
20
|
import eu.etaxonomy.taxeditor.newWizard.NewInstitutionWizard;
|
21
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
22
|
|
23
|
/**
|
24
|
* @author n.hoffmann
|
25
|
* @created Dec 15, 2010
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class InstitutionSelectionDialog extends
|
29
|
AbstractFilteredCdmResourceSelectionDialog<Institution> {
|
30
|
|
31
|
public static Institution select(Shell shell,// ConversationHolder conversation,
|
32
|
Institution institution){
|
33
|
InstitutionSelectionDialog dialog = new InstitutionSelectionDialog(shell, //conversation,
|
34
|
"Choose Institution", false, TeamSelectionDialog.class.getCanonicalName(), institution);
|
35
|
return getSelectionFromDialog(dialog);
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* @param shell
|
40
|
* @param conversation
|
41
|
* @param title
|
42
|
* @param multi
|
43
|
* @param settings
|
44
|
* @param cdmObject
|
45
|
*/
|
46
|
protected InstitutionSelectionDialog(Shell shell,//ConversationHolder conversation,
|
47
|
String title, boolean multi,
|
48
|
String settings, Institution cdmObject) {
|
49
|
super(shell, //conversation,
|
50
|
title, multi, settings, cdmObject);
|
51
|
}
|
52
|
|
53
|
/* (non-Javadoc)
|
54
|
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
|
55
|
*/
|
56
|
@Override
|
57
|
protected Institution getPersistentObject(UUID uuid) {
|
58
|
AgentBase agentBase = CdmStore.getService(IAgentService.class).load(uuid);
|
59
|
|
60
|
if(agentBase instanceof Institution){
|
61
|
return (Institution) agentBase;
|
62
|
}
|
63
|
return null;
|
64
|
}
|
65
|
|
66
|
/* (non-Javadoc)
|
67
|
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
|
68
|
*/
|
69
|
@Override
|
70
|
protected void callService(String pattern) {
|
71
|
|
72
|
model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Institution.class, limitOfInitialElements,pattern);
|
73
|
|
74
|
|
75
|
}
|
76
|
|
77
|
/* (non-Javadoc)
|
78
|
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
|
79
|
*/
|
80
|
@Override
|
81
|
protected String[] getNewWizardText() {
|
82
|
return new String[]{"New Institution"};
|
83
|
}
|
84
|
|
85
|
/* (non-Javadoc)
|
86
|
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
|
87
|
*/
|
88
|
@Override
|
89
|
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
|
90
|
return new NewInstitutionWizard();
|
91
|
}
|
92
|
|
93
|
}
|