1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2014 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.common.TermType;
|
15
|
import eu.etaxonomy.cdm.model.molecular.AmplificationResult;
|
16
|
import eu.etaxonomy.cdm.model.molecular.Cloning;
|
17
|
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
24
|
|
25
|
/**
|
26
|
* @author pplitzner
|
27
|
* @date 15.01.2014
|
28
|
*
|
29
|
*/
|
30
|
public class AmplificationCloningDetailElement extends AbstractCdmDetailElement<AmplificationResult> {
|
31
|
private TextWithLabelElement textCloningStrain;
|
32
|
private TimePeriodElement date;
|
33
|
private EntitySelectionElement<AgentBase> selectionCloningStaff;
|
34
|
private TermComboElement<DefinedTerm> comboCloningMaterialOrMethod;
|
35
|
|
36
|
|
37
|
/**
|
38
|
* @param formFactory
|
39
|
* @param formElement
|
40
|
*/
|
41
|
public AmplificationCloningDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
|
42
|
super(formFactory, formElement);
|
43
|
}
|
44
|
|
45
|
/*
|
46
|
* (non-Javadoc)
|
47
|
*
|
48
|
* @see
|
49
|
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
|
50
|
* (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
|
51
|
*/
|
52
|
@Override
|
53
|
protected void createControls(ICdmFormElement formElement, AmplificationResult entity, int style) {
|
54
|
Cloning cloning = entity.getCloning();
|
55
|
textCloningStrain = formFactory.createTextWithLabelElement(formElement, "Cloning Strain", cloning==null?"":cloning.getStrain(), style);
|
56
|
date = formFactory.createTimePeriodElement(formElement, "Cloning Date", cloning==null?null:cloning.getTimeperiod(), style);
|
57
|
selectionCloningStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Cloning Staff", cloning==null?null:cloning.getActor(), EntitySelectionElement.ALL, style);
|
58
|
comboCloningMaterialOrMethod = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Cloning Mat. & Meth.", cloning==null?null:cloning.getDefinedMaterialOrMethod(), style);
|
59
|
}
|
60
|
|
61
|
/*
|
62
|
* (non-Javadoc)
|
63
|
*
|
64
|
* @see
|
65
|
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
|
66
|
* .lang.Object)
|
67
|
*/
|
68
|
@Override
|
69
|
public void handleEvent(Object eventSource) {
|
70
|
if(eventSource==textCloningStrain || eventSource==date|| eventSource==selectionCloningStaff || eventSource==comboCloningMaterialOrMethod){
|
71
|
Cloning cloning = getEntity().getCloning();
|
72
|
if(cloning==null){
|
73
|
cloning = Cloning.NewInstance();
|
74
|
getEntity().setCloning(cloning);
|
75
|
}
|
76
|
if(eventSource==textCloningStrain){
|
77
|
cloning.setStrain(textCloningStrain.getText());
|
78
|
}
|
79
|
else if(eventSource==date){
|
80
|
cloning.setTimeperiod(date.getTimePeriod());
|
81
|
}
|
82
|
else if(eventSource==selectionCloningStaff){
|
83
|
cloning.setActor(selectionCloningStaff.getSelection());
|
84
|
}
|
85
|
else if(eventSource==comboCloningMaterialOrMethod){
|
86
|
cloning.setDefinedMaterialOrMethod(comboCloningMaterialOrMethod.getSelection());
|
87
|
}
|
88
|
}
|
89
|
}
|
90
|
|
91
|
}
|