smaller changes in selection dialog, use always the service for searching with pattern
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / NomenclaturalAuthorTeamSelectionDialog.java
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.AgentBase;
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>FilteredNomenclaturalAuthorTeamSelectionDialog class.</p>
26 *
27 * @author n.hoffmann
28 * @created Jun 22, 2010
29 * @version 1.0
30 */
31 public class NomenclaturalAuthorTeamSelectionDialog extends
32 AbstractFilteredCdmResourceSelectionDialog<AgentBase> {
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,
43 Team team){
44 NomenclaturalAuthorTeamSelectionDialog dialog = new NomenclaturalAuthorTeamSelectionDialog(shell, //conversation,
45 "Choose Author Team", false, NomenclaturalAuthorTeamSelectionDialog.class.getCanonicalName(), team);
46 return (Team)getSelectionFromDialog(dialog);
47 }
48
49 /**
50 * <p>Constructor for FilteredNomenclaturalAuthorTeamSelectionDialog.</p>
51 *
52 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
53 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
54 * @param title a {@link java.lang.String} object.
55 * @param multi a boolean.
56 * @param settings a {@link java.lang.String} object.
57 * @param agent a {@link eu.etaxonomy.cdm.model.agent.Team} object.
58 */
59 protected NomenclaturalAuthorTeamSelectionDialog(Shell shell, //ConversationHolder conversation,
60 String title,
61 boolean multi, String settings, Team agent) {
62 super(shell, //conversation,
63 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[] getNewWizardText() {
75 return new String[]{"new Team"};
76 }
77
78 // /** {@inheritDoc} */
79 // @Override
80 // protected void search() {
81 // Control control =getSearchField();
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
96 /* (non-Javadoc)
97 * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#callService(java.lang.String)
98 */
99 @Override
100 void callService(String pattern) {
101 model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern, Team.class);
102 }
103 }