2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
;
14 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
15 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
16 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
17 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
18 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
19 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
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
;
27 * @created Jun 10, 2010
30 public class IndividualsAssociationDetailElement
extends
31 AbstractDetailedDescriptionDetailElement
<IndividualsAssociation
> {
33 private TextWithLabelElement text_description
;
34 private EntitySelectionElement
<SpecimenOrObservationBase
> selection_derivedUnit
;
36 public IndividualsAssociationDetailElement(CdmFormFactory formFactory
,
37 ICdmFormElement formElement
, IndividualsAssociation entity
,
39 super(formFactory
, formElement
, entity
, style
);
44 protected void createControls(ICdmFormElement formElement
,
45 IndividualsAssociation entity
, int style
) {
47 selection_derivedUnit
= formFactory
48 .createSelectionElement(SpecimenOrObservationBase
.class,
49 //getConversationHolder(),
50 formElement
, "Occurrence/Unit",
51 CdmBase
.deproxy(entity
.getAssociatedSpecimenOrObservation(),SpecimenOrObservationBase
.class),
52 EntitySelectionElement
.ALL
, style
);
54 text_description
= formFactory
.createMultiLineTextWithLabel(
55 formElement
, "Relationship to the unit:", 80, style
);
56 Map
<Language
, LanguageString
> descriptions
= entity
.getDescription();
58 if (descriptions
.get(CdmStore
.getDefaultLanguage()) != null) {
59 text_description
.setText(descriptions
.get(
60 CdmStore
.getDefaultLanguage()).getText());
63 createTimePeriod(formElement
, entity
, style
);
64 if (entity
.getFeature().getRecommendedModifierEnumeration() != null && !entity
.getFeature().getRecommendedModifierEnumeration().isEmpty()){
65 createModifier(formElement
, entity
, style
);
71 public void handleEvent(Object eventSource
) {
72 super.handleEvent(eventSource
);
73 if (eventSource
== selection_derivedUnit
) {
74 getEntity().setAssociatedSpecimenOrObservation(
75 selection_derivedUnit
.getEntity());
76 } else if (eventSource
== text_description
) {
77 getEntity().putDescription(CdmStore
.getDefaultLanguage(), text_description
.getText());