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
.ICdmFormElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.LayoutConstants
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.TimePeriodElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
25 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeoScopeDetailSection
;
26 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
30 * ClassificationDetailElement class.
34 * @created Sep 27, 2010
37 public class ClassificationDetailElement
extends
38 AbstractCdmDetailElement
<Classification
> {
40 private TextWithLabelElement text_treeLabel
;
42 private EntitySelectionElement
<Reference
> selection_reference
;
44 private TextWithLabelElement text_microReference
;
46 private TimePeriodElement element_date
;
48 private GeoScopeDetailSection section_collectingAreas
;
55 * Constructor for ClassificationDetailElement.
59 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
62 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
65 public ClassificationDetailElement(CdmFormFactory formFactory
,
66 ICdmFormElement formElement
) {
67 super(formFactory
, formElement
);
74 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
75 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
76 * eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
80 protected void createControls(ICdmFormElement formElement
,
81 Classification entity
, int style
) {
82 text_treeLabel
= formFactory
.createTextWithLabelElement(formElement
, "Label", entity
!= null ? entity
.getTitleCache() : null, SWT
.NULL
);
83 selection_reference
= formFactory
.createSelectionElement(Reference
.class, getConversationHolder(), formElement
, "Reference",
84 entity
!= null ? entity
.getReference() : null, EntitySelectionElement
.ALL
, SWT
.NULL
);
85 text_microReference
= formFactory
.createTextWithLabelElement(formElement
, "Reference Detail",
86 entity
!= null ? entity
.getMicroReference() : null, SWT
.NULL
);
87 element_date
= formFactory
.createTimePeriodElement(formElement
, "Date",
88 entity
.getTimeperiod(), style
);
89 section_collectingAreas
= formFactory
.createGeoScopeDetailSection(getConversationHolder(), formElement
, SWT
.NULL
);
90 section_collectingAreas
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
91 section_collectingAreas
.setEntity(entity
);
99 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
104 public void handleEvent(Object eventSource
) {
105 if (eventSource
== text_treeLabel
) {
106 LanguageString languageString
= LanguageString
.NewInstance(
107 text_treeLabel
.getText(), CdmStore
.getDefaultLanguage());
108 getEntity().setName(languageString
);
109 } else if (eventSource
== selection_reference
) {
110 getEntity().setReference(selection_reference
.getEntity());
111 } else if (eventSource
== text_microReference
) {
112 getEntity().setMicroReference(text_microReference
.getText());
113 }else if (eventSource
== element_date
) {
114 getEntity().setTimeperiod(element_date
.getTimePeriod());