Project

General

Profile

Download (2.09 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2020 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.supplemental;
10

    
11
import eu.etaxonomy.cdm.model.common.SingleSourcedEntityBase;
12
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
13
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
14
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
15
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
16
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
17
import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceElement;
18

    
19
/**
20
 * @author k.luther
21
 * @since Aug 18, 2020
22
 */
23
public abstract class AbstractSingleSourceElement <T extends SingleSourcedEntityBase>
24
            extends AbstractCdmDetailElement<T> implements ISelectableElement{
25

    
26
    protected OriginalSourceElement singleSourceSection;
27

    
28
    /**
29
     * @param formFactory
30
     * @param section
31
     * @param entity
32
     * @param removeListener
33
     * @param backgroundColor
34
     * @param style
35
     */
36
    public AbstractSingleSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
37
        super(formFactory, formElement);
38
//        setEntity(entity);
39
//        super(formFactory,formElement, entity, removeListener, null, style);
40
//        // TODO Auto-generated constructor stub
41
    }
42

    
43

    
44

    
45
//    @Override
46
//    public void setEntity(T entity) {
47
//        this.entity = entity;
48
//
49
//    }
50

    
51
    @Override
52
    public void createControls(ICdmFormElement formElement, T entity, int style) {
53
        singleSourceSection = formFactory.createOriginalSourceElement(formElement, entity);
54
        if (entity.getSource() == null){
55
            DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
56
            entity.setSource(source);
57
            singleSourceSection.setEntity(source);
58
        }else{
59
            singleSourceSection.setEntity(entity.getSource());
60

    
61
        }
62
    }
63

    
64

    
65
}
(3-3/22)