Project

General

Profile

Download (3.22 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.Control;
15
import org.eclipse.swt.widgets.Shell;
16
import org.eclipse.swt.widgets.Text;
17

    
18
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
19
import eu.etaxonomy.cdm.api.service.IAgentService;
20
import eu.etaxonomy.cdm.model.agent.AgentBase;
21
import eu.etaxonomy.cdm.model.agent.Team;
22
import eu.etaxonomy.cdm.model.common.CdmBase;
23
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
24
import eu.etaxonomy.taxeditor.newWizard.NewTeamWizard;
25
import eu.etaxonomy.taxeditor.store.CdmStore;
26

    
27
/**
28
 * <p>FilteredNomenclaturalAuthorTeamSelectionDialog class.</p>
29
 *
30
 * @author n.hoffmann
31
 * @created Jun 22, 2010
32
 * @version 1.0
33
 */
34
public class NomenclaturalAuthorTeamSelectionDialog extends
35
	AbstractFilteredCdmResourceSelectionDialog<AgentBase> {
36

    
37
	/**
38
	 * <p>select</p>
39
	 *
40
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
41
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
42
	 * @param team a {@link eu.etaxonomy.cdm.model.agent.Team} object.
43
	 * @return a {@link eu.etaxonomy.cdm.model.agent.Team} object.
44
	 */
45
	public static Team select(Shell shell, ConversationHolder conversation, Team team){
46
		NomenclaturalAuthorTeamSelectionDialog dialog = new NomenclaturalAuthorTeamSelectionDialog(shell, conversation,
47
				"Choose Author Team", false, NomenclaturalAuthorTeamSelectionDialog.class.getCanonicalName(), team);
48
		return (Team)getSelectionFromDialog(dialog);
49
	}
50

    
51
	/**
52
	 * <p>Constructor for FilteredNomenclaturalAuthorTeamSelectionDialog.</p>
53
	 *
54
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
55
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
56
	 * @param title a {@link java.lang.String} object.
57
	 * @param multi a boolean.
58
	 * @param settings a {@link java.lang.String} object.
59
	 * @param agent a {@link eu.etaxonomy.cdm.model.agent.Team} object.
60
	 */
61
	protected NomenclaturalAuthorTeamSelectionDialog(Shell shell, ConversationHolder conversation, String title,
62
			boolean multi, String settings, Team agent) {
63
		super(shell, conversation, title, multi, settings, agent);
64
	}
65

    
66
	/** {@inheritDoc} */
67
	@Override
68
	protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
69
		return new NewTeamWizard(true);
70
	}
71

    
72
	/** {@inheritDoc} */
73
	@Override
74
	protected String getNewWizardLinkText() {
75
		return String.format("Create a new <a>%1s</a>", "Team ");
76
	}
77

    
78
	/** {@inheritDoc} */
79
	@Override
80
	protected void initModel() {
81
	    Control control = getPatternControl();
82
        String pattern = null;
83
        if (control != null){
84
            pattern = ((Text)control).getText();
85
        }
86

    
87
		model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern, Team.class);
88
	}
89

    
90
	/** {@inheritDoc} */
91
	@Override
92
	protected Team getPersistentObject(UUID uuid) {
93
		return CdmBase.deproxy(CdmStore.getService(IAgentService.class).load(uuid), Team.class) ;
94
	}
95
}
(19-19/34)