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
.classification
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.swt
.SWT
;
16 import eu
.etaxonomy
.cdm
.model
.common
.IAnnotatableEntity
;
17 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonomicTree
;
19 import eu
.etaxonomy
.taxeditor
.forms
.CdmFormFactory
;
20 import eu
.etaxonomy
.taxeditor
.forms
.CdmFormFactory
.SelectionType
;
21 import eu
.etaxonomy
.taxeditor
.forms
.ICdmFormElement
;
22 import eu
.etaxonomy
.taxeditor
.forms
.TextWithLabelElement
;
23 import eu
.etaxonomy
.taxeditor
.forms
.selection
.ReferenceSelectionElement
;
24 import eu
.etaxonomy
.taxeditor
.section
.AbstractCdmDetailElement
;
25 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
28 * <p>ClassificationDetailElement class.</p>
31 * @created Sep 27, 2010
34 public class ClassificationDetailElement
extends AbstractCdmDetailElement
<TaxonomicTree
> {
37 private static final Logger logger
= Logger
38 .getLogger(ClassificationDetailElement
.class);
40 private TextWithLabelElement text_treeLabel
;
42 private ReferenceSelectionElement selection_reference
;
44 private TextWithLabelElement text_microReference
;
47 * <p>Constructor for ClassificationDetailElement.</p>
49 * @param formFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object.
50 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
52 public ClassificationDetailElement(CdmFormFactory formFactory
,
53 ICdmFormElement formElement
) {
54 super(formFactory
, formElement
);
58 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
62 protected void createControls(ICdmFormElement formElement
,
63 TaxonomicTree entity
, int style
) {
64 text_treeLabel
= formFactory
.createTextWithLabelElement(formElement
, "Label", entity
!= null ? entity
.getTitleCache() : null, SWT
.NULL
);
65 selection_reference
= (ReferenceSelectionElement
) formFactory
.createSelectionElement(SelectionType
.REFERENCE
, getConversationHolder(), formElement
, "Reference", entity
!= null ? entity
.getReference() : null, SWT
.NULL
);
66 text_microReference
= formFactory
.createTextWithLabelElement(formElement
, "Reference Detail", entity
!= null ? entity
.getMicroReference() : null, SWT
.NULL
);
70 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
74 public void handleEvent(Object eventSource
) {
75 if(eventSource
== text_treeLabel
){
76 LanguageString languageString
= LanguageString
.NewInstance(text_treeLabel
.getText(), CdmStore
.getDefaultLanguage());
77 getEntity().setName(languageString
);
79 else if(eventSource
== selection_reference
){
80 getEntity().setReference(selection_reference
.getEntity());
82 else if(eventSource
== text_microReference
){
83 getEntity().setMicroReference(text_microReference
.getText());