Project

General

Profile

Download (3.31 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2014 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 eu.etaxonomy.cdm.model.agent.AgentBase;
12
import eu.etaxonomy.cdm.model.term.DefinedTerm;
13
import eu.etaxonomy.cdm.model.term.TermType;
14
import eu.etaxonomy.cdm.model.molecular.AmplificationResult;
15
import eu.etaxonomy.cdm.model.molecular.Cloning;
16
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
20
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
22
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
23

    
24
/**
25
 * @author pplitzner
26
 * @date 15.01.2014
27
 */
28
public class AmplificationCloningDetailElement extends AbstractCdmDetailElement<AmplificationResult> {
29
    
30
	private TextWithLabelElement textCloningStrain;
31
    private TimePeriodElement date;
32
    private EntitySelectionElement<AgentBase> selectionCloningStaff;
33
    private TermComboElement<DefinedTerm> comboCloningMaterialOrMethod;
34

    
35
    public AmplificationCloningDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
36
        super(formFactory, formElement);
37
    }
38

    
39
    @Override
40
    protected void createControls(ICdmFormElement formElement, AmplificationResult entity, int style) {
41
        Cloning cloning = entity.getCloning();
42
        textCloningStrain = formFactory.createTextWithLabelElement(formElement, "Cloning Strain", cloning==null?"":cloning.getStrain(), style);
43
        date = formFactory.createTimePeriodElement(formElement, "Cloning Date", cloning==null?null:cloning.getTimeperiod(), style);
44
        selectionCloningStaff = formFactory.createSelectionElement(AgentBase.class,
45
                formElement, "Cloning Staff", cloning==null?null:cloning.getActor(), EntitySelectionElement.ALL, style);
46
        comboCloningMaterialOrMethod = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Cloning Mat. & Meth.", cloning==null?null:cloning.getDefinedMaterialOrMethod(), style);
47
    }
48

    
49
    @Override
50
    public void handleEvent(Object eventSource) {
51
        if(eventSource==textCloningStrain || eventSource==date|| eventSource==selectionCloningStaff || eventSource==comboCloningMaterialOrMethod){
52
            Cloning cloning = getEntity().getCloning();
53
            if(cloning==null){
54
                cloning = Cloning.NewInstance();
55
                getEntity().setCloning(cloning);
56
            }
57
            if(eventSource==textCloningStrain){
58
                cloning.setStrain(textCloningStrain.getText());
59
            }
60
            else if(eventSource==date){
61
                cloning.setTimeperiod(date.getTimePeriod());
62
            }
63
            else if(eventSource==selectionCloningStaff){
64
                cloning.setActor(selectionCloningStaff.getSelection());
65
            }
66
            else if(eventSource==comboCloningMaterialOrMethod){
67
                cloning.setDefinedMaterialOrMethod(comboCloningMaterialOrMethod.getSelection());
68
            }
69
        }
70
    }
71
}
(3-3/32)