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