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
.classification
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.swt
.SWT
;
16 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
19 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
;
20 import eu
.etaxonomy
.taxeditor
.ui
.forms
.ICdmFormElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.forms
.TextWithLabelElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.SelectionType
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
27 * <p>ClassificationDetailElement class.</p>
30 * @created Sep 27, 2010
33 public class ClassificationDetailElement
extends AbstractCdmDetailElement
<Classification
> {
36 private static final Logger logger
= Logger
37 .getLogger(ClassificationDetailElement
.class);
39 private TextWithLabelElement text_treeLabel
;
41 private ReferenceSelectionElement selection_reference
;
43 private TextWithLabelElement text_microReference
;
46 * <p>Constructor for ClassificationDetailElement.</p>
48 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
49 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
51 public ClassificationDetailElement(CdmFormFactory formFactory
,
52 ICdmFormElement formElement
) {
53 super(formFactory
, formElement
);
57 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
61 protected void createControls(ICdmFormElement formElement
,
62 Classification entity
, int style
) {
63 text_treeLabel
= formFactory
.createTextWithLabelElement(formElement
, "Label", entity
!= null ? entity
.getTitleCache() : null, SWT
.NULL
);
64 selection_reference
= (ReferenceSelectionElement
) formFactory
.createSelectionElement(SelectionType
.REFERENCE
, getConversationHolder(), formElement
, "Reference", entity
!= null ? entity
.getReference() : null, SWT
.NULL
);
65 text_microReference
= formFactory
.createTextWithLabelElement(formElement
, "Reference Detail", entity
!= null ? entity
.getMicroReference() : null, SWT
.NULL
);
69 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
73 public void handleEvent(Object eventSource
) {
74 if(eventSource
== text_treeLabel
){
75 LanguageString languageString
= LanguageString
.NewInstance(text_treeLabel
.getText(), CdmStore
.getDefaultLanguage());
76 getEntity().setName(languageString
);
78 else if(eventSource
== selection_reference
){
79 getEntity().setReference(selection_reference
.getEntity());
81 else if(eventSource
== text_microReference
){
82 getEntity().setMicroReference(text_microReference
.getText());