Project

General

Profile

« Previous | Next » 

Revision 52002c73

Added by Cherian Mathew over 9 years ago

merge from trunk

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSampleGeneralDetailElement.java
18 18
import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
19 19
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
20 20
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
21
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
21 22
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
22 23
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
23 24
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
......
34 35

  
35 36
    private EntitySelectionElement<Institution> selectionInstitution;
36 37
    private EntitySelectionElement<AgentBase> selectionStaff;
37
    private TimePeriodElement datePreservationDate;
38
    private TimePeriodElement datePreparationDate;
38 39
    private NumberWithLabelElement numberPreservationTemperature;
39 40
    private TermComboElement<DefinedTerm> comboMaterialOrMethods;
40 41
    private TextWithLabelElement textBarcode;
42
    private CheckboxElement checkIsPublish;
41 43

  
42 44
    /**
43 45
     * @param formFactory
......
60 62
        AgentBase<?> staff = null;
61 63
        TimePeriod preparationDate = null;
62 64
        if(entity.getDerivedFrom()!=null){
63
//            institution = entity.getDerivedFrom().getInstitution();
65
            institution = entity.getDerivedFrom().getInstitution();
64 66
            staff = entity.getDerivedFrom().getActor();
65 67
            preparationDate = entity.getDerivedFrom().getTimeperiod();
66 68
        }
......
71 73
            temperature = entity.getPreservation().getTemperature();
72 74
            definedMaterialOrMethod = entity.getPreservation().getDefinedMaterialOrMethod();
73 75
        }
74
        //TODO institution
75
//        selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", staff, EntitySelectionElement.ALL, style);
76
        selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", institution, EntitySelectionElement.ALL, style);
76 77
        selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL, style);
77
        datePreservationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
78
        datePreparationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
78 79
        numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
79 80
        comboMaterialOrMethods = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Materials & Methods", definedMaterialOrMethod, style);
80 81
        textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
82
        checkIsPublish = formFactory.createCheckbox(formElement, "Publish", entity.isPublish(), style);
81 83

  
82 84
    }
83 85

  
......
90 92
     */
91 93
    @Override
92 94
    public void handleEvent(Object eventSource) {
93
        if(eventSource==datePreservationDate){
94
            addPreservationMethod().setTimeperiod(datePreservationDate.getTimePeriod());
95
        if(eventSource==datePreparationDate){
96
            if(getEntity().getDerivedFrom()!=null){
97
                getEntity().getDerivedFrom().setTimeperiod(datePreparationDate.getTimePeriod());
98
            }
99
        }
100
        else if(eventSource==selectionInstitution){
101
            if(getEntity().getDerivedFrom()!=null){
102
                getEntity().getDerivedFrom().setInstitution(selectionInstitution.getSelection());
103
            }
95 104
        }
96 105
        else if(eventSource==selectionStaff){
97
            addPreservationMethod().setActor(selectionStaff.getSelection());
106
            if(getEntity().getDerivedFrom()!=null){
107
                getEntity().getDerivedFrom().setActor(selectionStaff.getSelection());
108
            }
98 109
        }
99 110
        else if(eventSource==numberPreservationTemperature){
100 111
            addPreservationMethod().setTemperature(numberPreservationTemperature.getDouble());
......
105 116
        else if(eventSource==textBarcode){
106 117
            getEntity().setBarcode(textBarcode.getText());
107 118
        }
119
        else if(eventSource==checkIsPublish){
120
            getEntity().setPublish(checkIsPublish.getSelection());
121
        }
108 122
    }
109 123

  
110 124
    private PreservationMethod addPreservationMethod(){

Also available in: Unified diff