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
.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
.forms
.CdmFormFactory
;
21 import eu
.etaxonomy
.taxeditor
.forms
.ICdmFormElement
;
22 import eu
.etaxonomy
.taxeditor
.forms
.TextWithLabelElement
;
23 import eu
.etaxonomy
.taxeditor
.forms
.CdmFormFactory
.SelectionType
;
24 import eu
.etaxonomy
.taxeditor
.forms
.selection
.DerivedUnitBaseSelectionElement
;
25 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
28 * <p>IndividualsAssociationDetailElement class.</p>
31 * @created Jun 10, 2010
34 public class IndividualsAssociationDetailElement
extends AbstractDetailedDescriptionDetailElement
<IndividualsAssociation
>{
36 private static final Logger logger
= Logger
37 .getLogger(IndividualsAssociationDetailElement
.class);
38 private TextWithLabelElement text_description
;
39 private DerivedUnitBaseSelectionElement selection_derivedUnit
;
42 * <p>Constructor for IndividualsAssociationDetailElement.</p>
44 * @param formFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object.
45 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
46 * @param entity a {@link eu.etaxonomy.cdm.model.description.IndividualsAssociation} object.
49 public IndividualsAssociationDetailElement(CdmFormFactory formFactory
,
50 ICdmFormElement formElement
, IndividualsAssociation entity
, int style
) {
51 super(formFactory
, formElement
, entity
, style
);
56 protected void createControls(ICdmFormElement formElement
,
57 IndividualsAssociation entity
, int style
) {
58 selection_derivedUnit
= (DerivedUnitBaseSelectionElement
) formFactory
.createSelectionElement(SelectionType
.DERIVED_UNIT
, getConversationHolder(), formElement
, "Unit", entity
.getAssociatedSpecimenOrObservation(), style
);
60 text_description
= formFactory
.createMultilineTextWithLabel(formElement
, "Description", 200, style
);
61 Map
<Language
, LanguageString
> descriptions
= entity
.getDescription();
63 if(descriptions
.get(CdmStore
.getDefaultLanguage()) != null){
64 text_description
.setText(descriptions
.get(CdmStore
.getDefaultLanguage()).getText());
70 public void handleEvent(Object eventSource
) {
71 if(eventSource
== selection_derivedUnit
){
72 getEntity().setAssociatedSpecimenOrObservation(selection_derivedUnit
.getEntity());
73 }else if(eventSource
== text_description
){
74 getEntity().addDescription(text_description
.getText(), CdmStore
.getDefaultLanguage());