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
.eclipse
.swt
.SWT
;
15 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
16 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
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
.TextWithLabelElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.section
.campanula
.compatibility
.ICdmFormElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
27 * ClassificationDetailElement class.
31 * @created Sep 27, 2010
34 public class ClassificationDetailElement
extends
35 AbstractCdmDetailElement
<Classification
> {
37 private TextWithLabelElement text_treeLabel
;
39 private EntitySelectionElement
<Reference
> selection_reference
;
41 private TextWithLabelElement text_microReference
;
45 * Constructor for ClassificationDetailElement.
49 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
52 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
55 public ClassificationDetailElement(CdmFormFactory formFactory
,
56 ICdmFormElement formElement
) {
57 super(formFactory
, formElement
);
64 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
65 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
66 * eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
70 protected void createControls(ICdmFormElement formElement
,
71 Classification entity
, int style
) {
72 text_treeLabel
= formFactory
.createTextWithLabelElement(formElement
,
73 "Label", entity
!= null ? entity
.getTitleCache() : null,
75 selection_reference
= formFactory
76 .createSelectionElement(Reference
.class,
77 getConversationHolder(), formElement
, "Reference",
78 entity
!= null ? entity
.getReference() : null,
79 EntitySelectionElement
.ALL
, SWT
.NULL
);
80 text_microReference
= formFactory
.createTextWithLabelElement(
81 formElement
, "Reference Detail",
82 entity
!= null ? entity
.getMicroReference() : null, SWT
.NULL
);
89 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
94 public void handleEvent(Object eventSource
) {
95 if (eventSource
== text_treeLabel
) {
96 LanguageString languageString
= LanguageString
.NewInstance(
97 text_treeLabel
.getText(), CdmStore
.getDefaultLanguage());
98 getEntity().setName(languageString
);
99 } else if (eventSource
== selection_reference
) {
100 getEntity().setReference(selection_reference
.getEntity());
101 } else if (eventSource
== text_microReference
) {
102 getEntity().setMicroReference(text_microReference
.getText());