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 java
.net
.URISyntaxException
;
14 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
15 import eu
.etaxonomy
.cdm
.model
.common
.Representation
;
16 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
17 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
18 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaType
;
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
.TimePeriodElement
;
29 public class NamedAreaDetailElement
extends DefinedTermDetailElement
<NamedArea
> {
33 private TermComboElement
<NamedAreaType
> combo_namedAreaType
;
34 private TermComboElement
<NamedAreaLevel
> combo_namedAreaLevel
;
36 private TimePeriodElement timePeriod_validPeriod
;
42 public NamedAreaDetailElement(CdmFormFactory formFactory
,
43 ICdmFormElement formElement
) {
44 super(formFactory
, formElement
);
47 public void createControls(ICdmFormElement formElement
, NamedArea entity
, int style
) {
48 super.createControls(formElement
, entity
, style
);
50 timePeriod_validPeriod
= formFactory
.createTimePeriodElement(formElement
, "Valid Period", getEntity().getValidPeriod(), style
);
51 combo_namedAreaType
= formFactory
.createTermComboElement(NamedAreaType
.class, formElement
, "Named Area Type", getEntity().getType(), style
);
52 combo_namedAreaLevel
= formFactory
.createTermComboElement(NamedAreaLevel
.class, formElement
, "Named Area Level", getEntity().getLevel(), style
);
57 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
60 public void handleEvent(Object eventSource
) {
62 if (eventSource
== text_label
) {
63 getEntity().setLabel(text_label
.getText());
64 getEntity().setTitleCache(null);
65 } else if (eventSource
== text_description
) {
67 Representation representation
= getEntity().getRepresentation(Language
.DEFAULT());
68 representation
.setText(text_description
.getText());
70 } else if (eventSource
== uri_uri
) {
73 getEntity().setUri(uri_uri
.getUri());
74 } catch (URISyntaxException e
) {
78 } else if (eventSource
== timePeriod_validPeriod
) {
79 getEntity().setValidPeriod(timePeriod_validPeriod
.getTimePeriod());
80 } else if (eventSource
== combo_namedAreaType
) {
81 getEntity().setType(combo_namedAreaType
.getSelection());
82 } else if (eventSource
== combo_namedAreaLevel
) {
83 getEntity().setLevel(combo_namedAreaLevel
.getSelection());