1 |
729887cf
|
n.hoffmann
|
// $Id$
|
2 |
|
|
/**
|
3 |
|
|
* Copyright (C) 2007 EDIT
|
4 |
f0a072ff
|
Patric Plitzner
|
* European Distributed Institute of Taxonomy
|
5 |
729887cf
|
n.hoffmann
|
* http://www.e-taxonomy.eu
|
6 |
f0a072ff
|
Patric Plitzner
|
*
|
7 |
729887cf
|
n.hoffmann
|
* 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 |
78222507
|
n.hoffmann
|
package eu.etaxonomy.taxeditor.ui.dialog.selection;
|
12 |
729887cf
|
n.hoffmann
|
|
13 |
|
|
import java.util.UUID;
|
14 |
|
|
|
15 |
|
|
import org.eclipse.swt.widgets.Shell;
|
16 |
|
|
|
17 |
2d9a13f7
|
n.hoffmann
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
18 |
db5e366d
|
n.hoffmann
|
import eu.etaxonomy.cdm.api.service.IAgentService;
|
19 |
729887cf
|
n.hoffmann
|
import eu.etaxonomy.cdm.model.agent.Team;
|
20 |
968bf39e
|
Andreas Müller
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
21 |
f211dd28
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
|
22 |
|
|
import eu.etaxonomy.taxeditor.newWizard.NewTeamWizard;
|
23 |
729887cf
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
24 |
|
|
|
25 |
|
|
/**
|
26 |
3be6ef3e
|
n.hoffmann
|
* <p>FilteredTeamSelectionDialog class.</p>
|
27 |
|
|
*
|
28 |
729887cf
|
n.hoffmann
|
* @author n.hoffmann
|
29 |
|
|
* @created Sep 24, 2009
|
30 |
|
|
* @version 1.0
|
31 |
|
|
*/
|
32 |
9a0f58cd
|
n.hoffmann
|
public class TeamSelectionDialog extends
|
33 |
729887cf
|
n.hoffmann
|
AbstractFilteredCdmResourceSelectionDialog<Team> {
|
34 |
f0a072ff
|
Patric Plitzner
|
|
35 |
3be6ef3e
|
n.hoffmann
|
/**
|
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 |
4afeb896
|
n.hoffmann
|
public static Team select(Shell shell, ConversationHolder conversation, Team team){
|
44 |
9a0f58cd
|
n.hoffmann
|
TeamSelectionDialog dialog = new TeamSelectionDialog(shell, conversation,
|
45 |
|
|
"Choose Team", false, TeamSelectionDialog.class.getCanonicalName(), team);
|
46 |
729887cf
|
n.hoffmann
|
return getSelectionFromDialog(dialog);
|
47 |
|
|
}
|
48 |
f0a072ff
|
Patric Plitzner
|
|
49 |
729887cf
|
n.hoffmann
|
/**
|
50 |
3be6ef3e
|
n.hoffmann
|
* <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 |
729887cf
|
n.hoffmann
|
*/
|
59 |
9a0f58cd
|
n.hoffmann
|
protected TeamSelectionDialog(Shell shell, ConversationHolder conversation,
|
60 |
729887cf
|
n.hoffmann
|
String title, boolean multi, String settings,
|
61 |
|
|
Team cdmObject) {
|
62 |
2d9a13f7
|
n.hoffmann
|
super(shell, conversation, title, multi, settings, cdmObject);
|
63 |
729887cf
|
n.hoffmann
|
}
|
64 |
|
|
|
65 |
|
|
/* (non-Javadoc)
|
66 |
2d9a13f7
|
n.hoffmann
|
* @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
|
67 |
729887cf
|
n.hoffmann
|
*/
|
68 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
69 |
729887cf
|
n.hoffmann
|
@Override
|
70 |
2d9a13f7
|
n.hoffmann
|
protected void initModel() {
|
71 |
db5e366d
|
n.hoffmann
|
model = CdmStore.getService(IAgentService.class).getTeamUuidAndTitleCache();
|
72 |
729887cf
|
n.hoffmann
|
}
|
73 |
|
|
|
74 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
75 |
729887cf
|
n.hoffmann
|
@Override
|
76 |
9a0f58cd
|
n.hoffmann
|
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
|
77 |
2d9a13f7
|
n.hoffmann
|
return new NewTeamWizard();
|
78 |
|
|
}
|
79 |
|
|
|
80 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
81 |
2d9a13f7
|
n.hoffmann
|
@Override
|
82 |
|
|
protected String getNewWizardLinkText() {
|
83 |
f0a072ff
|
Patric Plitzner
|
return String.format("Create a new <a>%1s</a>", "Team ");
|
84 |
729887cf
|
n.hoffmann
|
}
|
85 |
|
|
|
86 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
87 |
729887cf
|
n.hoffmann
|
@Override
|
88 |
2d9a13f7
|
n.hoffmann
|
protected Team getPersistentObject(UUID uuid) {
|
89 |
968bf39e
|
Andreas Müller
|
return CdmBase.deproxy(CdmStore.getService(IAgentService.class).load(uuid), Team.class);
|
90 |
729887cf
|
n.hoffmann
|
}
|
91 |
|
|
}
|