Implemented correct handling of images for specimen. Still needs fine tuning.
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / section / description / DescriptionDetailElement.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10
11 package eu.etaxonomy.taxeditor.section.description;
12
13 import org.eclipse.swt.SWT;
14
15 import eu.etaxonomy.cdm.model.description.DescriptionBase;
16 import eu.etaxonomy.cdm.model.description.FeatureTree;
17 import eu.etaxonomy.taxeditor.forms.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.forms.CdmFormFactory.SelectionType;
19 import eu.etaxonomy.taxeditor.forms.ICdmFormElement;
20 import eu.etaxonomy.taxeditor.forms.TextWithLabelElement;
21 import eu.etaxonomy.taxeditor.forms.selection.FeatureTreeSelectionElement;
22 import eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement;
23
24 /**
25 * <p>DescriptionDetailElement class.</p>
26 *
27 * @author n.hoffmann
28 * @created Mar 5, 2010
29 * @version 1.0
30 */
31 public class DescriptionDetailElement extends AbstractCdmDetailElement<DescriptionBase> {
32
33 private TextWithLabelElement detailDescription;
34 private FeatureTreeSelectionElement selection_featureTree;
35
36 /**
37 * <p>Constructor for DescriptionDetailElement.</p>
38 *
39 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object.
40 * @param formElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
41 * @param style a int.
42 */
43 public DescriptionDetailElement(CdmFormFactory cdmFormFactory,
44 ICdmFormElement formElement, int style) {
45 super(cdmFormFactory, formElement);
46 }
47
48 /** {@inheritDoc} */
49 @Override
50 protected void createControls(ICdmFormElement formElement, DescriptionBase entity, int style) {
51 detailDescription = formFactory.createMultilineTextWithLabel(this, "Label", 50, SWT.WRAP);
52 detailDescription.setText(entity.getTitleCache());
53
54 // selection_featureTree = (FeatureTreeSelectionElement) formFactory.createSelectionElement(SelectionType.FEATURE_TREE, getConversationHolder(), formElement, "Feature Tree", null, style);
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 public void handleEvent(Object eventSource) {
60 if(eventSource == detailDescription){
61 getEntity().setTitleCache(detailDescription.getText(), true);
62 }
63 else if(eventSource == selection_featureTree){
64 FeatureTree featureTree = selection_featureTree.getSelection();
65 getEntity().setDescriptiveSystem(featureTree.getDistinctFeatures());
66 }
67 }
68 }