Project

General

Profile

Download (3.04 KB) Statistics
| Branch: | Tag: | Revision:
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.ui.dialog.selection;
12

    
13
import java.util.UUID;
14

    
15
import org.eclipse.swt.widgets.Shell;
16

    
17
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18
import eu.etaxonomy.cdm.api.service.IAgentService;
19
import eu.etaxonomy.cdm.model.agent.Person;
20
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
21
import eu.etaxonomy.taxeditor.newWizard.NewPersonWizard;
22
import eu.etaxonomy.taxeditor.store.CdmStore;
23

    
24
/**
25
 * <p>FilteredPersonSelectionDialog class.</p>
26
 *
27
 * @author n.hoffmann
28
 * @created Sep 24, 2009
29
 * @version 1.0
30
 */
31
public class PersonSelectionDialog extends
32
			AbstractFilteredCdmResourceSelectionDialog<Person> {
33

    
34
	/**
35
	 * <p>select</p>
36
	 *
37
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
38
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
39
	 * @param person a {@link eu.etaxonomy.cdm.model.agent.Person} object.
40
	 * @return a {@link eu.etaxonomy.cdm.model.agent.Person} object.
41
	 */
42
	public static Person select(Shell shell, ConversationHolder conversation, Person person){
43
		PersonSelectionDialog dialog = new PersonSelectionDialog(shell, conversation,
44
				"Choose a person", false, PersonSelectionDialog.class.getCanonicalName(), person);
45
		return getSelectionFromDialog(dialog);
46
	}
47

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

    
63

    
64

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

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

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

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