1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.ui.section.description;
|
11
|
|
12
|
import org.eclipse.swt.SWT;
|
13
|
|
14
|
import eu.etaxonomy.cdm.model.description.DescriptionBase;
|
15
|
import eu.etaxonomy.cdm.model.description.FeatureTree;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
21
|
|
22
|
/**
|
23
|
* <p>DescriptionDetailElement class.</p>
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created Mar 5, 2010
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class DescriptionDetailElement extends AbstractCdmDetailElement<DescriptionBase> {
|
30
|
|
31
|
private TextWithLabelElement detailDescription;
|
32
|
private EntitySelectionElement<FeatureTree> selection_featureTree;
|
33
|
|
34
|
/**
|
35
|
* <p>Constructor for DescriptionDetailElement.</p>
|
36
|
*
|
37
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
38
|
* @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
39
|
* @param style a int.
|
40
|
*/
|
41
|
public DescriptionDetailElement(CdmFormFactory cdmFormFactory,
|
42
|
ICdmFormElement formElement, int style) {
|
43
|
super(cdmFormFactory, formElement);
|
44
|
}
|
45
|
|
46
|
/** {@inheritDoc} */
|
47
|
@Override
|
48
|
protected void createControls(ICdmFormElement formElement, DescriptionBase entity, int style) {
|
49
|
detailDescription = formFactory.createMultiLineTextWithLabel(this, "Label", 50, SWT.WRAP);
|
50
|
detailDescription.setText(entity.getTitleCache());
|
51
|
|
52
|
// TODO I initially thought that we can handle the entity's descriptive system with a feature tree
|
53
|
// Since descriptiveSystem is a Set of Features that are present or allowed for the current description,
|
54
|
// it is similar to a FeatureTree (you can get this information from a feature tree) but not the same.
|
55
|
// Please correct this once it is clear what descriptive system will be used for in CDM
|
56
|
// selection_featureTree = formFactory.createSelectionElement(FeatureTree.class, getConversationHolder(), formElement, "Feature Tree", null, EntitySelectionElement.ALL, style);
|
57
|
}
|
58
|
|
59
|
/** {@inheritDoc} */
|
60
|
@Override
|
61
|
public void handleEvent(Object eventSource) {
|
62
|
if(eventSource == detailDescription){
|
63
|
getEntity().setTitleCache(detailDescription.getText(), true);
|
64
|
}
|
65
|
else if(eventSource == selection_featureTree){
|
66
|
FeatureTree featureTree = selection_featureTree.getSelection();
|
67
|
//descriptive system is not available anymore since v3.3
|
68
|
// getEntity().setDescriptiveSystem(featureTree.getDistinctFeatures());
|
69
|
}
|
70
|
}
|
71
|
}
|