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
.element
.CdmFormFactory
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmPropertyChangeEvent
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
.SelectionType
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
25 import eu
.etaxonomy
.taxeditor
.ui
.selection
.ReferenceSelectionElement
;
29 * ClassificationDetailElement class.
33 * @created Sep 27, 2010
36 public class ClassificationDetailElement
extends
37 AbstractCdmDetailElement
<Classification
> {
39 private static final Logger logger
= Logger
40 .getLogger(ClassificationDetailElement
.class);
42 private TextWithLabelElement text_treeLabel
;
44 private ReferenceSelectionElement selection_reference
;
46 private TextWithLabelElement text_microReference
;
50 * Constructor for ClassificationDetailElement.
54 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
57 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
60 public ClassificationDetailElement(CdmFormFactory formFactory
,
61 ICdmFormElement formElement
) {
62 super(formFactory
, formElement
);
69 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
70 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
71 * eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
75 protected void createControls(ICdmFormElement formElement
,
76 Classification entity
, int style
) {
77 text_treeLabel
= formFactory
.createTextWithLabelElement(formElement
,
78 "Label", entity
!= null ? entity
.getTitleCache() : null,
80 selection_reference
= (ReferenceSelectionElement
) formFactory
81 .createSelectionElement(SelectionType
.REFERENCE
,
82 getConversationHolder(), formElement
, "Reference",
83 entity
!= null ? entity
.getReference() : null,
84 ReferenceSelectionElement
.DEFAULT
, SWT
.NULL
);
85 text_microReference
= formFactory
.createTextWithLabelElement(
86 formElement
, "Reference Detail",
87 entity
!= null ? entity
.getMicroReference() : null, SWT
.NULL
);
94 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
99 public void handleEvent(Object eventSource
) {
100 if (eventSource
== text_treeLabel
) {
101 LanguageString languageString
= LanguageString
.NewInstance(
102 text_treeLabel
.getText(), CdmStore
.getDefaultLanguage());
103 getEntity().setName(languageString
);
104 } else if (eventSource
== selection_reference
) {
105 getEntity().setReference(selection_reference
.getEntity());
106 } else if (eventSource
== text_microReference
) {
107 getEntity().setMicroReference(text_microReference
.getText());