Merged refactoring from development branch.
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / ui / dialogs / filteredSelection / TeamSelectionDialog.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.dialogs.filteredSelection;
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>FilteredTeamSelectionDialog class.</p>
26 *
27 * @author n.hoffmann
28 * @created Sep 24, 2009
29 * @version 1.0
30 */
31 public class TeamSelectionDialog 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 TeamSelectionDialog dialog = new TeamSelectionDialog(shell, conversation,
44 "Choose Team", false, TeamSelectionDialog.class.getCanonicalName(), team);
45 return getSelectionFromDialog(dialog);
46 }
47
48 /**
49 * <p>Constructor for FilteredTeamSelectionDialog.</p>
50 *
51 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
52 * @param title a {@link java.lang.String} object.
53 * @param multi a boolean.
54 * @param settings a {@link java.lang.String} object.
55 * @param cdmObject a {@link eu.etaxonomy.cdm.model.agent.Team} object.
56 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
57 */
58 protected TeamSelectionDialog(Shell shell, ConversationHolder conversation,
59 String title, boolean multi, String settings,
60 Team cdmObject) {
61 super(shell, conversation, title, multi, settings, cdmObject);
62 }
63
64 /* (non-Javadoc)
65 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
66 */
67 /** {@inheritDoc} */
68 @Override
69 protected void initModel() {
70 model = CdmStore.getService(IAgentService.class).getTeamUuidAndTitleCache();
71 }
72
73 /** {@inheritDoc} */
74 @Override
75 protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
76 return new NewTeamWizard();
77 }
78
79 /** {@inheritDoc} */
80 @Override
81 protected String getNewWizardLinkText() {
82 return "Click link to create a new <A>Team</A>.";
83 }
84
85 /** {@inheritDoc} */
86 @Override
87 protected Team getPersistentObject(UUID uuid) {
88 return (Team) CdmStore.getService(IAgentService.class).load(uuid);
89 }
90 }