Project

General

Profile

Download (6.28 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
    private TextWithLabelElement textGelPhoto;
45

    
46
    private TermComboElement<DefinedTerm> comboPurificationMaterialOrMethod;
47

    
48

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

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

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

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