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
.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
;
24 * <p>FilteredPersonSelectionDialog class.</p>
27 * @created Sep 24, 2009
30 public class PersonSelectionDialog
extends
31 AbstractFilteredCdmResourceSelectionDialog
<Person
> {
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.
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
);
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
, String title
,
58 boolean multi
, String settings
, Person cdmObject
) {
59 super(shell
, conversation
, title
, multi
, settings
, cdmObject
);
65 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
69 protected Person
getPersistentObject(UUID uuid
) {
70 return (Person
) CdmStore
.getService(IAgentService
.class).load(uuid
);
74 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
78 protected void search() {
79 model
= CdmStore
.getService(IAgentService
.class).getPersonUuidAndTitleCache();
84 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
85 return new NewPersonWizard();
90 protected String
getNewWizardLinkText() {
91 return String
.format("Create a new <a>%1s</a>", "Person ");