Project

General

Profile

Download (2.88 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.service.IAgentService;
17
import eu.etaxonomy.cdm.model.agent.Team;
18
import eu.etaxonomy.cdm.model.common.CdmBase;
19
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
20
import eu.etaxonomy.taxeditor.newWizard.NewTeamWizard;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * <p>FilteredTeamSelectionDialog class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created Sep 24, 2009
28
 * @version 1.0
29
 */
30
public class TeamSelectionDialog extends
31
		AbstractFilteredCdmResourceSelectionDialog<Team> {
32

    
33
	/**
34
	 * <p>select</p>
35
	 *
36
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
37
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
38
	 * @param team a {@link eu.etaxonomy.cdm.model.agent.Team} object.
39
	 * @return a {@link eu.etaxonomy.cdm.model.agent.Team} object.
40
	 */
41
	public static Team select(Shell shell, //ConversationHolder conversation,
42
	        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,
62
		        title, multi, settings, cdmObject);
63
	}
64

    
65
	/* (non-Javadoc)
66
	 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
67
	 */
68
	/** {@inheritDoc} */
69
	@Override
70
	protected void callService(String pattern) {
71
		model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class, limitOfInitialElements, pattern);
72

    
73
	}
74

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

    
81
	/** {@inheritDoc} */
82
	@Override
83
	protected String[] getNewWizardText() {
84
		return new String[]{"New Team"};
85
	}
86

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