Project

General

Profile

Download (2.89 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
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.
8
*/
9

    
10
package eu.etaxonomy.taxeditor.ui.dialog.selection;
11

    
12
import java.util.UUID;
13

    
14
import org.eclipse.swt.widgets.Shell;
15

    
16
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
17
import eu.etaxonomy.cdm.api.service.IAgentService;
18
import eu.etaxonomy.cdm.model.agent.Team;
19
import eu.etaxonomy.cdm.model.common.CdmBase;
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 String.format("Create a new <a>%1s</a>", "Team ");
83
	}
84

    
85
	/** {@inheritDoc} */
86
	@Override
87
	protected Team getPersistentObject(UUID uuid) {
88
		return CdmBase.deproxy(CdmStore.getService(IAgentService.class).load(uuid), Team.class);
89
	}
90
}
(34-34/35)