3 * Copyright (C) 2014 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
.molecular
.Cloning
;
16 import eu
.etaxonomy
.taxeditor
.ui
.combo
.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
;
29 public class AmplificationCloningDetailElement
extends AbstractCdmDetailElement
<Amplification
> {
30 private TextWithLabelElement textCloningStrain
;
31 private TimePeriodElement date
;
32 private EntitySelectionElement
<AgentBase
> selectionCloningStaff
;
33 private TermComboElement
<DefinedTerm
> comboCloningMaterialOrMethod
;
40 public AmplificationCloningDetailElement(CdmFormFactory formFactory
, ICdmFormElement formElement
) {
41 super(formFactory
, formElement
);
48 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
49 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
52 protected void createControls(ICdmFormElement formElement
, Amplification entity
, int style
) {
53 Cloning cloning
= entity
.getCloning();
54 textCloningStrain
= formFactory
.createTextWithLabelElement(formElement
, "Cloning Strain", cloning
==null?
"":cloning
.getStrain(), style
);
55 date
= formFactory
.createTimePeriodElement(formElement
, "Cloning Date", cloning
==null?
null:cloning
.getTimeperiod(), style
);
56 selectionCloningStaff
= formFactory
.createSelectionElement(AgentBase
.class, getConversationHolder(), formElement
, "Cloning Staff", cloning
==null?
null:cloning
.getActor(), EntitySelectionElement
.ALL
, style
);
57 comboCloningMaterialOrMethod
= formFactory
.createTermComboElement(DefinedTerm
.class, formElement
, "Cloning Mat. & Meth.", cloning
==null?
null:cloning
.getDefinedMaterialOrMethod(), style
);
64 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
68 public void handleEvent(Object eventSource
) {
69 if(eventSource
==textCloningStrain
|| eventSource
==date
|| eventSource
==selectionCloningStaff
|| eventSource
==comboCloningMaterialOrMethod
){
70 Cloning cloning
= getEntity().getCloning();
72 cloning
= Cloning
.NewInstance();
73 getEntity().setCloning(cloning
);
75 if(eventSource
==textCloningStrain
){
76 cloning
.setStrain(textCloningStrain
.getText());
78 else if(eventSource
==date
){
79 cloning
.setTimeperiod(date
.getTimePeriod());
81 else if(eventSource
==selectionCloningStaff
){
82 cloning
.setActor(selectionCloningStaff
.getSelection());
84 else if(eventSource
==comboCloningMaterialOrMethod
){
85 cloning
.setDefinedMaterialOrMethod(comboCloningMaterialOrMethod
.getSelection());