Project

General

Profile

Download (3.25 KB) Statistics
| Branch: | Tag: | Revision:
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.TermType;
13
import eu.etaxonomy.cdm.model.location.NamedArea;
14
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
15
import eu.etaxonomy.cdm.model.location.NamedAreaType;
16
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
20

    
21
/**
22
 * @author l.morris
23
 * @date 20 Dec 2011
24
 *
25
 */
26
public class NamedAreaDetailElement extends DefinedTermDetailElement<NamedArea> {
27

    
28
	// level
29
	// type
30
	private TermComboElement<NamedAreaType> combo_namedAreaType;
31
	private TermComboElement<NamedAreaLevel> combo_namedAreaLevel;
32
	// validPeriod
33
	private TimePeriodElement timePeriod_validPeriod;
34

    
35
	/**
36
	 * @param formFactory
37
	 * @param formElement
38
	 */
39
	public NamedAreaDetailElement(CdmFormFactory formFactory,
40
			ICdmFormElement formElement) {
41
		super(formFactory, formElement);
42
	}
43

    
44
	@Override
45
    public void createControls(ICdmFormElement formElement, NamedArea entity, int style) {
46
		super.createControls(formElement, entity, style);
47

    
48
		timePeriod_validPeriod = formFactory.createTimePeriodElement(formElement, "Valid Period", getEntity().getValidPeriod(), style);
49
		combo_namedAreaType = formFactory.createDefinedTermComboElement(TermType.NamedAreaType, formElement, "Named Area Type", getEntity().getType(), style);
50
		combo_namedAreaLevel = formFactory.createDefinedTermComboElement(TermType.NamedAreaLevel, formElement, "Named Area Level", getEntity().getLevel(), style);
51

    
52
	}
53

    
54
	/* (non-Javadoc)
55
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
56
	 */
57
	@Override
58
	public void handleEvent(Object eventSource) {
59

    
60
		if (eventSource == textIdInVocabulary){
61
			getEntity().setIdInVocabulary(textIdInVocabulary.getText());
62
		} else if (eventSource == element_Representation) {
63
			getEntity().setLabel(element_Representation.getSelectedRepresentation().getLabel(),  element_Representation.getSelectedRepresentation().getLanguage());
64
			getEntity().getRepresentation(element_Representation.getSelectedRepresentation().getLanguage()).setAbbreviatedLabel(element_Representation.getSelectedRepresentation().getAbbreviatedLabel());
65
			getEntity().getRepresentation(element_Representation.getSelectedRepresentation().getLanguage()).setText(element_Representation.getSelectedRepresentation().getDescription());
66
			getEntity().setTitleCache(null);
67
		} else if (eventSource == uri_uri) {
68
			getEntity().setUri(uri_uri.parseText());
69
		} else if (eventSource == timePeriod_validPeriod) {
70
			getEntity().setValidPeriod(timePeriod_validPeriod.getTimePeriod());
71
		} else if (eventSource == combo_namedAreaType) {
72
			getEntity().setType(combo_namedAreaType.getSelection());
73
		} else if (eventSource == combo_namedAreaLevel) {
74
			getEntity().setLevel(combo_namedAreaLevel.getSelection());
75
		}
76

    
77

    
78
	}
79

    
80

    
81
}
(7-7/18)