Project

General

Profile

Download (3.04 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

    
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.conversation.ConversationHolder;
17
import eu.etaxonomy.cdm.api.service.IAgentService;
18
import eu.etaxonomy.cdm.model.agent.Person;
19
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
20
import eu.etaxonomy.taxeditor.newWizard.NewPersonWizard;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * <p>FilteredPersonSelectionDialog class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created Sep 24, 2009
28
 * @version 1.0
29
 */
30
public class PersonSelectionDialog extends
31
			AbstractFilteredCdmResourceSelectionDialog<Person> {
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 person a {@link eu.etaxonomy.cdm.model.agent.Person} object.
39
	 * @return a {@link eu.etaxonomy.cdm.model.agent.Person} object.
40
	 */
41
	public static Person select(Shell shell, ConversationHolder conversation, Person person){
42
		PersonSelectionDialog dialog = new PersonSelectionDialog(shell, conversation,
43
				"Choose a person", false, PersonSelectionDialog.class.getCanonicalName(), person);
44
		return getSelectionFromDialog(dialog);
45
	}
46

    
47
	/**
48
	 * <p>Constructor for FilteredPersonSelectionDialog.</p>
49
	 *
50
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
51
	 * @param title a {@link java.lang.String} object.
52
	 * @param multi a boolean.
53
	 * @param settings a {@link java.lang.String} object.
54
	 * @param cdmObject a {@link eu.etaxonomy.cdm.model.agent.Person} object.
55
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
56
	 */
57
	protected PersonSelectionDialog(Shell shell, ConversationHolder conversation, String title,
58
			boolean multi, String settings, Person cdmObject) {
59
		super(shell, conversation, title, multi, settings, cdmObject);
60
	}
61

    
62

    
63

    
64
	/* (non-Javadoc)
65
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
66
	 */
67
	/** {@inheritDoc} */
68
	@Override
69
	protected Person getPersistentObject(UUID uuid) {
70
		return (Person) CdmStore.getService(IAgentService.class).load(uuid);
71
	}
72

    
73
	/* (non-Javadoc)
74
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
75
	 */
76
	/** {@inheritDoc} */
77
	@Override
78
	protected void initModel() {
79
		model = CdmStore.getService(IAgentService.class).getPersonUuidAndTitleCache();
80
	}
81

    
82
	/** {@inheritDoc} */
83
	@Override
84
	protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
85
		return new NewPersonWizard();
86
	}
87

    
88
	/** {@inheritDoc} */
89
	@Override
90
	protected String getNewWizardLinkText() {
91
		return String.format("Create a new <a>%1s</a>", "Person ");
92
	}
93
}
(23-23/35)