3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
;
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
.campanula
.compatibility
.ICdmFormElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.CheckboxElement
;
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
;
31 public class AmplificationGeneralDetailElement
extends AbstractCdmDetailElement
<Amplification
> {
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
;
40 private NumberWithLabelElement numberGelVoltage
;
41 private NumberWithLabelElement numberGelConcentration
;
42 private NumberWithLabelElement numberGelRunningTime
;
43 private TextWithLabelElement textLadderUsed
;
44 private TextWithLabelElement textGelPhoto
;
46 private TermComboElement
<DefinedTerm
> comboPurificationMaterialOrMethod
;
53 public AmplificationGeneralDetailElement(CdmFormFactory formFactory
, ICdmFormElement formElement
) {
54 super(formFactory
, formElement
);
61 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
62 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
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
);
85 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
89 public void handleEvent(Object eventSource
) {
90 if(eventSource
==comboMarker
){
91 getEntity().setDnaMarker(comboMarker
.getSelection());
93 else if(eventSource
==dateAmplification
){
94 getEntity().setTimeperiod(dateAmplification
.getTimePeriod());
96 else if(eventSource
==selectionAmplificationStaff
){
97 getEntity().setActor(selectionAmplificationStaff
.getEntity());
99 else if(eventSource
==checkBoxAmplificationSuccess
){
100 getEntity().setSuccessful(checkBoxAmplificationSuccess
.getSelection());
102 else if(eventSource
==textAmplificationSuccessDetails
){
103 getEntity().setSuccessText(textAmplificationSuccessDetails
.getText());
105 else if(eventSource
==comboAmplificationMaterialOrMethod
){
108 else if(eventSource
==numberGelVoltage
){
109 getEntity().setElectrophoresisVoltage(numberGelVoltage
.getDouble());
111 else if(eventSource
==numberGelConcentration
){
112 getEntity().setGelConcentration(numberGelConcentration
.getDouble());
114 else if(eventSource
==numberGelRunningTime
){
115 getEntity().setGelRunningTime(numberGelRunningTime
.getDouble());
117 else if(eventSource
==textLadderUsed
){
118 getEntity().setLadderUsed(textLadderUsed
.getText());
120 else if(eventSource
==textGelPhoto
){
123 else if(eventSource
==comboPurificationMaterialOrMethod
){
124 MaterialOrMethodEvent purification
= getEntity().getPurification();
125 if(purification
==null){
126 purification
= MaterialOrMethodEvent
.NewInstance();
127 getEntity().setPurification(purification
);
129 purification
.setDefinedMaterialOrMethod(comboPurificationMaterialOrMethod
.getSelection());