Project

General

Profile

Download (3.77 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.campanula.detailViews.fieldObservation;
11

    
12
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
13
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NumberFieldController;
14
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
15
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
18

    
19
/**
20
 * @author pplitzner
21
 * @date 15.08.2013
22
 *
23
 */
24
public class FieldObservationDetailsElementController extends AbstractCdmDetailElement<DerivedUnitFacade> {
25

    
26
    private FieldObservationDetailsElement fieldObservationDetailsElement;
27

    
28
    private TextFieldController text_ecology;
29

    
30
    private TextFieldController text_plantDescription;
31

    
32
    private TextFieldController text_fieldObjectDefinition;
33

    
34
    private TextFieldController text_fieldNotes;
35

    
36
    private NumberFieldController number_individualCount;
37

    
38
    /**
39
     * <p>
40
     * Constructor for FieldObservationDetailElement.
41
     * </p>
42
     *
43
     * @param formFactory
44
     *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
45
     *            object.
46
     * @param formElement
47
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
48
     *            object.
49
     */
50
    public FieldObservationDetailsElementController(FieldObservationDetailsElement fieldObservationDetailsElement, CdmFormFactory formFactory, ICdmFormElement formElement) {
51
        super(formFactory, formElement);
52
        this.fieldObservationDetailsElement = fieldObservationDetailsElement;
53
    }
54

    
55
    /** {@inheritDoc} */
56
    @Override
57
    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
58
//        text_ecology = new TextFieldController(fieldObservationDetailsElement.getText_ecology(), getFormFactory(), formElement, entity.getEcology(CdmStore.getDefaultLanguage()), null);
59
//        text_plantDescription = new TextFieldController(fieldObservationDetailsElement.getText_plantDescription(), getFormFactory(), formElement, entity.getPlantDescription(CdmStore.getDefaultLanguage()), style);
60
        // Disable for now
61
        // text_fieldObjectDefinition = formFactory.createTextWithLabelElement(formElement, "Field Object Definition", entity.getFieldObjectDefinition(CdmStore.getDefaultLanguage()), style);
62
        text_fieldNotes = new TextFieldController(fieldObservationDetailsElement.getText_FieldNotes(), getFormFactory(), formElement, entity.getFieldNotes(), style);
63

    
64
        number_individualCount = new NumberFieldController(fieldObservationDetailsElement.getText_IndividualCount(), getFormFactory(), formElement, entity.getIndividualCount());
65
    }
66

    
67
    /** {@inheritDoc} */
68
    @Override
69
    public void handleEvent(Object eventSource) {
70
//        if (eventSource == text_ecology) {
71
//            getEntity().setEcology(text_ecology.getText());
72
//        } else if (eventSource == text_plantDescription) {
73
//            getEntity().setPlantDescription(text_plantDescription.getText());
74
//        } else if (eventSource == text_fieldObjectDefinition) {
75
//            getEntity().addFieldObjectDefinition(text_fieldObjectDefinition.getText(), CdmStore.getDefaultLanguage());
76
//        } else
77
            if (eventSource == text_fieldNotes) {
78
            getEntity().setFieldNotes(text_fieldNotes.getText());
79
        } else if (eventSource == number_individualCount) {
80
            getEntity().setIndividualCount(number_individualCount.getInteger());
81
        }
82
    }
83
}
(2-2/10)