Project

General

Profile

Download (6.05 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2013 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
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
11

    
12
import eu.etaxonomy.cdm.model.agent.AgentBase;
13
import eu.etaxonomy.cdm.model.common.DefinedTerm;
14
import eu.etaxonomy.cdm.model.molecular.Amplification;
15
import eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent;
16
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
21
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
22
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
23
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
24
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
25

    
26
/**
27
 * @author pplitzner
28
 * @date 19.12.2013
29
 *
30
 */
31
public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<Amplification> {
32

    
33
    private TermComboElement<DefinedTerm> comboMarker;
34
    private TimePeriodElement dateAmplification;
35
    private EntitySelectionElement<AgentBase> selectionAmplificationStaff;
36
    private CheckboxElement checkBoxAmplificationSuccess;
37
    private TextWithLabelElement textAmplificationSuccessDetails;
38
    private TermComboElement<DefinedTerm> comboAmplificationMaterialOrMethod;
39

    
40
    private NumberWithLabelElement numberGelVoltage;
41
    private NumberWithLabelElement numberGelConcentration;
42
    private NumberWithLabelElement numberGelRunningTime;
43
    private TextWithLabelElement textLadderUsed;
44

    
45
    private TermComboElement<DefinedTerm> comboPurificationMaterialOrMethod;
46

    
47

    
48
    /**
49
     * @param formFactory
50
     * @param formElement
51
     */
52
    public AmplificationGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
53
        super(formFactory, formElement);
54
    }
55

    
56
    /*
57
     * (non-Javadoc)
58
     *
59
     * @see
60
     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
61
     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
62
     */
63
    @Override
64
    protected void createControls(ICdmFormElement formElement, Amplification entity, int style) {
65
        comboMarker = formFactory.createTermComboElement(DefinedTerm.class, formElement, "Marker", entity.getDnaMarker(), style);
66
        dateAmplification = formFactory.createTimePeriodElement(formElement, "Amplification Date", entity.getTimeperiod(), style);
67
        selectionAmplificationStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Amplification staff", entity.getActor(), EntitySelectionElement.ALL, style);
68
        checkBoxAmplificationSuccess = formFactory.createCheckbox(formElement, "Amplification Success", entity.getSuccessful(), style);
69
        textAmplificationSuccessDetails = formFactory.createTextWithLabelElement(formElement, "Ampl. Success Details", entity.getSuccessText(), style);
70
//        comboAmplificationMaterialOrMethod = formFactory.createTermComboElement(DefinedTerm.class, formElement, "Ampl. Mat. & Meth.", entity.get, style)
71
        numberGelVoltage = formFactory.createNumberTextWithLabelElement(formElement, "Gel Voltage (V)", entity.getElectrophoresisVoltage(), style);
72
        numberGelConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Gel Concentration", entity.getGelConcentration(), style);
73
        numberGelRunningTime = formFactory.createNumberTextWithLabelElement(formElement, "Gel Ruinning Time (Min)", entity.getGelRunningTime(), style);
74
        textLadderUsed = formFactory.createTextWithLabelElement(formElement, "Ladder Used", entity.getLadderUsed(), style);
75
        comboPurificationMaterialOrMethod = formFactory.createTermComboElement(DefinedTerm.class, formElement, "Purification Mat. & Meth.",
76
                entity.getPurification()==null?null:entity.getPurification().getDefinedMaterialOrMethod(), style);
77
    }
78

    
79
    /*
80
     * (non-Javadoc)
81
     *
82
     * @see
83
     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
84
     * .lang.Object)
85
     */
86
    @Override
87
    public void handleEvent(Object eventSource) {
88
        if(eventSource==comboMarker){
89
            getEntity().setDnaMarker(comboMarker.getSelection());
90
        }
91
        else if(eventSource==dateAmplification){
92
            getEntity().setTimeperiod(dateAmplification.getTimePeriod());
93
        }
94
        else if(eventSource==selectionAmplificationStaff){
95
            getEntity().setActor(selectionAmplificationStaff.getEntity());
96
        }
97
        else if(eventSource==checkBoxAmplificationSuccess){
98
            getEntity().setSuccessful(checkBoxAmplificationSuccess.getSelection());
99
        }
100
        else if(eventSource==textAmplificationSuccessDetails){
101
            getEntity().setSuccessText(textAmplificationSuccessDetails.getText());
102
        }
103
        else if(eventSource==comboAmplificationMaterialOrMethod){
104

    
105
        }
106
        else if(eventSource==numberGelVoltage){
107
            getEntity().setElectrophoresisVoltage(numberGelVoltage.getDouble());
108
        }
109
        else if(eventSource==numberGelConcentration){
110
            getEntity().setGelConcentration(numberGelConcentration.getDouble());
111
        }
112
        else if(eventSource==numberGelRunningTime){
113
            getEntity().setGelRunningTime(numberGelRunningTime.getDouble());
114
        }
115
        else if(eventSource==textLadderUsed){
116
            getEntity().setLadderUsed(textLadderUsed.getText());
117
        }
118
        else if(eventSource==comboPurificationMaterialOrMethod){
119
            MaterialOrMethodEvent purification = getEntity().getPurification();
120
            if(purification==null){
121
                purification = MaterialOrMethodEvent.NewInstance();
122
                getEntity().setPurification(purification);
123
            }
124
            purification.setDefinedMaterialOrMethod(comboPurificationMaterialOrMethod.getSelection());
125
        }
126
    }
127
}
(5-5/20)