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
.DerivedUnit
;
20 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
21 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.compatibility
.ICdmFormElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
28 * IndividualsAssociationDetailElement class.
32 * @created Jun 10, 2010
35 public class IndividualsAssociationDetailElement
extends
36 AbstractDetailedDescriptionDetailElement
<IndividualsAssociation
> {
38 private TextWithLabelElement text_description
;
39 private EntitySelectionElement
<DerivedUnit
> selection_derivedUnit
;
43 * Constructor for IndividualsAssociationDetailElement.
47 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
50 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
54 * {@link eu.etaxonomy.cdm.model.description.IndividualsAssociation}
59 public IndividualsAssociationDetailElement(CdmFormFactory formFactory
,
60 ICdmFormElement formElement
, IndividualsAssociation entity
,
62 super(formFactory
, formElement
, entity
, style
);
67 protected void createControls(ICdmFormElement formElement
,
68 IndividualsAssociation entity
, int style
) {
69 selection_derivedUnit
= formFactory
70 .createSelectionElement(DerivedUnit
.class,
71 getConversationHolder(), formElement
, "Unit",
72 CdmBase
.deproxy(entity
.getAssociatedSpecimenOrObservation(),DerivedUnit
.class),
73 EntitySelectionElement
.ALL
, style
);
75 text_description
= formFactory
.createMultilineTextWithLabel(
76 formElement
, "Description", 200, style
);
77 Map
<Language
, LanguageString
> descriptions
= entity
.getDescription();
79 if (descriptions
.get(CdmStore
.getDefaultLanguage()) != null) {
80 text_description
.setText(descriptions
.get(
81 CdmStore
.getDefaultLanguage()).getText());
87 public void handleEvent(Object eventSource
) {
88 if (eventSource
== selection_derivedUnit
) {
89 getEntity().setAssociatedSpecimenOrObservation(
90 selection_derivedUnit
.getEntity());
91 } else if (eventSource
== text_description
) {
92 getEntity().putDescription(CdmStore
.getDefaultLanguage(), text_description
.getText());