Project

General

Profile

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

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

    
32
	/**
33
	 * <p>select</p>
34
	 *
35
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
36
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
37
	 * @param person a {@link eu.etaxonomy.cdm.model.agent.Person} object.
38
	 * @return a {@link eu.etaxonomy.cdm.model.agent.Person} object.
39
	 */
40
	public static Person select(Shell shell, //onversationHolder conversation,
41
	        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,
58
	        String title,
59
			boolean multi, String settings, Person cdmObject) {
60
		super(shell, //conversation,
61
		        title, multi, settings, cdmObject);
62
	}
63

    
64

    
65

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

    
75
	/* (non-Javadoc)
76
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
77
	 */
78
	/** {@inheritDoc} */
79
	@Override
80
	protected void callService(String pattern) {
81
		model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class, limitOfInitialElements, pattern);
82
	}
83

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

    
90
	/** {@inheritDoc} */
91
	@Override
92
	protected String[] getNewWizardText() {
93
		return new String[]{"New Person"};
94
	}
95
}
(29-29/45)