2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
;
12 import java
.util
.UUID
;
14 import org
.eclipse
.swt
.widgets
.Shell
;
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
;
23 * <p>FilteredPersonSelectionDialog class.</p>
26 * @created Sep 24, 2009
29 public class PersonSelectionDialog
extends
30 AbstractFilteredCdmResourceSelectionDialog
<Person
> {
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.
40 public static Person
select(Shell shell
, //onversationHolder conversation,
42 PersonSelectionDialog dialog
= new PersonSelectionDialog(shell
, //conversation,
43 "Choose a person", false, PersonSelectionDialog
.class.getCanonicalName(), person
);
44 return getSelectionFromDialog(dialog
);
48 * <p>Constructor for FilteredPersonSelectionDialog.</p>
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.
57 protected PersonSelectionDialog(Shell shell
,// ConversationHolder conversation,
59 boolean multi
, String settings
, Person cdmObject
) {
60 super(shell
, //conversation,
61 title
, multi
, settings
, cdmObject
);
67 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
71 protected Person
getPersistentObject(UUID uuid
) {
72 return (Person
) CdmStore
.getService(IAgentService
.class).load(uuid
);
76 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
80 protected void callService(String pattern
) {
81 model
= CdmStore
.getService(IAgentService
.class).getUuidAndTitleCache(Person
.class, limitOfInitialElements
, pattern
);
86 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
87 return new NewPersonWizard();
92 protected String
[] getNewWizardText() {
93 return new String
[]{"New Person"};