3 * Copyright (C) 2007 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.
11 package eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
;
15 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
16 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
17 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
18 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
19 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
20 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
28 * @created Jun 10, 2010
31 public class IndividualsAssociationDetailElement
extends
32 AbstractDetailedDescriptionDetailElement
<IndividualsAssociation
> {
34 private TextWithLabelElement text_description
;
35 private EntitySelectionElement
<SpecimenOrObservationBase
> selection_derivedUnit
;
37 public IndividualsAssociationDetailElement(CdmFormFactory formFactory
,
38 ICdmFormElement formElement
, IndividualsAssociation entity
,
40 super(formFactory
, formElement
, entity
, style
);
45 protected void createControls(ICdmFormElement formElement
,
46 IndividualsAssociation entity
, int style
) {
47 selection_derivedUnit
= formFactory
48 .createSelectionElement(SpecimenOrObservationBase
.class,
49 getConversationHolder(), formElement
, "Occurrence/Unit",
50 CdmBase
.deproxy(entity
.getAssociatedSpecimenOrObservation(),SpecimenOrObservationBase
.class),
51 EntitySelectionElement
.ALL
, style
);
53 text_description
= formFactory
.createMultiLineTextWithLabel(
54 formElement
, "Relationship to the unit:", 200, style
);
55 Map
<Language
, LanguageString
> descriptions
= entity
.getDescription();
57 if (descriptions
.get(CdmStore
.getDefaultLanguage()) != null) {
58 text_description
.setText(descriptions
.get(
59 CdmStore
.getDefaultLanguage()).getText());
65 public void handleEvent(Object eventSource
) {
66 if (eventSource
== selection_derivedUnit
) {
67 getEntity().setAssociatedSpecimenOrObservation(
68 selection_derivedUnit
.getEntity());
69 } else if (eventSource
== text_description
) {
70 getEntity().putDescription(CdmStore
.getDefaultLanguage(), text_description
.getText());