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.section.description.detail;
|
12
|
|
13
|
import org.eclipse.swt.SWT;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.common.Language;
|
16
|
import eu.etaxonomy.cdm.model.common.TermType;
|
17
|
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
|
18
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
19
|
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
24
|
|
25
|
/**
|
26
|
* <p>CommonNameDetailElement class.</p>
|
27
|
*
|
28
|
* @author n.hoffmann
|
29
|
* @created Jun 10, 2010
|
30
|
* @version 1.0
|
31
|
*/
|
32
|
public class CommonNameDetailElement extends AbstractDetailedDescriptionDetailElement<CommonTaxonName> {
|
33
|
|
34
|
private TermComboElement<Language> combo_language;
|
35
|
private EntitySelectionElement<NamedArea> selection_namedArea;
|
36
|
private TextWithLabelElement commonName;
|
37
|
|
38
|
|
39
|
/**
|
40
|
* <p>Constructor for CommonNameDetailElement.</p>
|
41
|
*
|
42
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
43
|
* @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
44
|
* @param entity a {@link eu.etaxonomy.cdm.model.description.CommonTaxonName} object.
|
45
|
* @param style a int.
|
46
|
*/
|
47
|
public CommonNameDetailElement(CdmFormFactory formFactory,
|
48
|
ICdmFormElement formElement, CommonTaxonName entity, int style) {
|
49
|
super(formFactory, formElement, entity, style);
|
50
|
}
|
51
|
|
52
|
/** {@inheritDoc} */
|
53
|
@Override
|
54
|
protected void createControls(ICdmFormElement formElement,
|
55
|
CommonTaxonName entity, int style) {
|
56
|
commonName = formFactory.createTextWithLabelElement(this, "Common Name", entity.getName(), SWT.WRAP);
|
57
|
|
58
|
combo_language = formFactory.createDefinedTermComboElement(TermType.Language, this, "Language", entity.getLanguage(), style);
|
59
|
|
60
|
selection_namedArea = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
|
61
|
formElement, "Area",
|
62
|
entity.getArea(), EntitySelectionElement.NOTHING, style);
|
63
|
}
|
64
|
|
65
|
/** {@inheritDoc} */
|
66
|
@Override
|
67
|
public void handleEvent(Object eventSource) {
|
68
|
if(eventSource == combo_language){
|
69
|
getEntity().setLanguage(combo_language.getSelection());
|
70
|
}else if(eventSource == selection_namedArea){
|
71
|
getEntity().setArea(selection_namedArea.getEntity());
|
72
|
}else if(eventSource == commonName){
|
73
|
getEntity().setName(commonName.getText());
|
74
|
}
|
75
|
}
|
76
|
|
77
|
}
|