1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 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
|
package eu.etaxonomy.taxeditor.ui.section.vocabulary;
|
11
|
|
12
|
import eu.etaxonomy.cdm.model.common.Language;
|
13
|
import eu.etaxonomy.cdm.model.common.TermType;
|
14
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
15
|
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
|
16
|
import eu.etaxonomy.cdm.model.location.NamedAreaType;
|
17
|
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
|
21
|
|
22
|
/**
|
23
|
* @author l.morris
|
24
|
* @date 20 Dec 2011
|
25
|
*
|
26
|
*/
|
27
|
public class NamedAreaDetailElement extends DefinedTermDetailElement<NamedArea> {
|
28
|
|
29
|
// level
|
30
|
// type
|
31
|
private TermComboElement<NamedAreaType> combo_namedAreaType;
|
32
|
private TermComboElement<NamedAreaLevel> combo_namedAreaLevel;
|
33
|
// validPeriod
|
34
|
private TimePeriodElement timePeriod_validPeriod;
|
35
|
|
36
|
/**
|
37
|
* @param formFactory
|
38
|
* @param formElement
|
39
|
*/
|
40
|
public NamedAreaDetailElement(CdmFormFactory formFactory,
|
41
|
ICdmFormElement formElement) {
|
42
|
super(formFactory, formElement);
|
43
|
}
|
44
|
|
45
|
@Override
|
46
|
public void createControls(ICdmFormElement formElement, NamedArea entity, int style) {
|
47
|
super.createControls(formElement, entity, style);
|
48
|
|
49
|
timePeriod_validPeriod = formFactory.createTimePeriodElement(formElement, "Valid Period", getEntity().getValidPeriod(), style);
|
50
|
combo_namedAreaType = formFactory.createDefinedTermComboElement(TermType.NamedAreaType, formElement, "Named Area Type", getEntity().getType(), style);
|
51
|
combo_namedAreaLevel = formFactory.createDefinedTermComboElement(TermType.NamedAreaLevel, formElement, "Named Area Level", getEntity().getLevel(), style);
|
52
|
|
53
|
}
|
54
|
|
55
|
/* (non-Javadoc)
|
56
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
|
57
|
*/
|
58
|
@Override
|
59
|
public void handleEvent(Object eventSource) {
|
60
|
|
61
|
if (eventSource == textIdInVocabulary){
|
62
|
getEntity().setIdInVocabulary(textIdInVocabulary.getText());
|
63
|
} else if (eventSource == text_label) {
|
64
|
getEntity().setLabel(text_label.getText());
|
65
|
getEntity().setTitleCache(null);
|
66
|
} else if (eventSource == text_description) {
|
67
|
getEntity().getRepresentation(Language.getDefaultLanguage()).setText(text_description.getText());
|
68
|
} else if (eventSource == uri_uri) {
|
69
|
getEntity().setUri(uri_uri.getUri());
|
70
|
} else if (eventSource == text_abbreviatedLabel) {
|
71
|
getEntity().getRepresentation(Language.getDefaultLanguage()).setAbbreviatedLabel(text_abbreviatedLabel.getText());
|
72
|
} else if (eventSource == timePeriod_validPeriod) {
|
73
|
getEntity().setValidPeriod(timePeriod_validPeriod.getTimePeriod());
|
74
|
} else if (eventSource == combo_namedAreaType) {
|
75
|
getEntity().setType(combo_namedAreaType.getSelection());
|
76
|
} else if (eventSource == combo_namedAreaLevel) {
|
77
|
getEntity().setLevel(combo_namedAreaLevel.getSelection());
|
78
|
}
|
79
|
|
80
|
|
81
|
}
|
82
|
|
83
|
|
84
|
}
|