Project

General

Profile

Download (1.93 KB) Statistics
| Branch: | Tag: | Revision:
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
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
10

    
11
import org.eclipse.swt.events.SelectionListener;
12
import org.eclipse.swt.graphics.Color;
13

    
14
import eu.etaxonomy.cdm.model.common.Identifier;
15
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
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.AbstractEntityCollectionElement;
20

    
21
/**
22
 * @author pplitzner
23
 * @date Oct 16, 2014
24
 */
25
public class SampleDesignationTextDetailElement
26
        extends AbstractEntityCollectionElement<Identifier> {
27

    
28
    protected TextWithLabelElement text_description;
29

    
30
    public SampleDesignationTextDetailElement(CdmFormFactory formFactory, AbstractFormSection<?> section,
31
            Identifier entity, SelectionListener removeListener, Color backgroundColor, int style) {
32
        super(formFactory, section, entity, removeListener, backgroundColor, style);
33
    }
34

    
35
	@Override
36
	public void createControls(ICdmFormElement element, int style) {
37
		text_description = formFactory.createTextWithLabelElement(element,
38
				"Sample Designation", null, style);
39
	}
40

    
41
    @Override
42
    public void handleEvent(Object eventSource) {
43
        if(eventSource==text_description){
44
            String identifier = null;
45
            if(!text_description.getText().isEmpty()){
46
                identifier = text_description.getText();
47
            }
48
            this.entity.setIdentifier(identifier);
49
        }
50
    }
51

    
52
    @Override
53
    public void setEntity(Identifier entity) {
54
        this.entity = entity;
55
        text_description.setText(entity.getIdentifier());
56
    }
57
}
(22-22/32)