3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
;
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
;
27 public class NamedAreaDetailElement
extends DefinedTermDetailElement
<NamedArea
> {
31 private TermComboElement
<NamedAreaType
> combo_namedAreaType
;
32 private TermComboElement
<NamedAreaLevel
> combo_namedAreaLevel
;
34 private TimePeriodElement timePeriod_validPeriod
;
40 public NamedAreaDetailElement(CdmFormFactory formFactory
,
41 ICdmFormElement formElement
) {
42 super(formFactory
, formElement
);
46 public void createControls(ICdmFormElement formElement
, NamedArea entity
, int style
) {
47 super.createControls(formElement
, entity
, style
);
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
);
56 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
59 public void handleEvent(Object eventSource
) {
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());