Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / selection / NomenclaturalAuthorTeamSelectionElement.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.selection;
11
12 import org.eclipse.swt.events.SelectionEvent;
13
14 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15 import eu.etaxonomy.cdm.model.agent.Team;
16 import eu.etaxonomy.taxeditor.ui.dialog.selection.NomenclaturalAuthorTeamSelectionDialog;
17 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
20 /**
21 * <p>
22 * NomenclaturalAuthorTeamSelectionElement class.
23 * </p>
24 *
25 * @author n.hoffmann
26 * @created Jun 22, 2010
27 * @version 1.0
28 */
29 public class NomenclaturalAuthorTeamSelectionElement extends
30 EntitySelectionElement<Team> {
31
32 public static final int DEFAULT = EDITABLE | SELECTABLE | DELETABLE;
33
34 /**
35 * <p>
36 * Constructor for NomenclaturalAuthorTeamSelectionElement.
37 * </p>
38 *
39 * @param formFactory
40 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
41 * object.
42 * @param conversation
43 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
44 * object.
45 * @param parentElement
46 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
47 * object.
48 * @param labelString
49 * a {@link java.lang.String} object.
50 * @param entity
51 * a {@link eu.etaxonomy.cdm.model.agent.Team} object.
52 * @param style
53 * a int.
54 */
55 public NomenclaturalAuthorTeamSelectionElement(CdmFormFactory formFactory,
56 ConversationHolder conversation, ICdmFormElement parentElement,
57 String labelString, Team entity, int mode, int style) {
58 super(formFactory, conversation, parentElement, Team.class, labelString, entity,
59 mode, style);
60 }
61
62 /** {@inheritDoc} */
63 @Override
64 protected String getTitle() {
65 return (entity != null) ? entity.getNomenclaturalTitle() : "";
66 }
67
68 /** {@inheritDoc} */
69 @Override
70 public void widgetSelected(SelectionEvent e) {
71 Team newSelection = NomenclaturalAuthorTeamSelectionDialog.select(
72 getShell(), getConversationHolder(), entity);
73 setSelectionInternal(newSelection);
74 }
75 }