1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.dialogs.filteredSelection;
|
12
|
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
import org.eclipse.swt.widgets.Shell;
|
17
|
|
18
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
19
|
import eu.etaxonomy.cdm.model.agent.Person;
|
20
|
import eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard;
|
21
|
import eu.etaxonomy.taxeditor.editor.newWizard.NewPersonWizard;
|
22
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
23
|
|
24
|
/**
|
25
|
* @author n.hoffmann
|
26
|
* @created Sep 24, 2009
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class FilteredPersonSelectionDialog extends
|
30
|
AbstractFilteredCdmResourceSelectionDialog<Person> {
|
31
|
private static final Logger logger = Logger
|
32
|
.getLogger(FilteredPersonSelectionDialog.class);
|
33
|
|
34
|
public static Person selectPerson(Shell shell, ConversationHolder conversation, Person person){
|
35
|
FilteredPersonSelectionDialog dialog = new FilteredPersonSelectionDialog(shell, conversation,
|
36
|
"Choose a person", false, FilteredPersonSelectionDialog.class.getCanonicalName(), person);
|
37
|
return getSelectionFromDialog(dialog);
|
38
|
}
|
39
|
|
40
|
/**
|
41
|
* @param shell
|
42
|
* @param title
|
43
|
* @param multi
|
44
|
* @param settings
|
45
|
* @param cdmObject
|
46
|
*/
|
47
|
protected FilteredPersonSelectionDialog(Shell shell, ConversationHolder conversation, String title,
|
48
|
boolean multi, String settings, Person cdmObject) {
|
49
|
super(shell, conversation, title, multi, settings, cdmObject);
|
50
|
}
|
51
|
|
52
|
|
53
|
|
54
|
/* (non-Javadoc)
|
55
|
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
|
56
|
*/
|
57
|
@Override
|
58
|
protected Person getPersistentObject(UUID uuid) {
|
59
|
return (Person) CdmStore.getAgentService().load(uuid);
|
60
|
}
|
61
|
|
62
|
/* (non-Javadoc)
|
63
|
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
|
64
|
*/
|
65
|
@Override
|
66
|
protected void initModel() {
|
67
|
model = CdmStore.getAgentService().getPersonUuidAndTitleCache();
|
68
|
}
|
69
|
|
70
|
@Override
|
71
|
protected AbstractNewEntityWizard getNewEntityWizard() {
|
72
|
return new NewPersonWizard();
|
73
|
}
|
74
|
|
75
|
@Override
|
76
|
protected String getNewWizardLinkText() {
|
77
|
return "Click link to create a new <A>Person</A>.";
|
78
|
}
|
79
|
}
|