1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* 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
|
package eu.etaxonomy.taxeditor.ui.selection;
|
12
|
|
13
|
import org.eclipse.swt.events.SelectionEvent;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
16
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
17
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
18
|
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
21
|
|
22
|
/**
|
23
|
* <p>
|
24
|
* NamedAreaSelectionElement class.
|
25
|
* </p>
|
26
|
*
|
27
|
* @author n.hoffmann
|
28
|
* @created May 11, 2010
|
29
|
* @version 1.0
|
30
|
*/
|
31
|
public class NamedAreaSelectionElement extends
|
32
|
AbstractSelectionElement<NamedArea> {
|
33
|
|
34
|
public static final int DEFAULT = NOTHING;
|
35
|
|
36
|
/**
|
37
|
* <p>
|
38
|
* Constructor for NamedAreaSelectionElement.
|
39
|
* </p>
|
40
|
*
|
41
|
* @param formFactory
|
42
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
43
|
* object.
|
44
|
* @param conversation
|
45
|
* a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
|
46
|
* object.
|
47
|
* @param parentElement
|
48
|
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
|
49
|
* object.
|
50
|
* @param labelString
|
51
|
* a {@link java.lang.String} object.
|
52
|
* @param entity
|
53
|
* a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
|
54
|
* @param style
|
55
|
* a int.
|
56
|
*/
|
57
|
public NamedAreaSelectionElement(CdmFormFactory formFactory,
|
58
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
59
|
String labelString, NamedArea entity, int mode, int style) {
|
60
|
super(formFactory, conversation, parentElement, labelString, entity,
|
61
|
mode, style);
|
62
|
}
|
63
|
|
64
|
/** {@inheritDoc} */
|
65
|
@Override
|
66
|
public void widgetSelected(SelectionEvent e) {
|
67
|
NamedArea newSelection = NamedAreaSelectionDialog.select(
|
68
|
getLayoutComposite().getShell(), getConversationHolder(),
|
69
|
entity);
|
70
|
setSelectionInternal(newSelection);
|
71
|
}
|
72
|
|
73
|
/** {@inheritDoc} */
|
74
|
@Override
|
75
|
protected String getTitle() {
|
76
|
return (entity != null) ? NamedArea.labelWithLevel(entity,
|
77
|
CdmStore.getDefaultLanguage()) : "";
|
78
|
}
|
79
|
}
|