Project

General

Profile

Download (2.99 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
			AgentSelectionDialog<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, title, multi, settings, cdmObject, true);
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#search
76
	 */
77
	/** {@inheritDoc} */
78
	@Override
79
	protected void callService(String pattern) {
80
		model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class, limitOfInitialElements, pattern);
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[] getNewWizardText() {
92
		return new String[]{"New Person"};
93
	}
94
}
(30-30/46)