Project

General

Profile

Revision d72a0740

IDd72a074053ed0c504a810fdebf92c03772c5b8d4
Parent e9533fc3
Child b43e3e03

Added by Katja Luther about 3 years ago

ref #6721: add life form, sex and kind of unit to derived unit details

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/AbstractSpecimenOrObservationDetailElement.java
1
package eu.etaxonomy.taxeditor.ui.section.occurrence;
2

  
3
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
4
import eu.etaxonomy.cdm.model.common.DefinedTerm;
5
import eu.etaxonomy.cdm.model.common.TermType;
6
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
7
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
8
import eu.etaxonomy.taxeditor.store.CdmStore;
9
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
10
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
11
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
12
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
13

  
14
public abstract class AbstractSpecimenOrObservationDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
15
	
16
	private TermComboElement<DefinedTerm> combo_kindOfUnit;
17

  
18
	private TermComboElement<DefinedTerm> combo_lifeStage;
19

  
20
	private TermComboElement<DefinedTerm> combo_sex;
21

  
22
	public AbstractSpecimenOrObservationDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
23
		super(formFactory, formElement);
24
		// TODO Auto-generated constructor stub
25
	}
26

  
27
	/** {@inheritDoc} */
28
	@Override
29
	protected void createControls(ICdmFormElement formElement,
30
			DerivedUnitFacade entity, int style) {
31
		
32
		combo_kindOfUnit= formFactory.createDefinedTermComboElement(TermType.KindOfUnit, formElement, "Kind Of Unit", entity.getKindOfUnit(), style);
33
		combo_lifeStage = formFactory.createDefinedTermComboElement(TermType.Stage, formElement, "Life Stage", entity.getLifeStage(), style);
34
		combo_sex = formFactory.createDefinedTermComboElement(TermType.Sex, formElement, "Sex", entity.getSex(),style);
35
	}
36
	
37
	/** {@inheritDoc} */
38
	@Override
39
	public void handleEvent(Object eventSource) {
40
		if(eventSource == combo_kindOfUnit){
41
		    getEntity().setKindOfUnit(combo_kindOfUnit.getSelection());
42
		}
43
		else if(eventSource == combo_lifeStage){
44
			getEntity().setLifeStage(combo_lifeStage.getSelection());
45
		}
46
		else if(eventSource == combo_sex){
47
			getEntity().setSex(combo_sex.getSelection());
48
		}
49
	}
50

  
51
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java
38 38
 * @version 1.0
39 39
 */
40 40
public class DerivedUnitBaseDetailElement extends
41
		AbstractCdmDetailElement<DerivedUnitFacade> {
41
		AbstractSpecimenOrObservationDetailElement {
42 42

  
43 43
	private TextWithLabelElement text_derivedUnitDefinitions;
44 44

  
......
57 57
	private SourceCollectionDetailSection section_source;
58 58

  
59 59
    private OriginalLabelDataElement textOriginalLabel;
60
    
61

  
60 62

  
61 63
	/**
62 64
	 * <p>
......
114 116

  
115 117
		textOriginalLabel = formFactory.createOriginalLabelDataElement(formElement);
116 118
		textOriginalLabel.setEntity(getEntity());
119
		
120
		super.createControls(formElement, entity, style);
117 121

  
118 122
        section_source = formFactory.createSourceCollectionDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
119 123
		section_source.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
......
124 128
    /** {@inheritDoc} */
125 129
    @Override
126 130
    public void handleEvent(Object eventSource) {
131
    	super.handleEvent(eventSource);
127 132
        if (eventSource == text_derivedUnitDefinitions) {
128 133
            getEntity().addDerivedUnitDefinition(text_derivedUnitDefinitions.getText(), CdmStore.getDefaultLanguage());
129 134
        } else if (eventSource == text_barcode) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitDetailElement.java
29 29
 * @created Jun 17, 2010
30 30
 * @version 1.0
31 31
 */
32
public class FieldUnitDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
32
public class FieldUnitDetailElement extends AbstractSpecimenOrObservationDetailElement {
33 33

  
34 34
	private TextWithLabelElement text_ecology;
35 35

  
......
43 43

  
44 44
	private NumberWithLabelElement number_individualCount;
45 45

  
46
	private TermComboElement<DefinedTerm> combo_kindOfUnit;
47

  
48
	private TermComboElement<DefinedTerm> combo_lifeStage;
49

  
50
	private TermComboElement<DefinedTerm> combo_sex;
46
//	private TermComboElement<DefinedTerm> combo_kindOfUnit;
47
//
48
//	private TermComboElement<DefinedTerm> combo_lifeStage;
49
//
50
//	private TermComboElement<DefinedTerm> combo_sex;
51 51

  
52 52
	/**
53 53
	 * <p>Constructor for FieldUnitDetailElement.</p>
......
74 74
		}
75 75
		
76 76
		number_individualCount = formFactory.createNumberTextWithLabelElement(formElement, "Individual Count", entity.getIndividualCount(), style);
77
		combo_kindOfUnit= formFactory.createDefinedTermComboElement(TermType.KindOfUnit, formElement, "Kind Of Unit", entity.getKindOfUnit(), style);
78
		combo_lifeStage = formFactory.createDefinedTermComboElement(TermType.Stage, formElement, "Life Stage", entity.getLifeStage(), style);
79
		combo_sex = formFactory.createDefinedTermComboElement(TermType.Sex, formElement, "Sex", entity.getSex(),style);
77
		super.createControls(formElement, entity, style);
80 78
	}
81 79

  
82 80
	/** {@inheritDoc} */
83 81
	@Override
84 82
	public void handleEvent(Object eventSource) {
83
		super.handleEvent(eventSource);
85 84
		if(eventSource == text_ecology){
86 85
			getEntity().setEcology(text_ecology.getText());
87 86
		}
......
100 99
		else if(eventSource == number_individualCount){
101 100
			getEntity().setIndividualCount(number_individualCount.getInteger());
102 101
		}
103
		else if(eventSource == combo_kindOfUnit){
104
		    getEntity().setKindOfUnit(combo_kindOfUnit.getSelection());
105
		}
106
		else if(eventSource == combo_lifeStage){
107
			getEntity().setLifeStage(combo_lifeStage.getSelection());
108
		}
109
		else if(eventSource == combo_sex){
110
			getEntity().setSex(combo_sex.getSelection());
111
		}
102
		
112 103
	}
113 104
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)