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 org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
18 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
19 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
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
.element
.CdmFormFactory
.SelectionType
;
25 import eu
.etaxonomy
.taxeditor
.ui
.selection
.DerivedUnitBaseSelectionElement
;
29 * IndividualsAssociationDetailElement class.
33 * @created Jun 10, 2010
36 public class IndividualsAssociationDetailElement
extends
37 AbstractDetailedDescriptionDetailElement
<IndividualsAssociation
> {
39 private static final Logger logger
= Logger
40 .getLogger(IndividualsAssociationDetailElement
.class);
41 private TextWithLabelElement text_description
;
42 private DerivedUnitBaseSelectionElement selection_derivedUnit
;
46 * Constructor for IndividualsAssociationDetailElement.
50 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
53 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
57 * {@link eu.etaxonomy.cdm.model.description.IndividualsAssociation}
62 public IndividualsAssociationDetailElement(CdmFormFactory formFactory
,
63 ICdmFormElement formElement
, IndividualsAssociation entity
,
65 super(formFactory
, formElement
, entity
, style
);
70 protected void createControls(ICdmFormElement formElement
,
71 IndividualsAssociation entity
, int style
) {
72 selection_derivedUnit
= (DerivedUnitBaseSelectionElement
) formFactory
73 .createSelectionElement(SelectionType
.DERIVED_UNIT
,
74 getConversationHolder(), formElement
, "Unit",
75 entity
.getAssociatedSpecimenOrObservation(),
76 DerivedUnitBaseSelectionElement
.DEFAULT
, style
);
78 text_description
= formFactory
.createMultilineTextWithLabel(
79 formElement
, "Description", 200, style
);
80 Map
<Language
, LanguageString
> descriptions
= entity
.getDescription();
82 if (descriptions
.get(CdmStore
.getDefaultLanguage()) != null) {
83 text_description
.setText(descriptions
.get(
84 CdmStore
.getDefaultLanguage()).getText());
90 public void handleEvent(Object eventSource
) {
91 if (eventSource
== selection_derivedUnit
) {
92 getEntity().setAssociatedSpecimenOrObservation(
93 selection_derivedUnit
.getEntity());
94 } else if (eventSource
== text_description
) {
95 getEntity().addDescription(text_description
.getText(),
96 CdmStore
.getDefaultLanguage());