5d9099441bbbafe58bd74977f4176d2dedf8c920
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / NomenclaturalAuthorTeamSelectionDialog.java
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.Team;
20 import eu.etaxonomy.cdm.model.common.CdmBase;
21 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
22 import eu.etaxonomy.taxeditor.newWizard.NewTeamWizard;
23 import eu.etaxonomy.taxeditor.store.CdmStore;
24
25 /**
26 * <p>FilteredNomenclaturalAuthorTeamSelectionDialog class.</p>
27 *
28 * @author n.hoffmann
29 * @created Jun 22, 2010
30 * @version 1.0
31 */
32 public class NomenclaturalAuthorTeamSelectionDialog extends
33 AbstractFilteredCdmResourceSelectionDialog<Team> {
34
35 /**
36 * <p>select</p>
37 *
38 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
39 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
40 * @param team a {@link eu.etaxonomy.cdm.model.agent.Team} object.
41 * @return a {@link eu.etaxonomy.cdm.model.agent.Team} object.
42 */
43 public static Team select(Shell shell, ConversationHolder conversation, Team team){
44 NomenclaturalAuthorTeamSelectionDialog dialog = new NomenclaturalAuthorTeamSelectionDialog(shell, conversation,
45 "Choose Author Team", false, NomenclaturalAuthorTeamSelectionDialog.class.getCanonicalName(), team);
46 return getSelectionFromDialog(dialog);
47 }
48
49 /**
50 * <p>Constructor for FilteredNomenclaturalAuthorTeamSelectionDialog.</p>
51 *
52 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
53 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
54 * @param title a {@link java.lang.String} object.
55 * @param multi a boolean.
56 * @param settings a {@link java.lang.String} object.
57 * @param agent a {@link eu.etaxonomy.cdm.model.agent.Team} object.
58 */
59 protected NomenclaturalAuthorTeamSelectionDialog(Shell shell, ConversationHolder conversation, String title,
60 boolean multi, String settings, Team agent) {
61 super(shell, conversation, title, multi, settings, agent);
62 }
63
64 /** {@inheritDoc} */
65 @Override
66 protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
67 return new NewTeamWizard();
68 }
69
70 /** {@inheritDoc} */
71 @Override
72 protected String getNewWizardLinkText() {
73 return String.format("Create a new <a>%1s</a>", "Team ");
74 }
75
76 /** {@inheritDoc} */
77 @Override
78 protected void initModel() {
79 model = CdmStore.getService(IAgentService.class).getTeamUuidAndNomenclaturalTitle();
80 }
81
82 /** {@inheritDoc} */
83 @Override
84 protected Team getPersistentObject(UUID uuid) {
85 return CdmBase.deproxy(CdmStore.getService(IAgentService.class).load(uuid), Team.class) ;
86 }
87 }