Project

General

Profile

Download (2.9 KB) Statistics
| Branch: | Tag: | Revision:
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>FilteredTeamSelectionDialog class.</p>
27
 *
28
 * @author n.hoffmann
29
 * @created Sep 24, 2009
30
 * @version 1.0
31
 */
32
public class TeamSelectionDialog 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
		TeamSelectionDialog dialog = new TeamSelectionDialog(shell, conversation,
45
				"Choose Team", false, TeamSelectionDialog.class.getCanonicalName(), team);
46
		return getSelectionFromDialog(dialog);
47
	}
48

    
49
	/**
50
	 * <p>Constructor for FilteredTeamSelectionDialog.</p>
51
	 *
52
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} 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 cdmObject a {@link eu.etaxonomy.cdm.model.agent.Team} object.
57
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
58
	 */
59
	protected TeamSelectionDialog(Shell shell, ConversationHolder conversation,
60
			String title, boolean multi, String settings,
61
			Team cdmObject) {
62
		super(shell, conversation, title, multi, settings, cdmObject);
63
	}
64

    
65
	/* (non-Javadoc)
66
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
67
	 */
68
	/** {@inheritDoc} */
69
	@Override
70
	protected void initModel() {
71
		model = CdmStore.getService(IAgentService.class).getTeamUuidAndTitleCache();
72
	}
73

    
74
	/** {@inheritDoc} */
75
	@Override
76
	protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
77
		return new NewTeamWizard();
78
	}
79

    
80
	/** {@inheritDoc} */
81
	@Override
82
	protected String getNewWizardLinkText() {
83
		return String.format("Create a new <a>%1s</a>", "Team ");
84
	}
85

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