Project

General

Profile

« Previous | Next » 

Revision 6a58183a

Added by Cherian Mathew almost 11 years ago

GeneralDetailElement : removed elevation element
FieldObservationDetailElement : calling new create function for filling in DefinedTerm combos (still requires a model side update)
GatheringEventDetailElement : added elements for elevation / distance to ground / distance to water surface

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java
17 17
import eu.etaxonomy.taxeditor.store.StoreUtil;
18 18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19 19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
20
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
20 21
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21 22
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
23
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
22 24
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
23 25
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
24 26
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
......
35 37
public class GatheringEventDetailElement extends
36 38
		AbstractCdmDetailElement<DerivedUnitFacade> {
37 39

  
38
	private NumberWithLabelElement number_absoluteElevationError;
40
	private GatheringEventUnitElement element_elevation;
39 41

  
40
	private NumberWithLabelElement number_absoluteElevationMinimum;
41

  
42
	private NumberWithLabelElement number_absoluteElevationMaximum;
42
	private GatheringEventUnitElement element_distToGround;
43
	
44
	private GatheringEventUnitElement element_distToWater;
45
	
46
	private MinMaxTextSection section_minMaxText;
43 47

  
44 48
	private TextWithLabelElement text_collectingMethod;
45 49

  
46
	private NumberWithLabelElement number_distanceToGround;
47

  
48
	private NumberWithLabelElement number_distanceToWaterSurface;
49

  
50 50
	private TextWithLabelElement text_gatheringEventDescription;
51 51

  
52 52
	private CollectingAreasDetailSection section_collectingAreas;
......
70 70

  
71 71
	/** {@inheritDoc} */
72 72
	@Override
73
	protected void createControls(ICdmFormElement formElement,
74
			DerivedUnitFacade entity, int style) {
73
	protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
74
		
75

  
75 76
		// collectingArea
76
		//FIXME:3.3MC
77
//		number_absoluteElevationError = formFactory
78
//				.createNumberTextWithLabelElement(formElement,
79
//						"Elevation Error", entity.getAbsoluteElevationError(),
80
//						style);
81
//		number_absoluteElevationMinimum = formFactory
82
//				.createNumberTextWithLabelElement(formElement,
83
//						"Elevation Minimum (m)",
84
//						entity.getAbsoluteElevationMinimum(), style);
85
		number_absoluteElevationMaximum = formFactory
86
				.createNumberTextWithLabelElement(formElement,
87
						"Elevation Maximum (m)",
88
						entity.getAbsoluteElevationMaximum(), style);
77

  
89 78

  
90 79
		text_collectingMethod = formFactory.createTextWithLabelElement(
91 80
				formElement, "Collecting Method", entity.getCollectingMethod(),
92 81
				style);
93 82

  
94
		number_distanceToGround = formFactory
95
				.createNumberTextWithLabelElement(formElement,
96
						"Distance To Ground (m)", entity.getDistanceToGround(),
97
						style);
98
		number_distanceToWaterSurface = formFactory
99
				.createNumberTextWithLabelElement(formElement,
100
						"Distance To Water Surface (m)",
101
						entity.getDistanceToWaterSurface(), style);
83

  
102 84
		// exactLocation
103 85
		text_gatheringEventDescription = formFactory
104 86
				.createTextWithLabelElement(formElement,
105 87
						"Gathering Event Description",
106 88
						entity.getGatheringEventDescription(), style);
107

  
89
		element_elevation = formFactory.createGatheringEventUnitElement(
90
				formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
91
		
92
		
93
		element_distToGround = formFactory.createGatheringEventUnitElement(
94
				formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND,  style);
95
		
96
		element_distToWater = formFactory.createGatheringEventUnitElement(
97
				formElement, "Dist. To Water : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER,  style);
98
		
108 99
		section_collectingAreas = (CollectingAreasDetailSection) formFactory
109 100
				.createEntityDetailSection(EntityDetailType.COLLECTING_AREA,
110 101
						getConversationHolder(), formElement, Section.TWISTIE);
111 102
		section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(
112 103
				2, 1));
113 104
		section_collectingAreas.setEntity(entity);
105

  
114 106
	}
115 107

  
116 108
	/** {@inheritDoc} */
117 109
	@Override
118 110
	public void handleEvent(Object eventSource) {
119
		//FIXME:3.3MC
120
//		if (eventSource == number_absoluteElevationError) {
121
//			getEntity().setAbsoluteElevationError(
122
//					number_absoluteElevationError.getInteger());
123
//		} else 
124
		if (eventSource == number_absoluteElevationMinimum) {
125
			try {
126
				getEntity().setAbsoluteElevationRange(
127
						number_absoluteElevationMinimum.getInteger(),
128
						number_absoluteElevationMaximum.getInteger());
129
				number_absoluteElevationMinimum
130
						.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
131
			} catch (IllegalArgumentException e) {
132
				number_absoluteElevationMinimum
133
						.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
134
				StoreUtil.warn(getClass(), e.getLocalizedMessage());
135
			}
136
		} else if (eventSource == number_absoluteElevationMaximum) {
137
			try {
138
				getEntity().setAbsoluteElevationRange(
139
						number_absoluteElevationMinimum.getInteger(),
140
						number_absoluteElevationMaximum.getInteger());
141
				number_absoluteElevationMaximum
142
						.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
143
			} catch (IllegalArgumentException e) {
144
				number_absoluteElevationMaximum
145
						.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
146
				StoreUtil.warn(getClass(), e.getLocalizedMessage());
147
			}
148
		} else if (eventSource == text_collectingMethod) {
111
		if (eventSource == text_collectingMethod) {
149 112
			getEntity().setCollectingMethod(text_collectingMethod.getText());
150
		} else if (eventSource == number_distanceToGround) {
151
			getEntity().setDistanceToGround(
152
					number_distanceToGround.getDouble());
153
		} else if (eventSource == number_distanceToWaterSurface) {
154
			getEntity().setDistanceToWaterSurface(
155
					number_distanceToWaterSurface.getDouble());
156 113
		} else if (eventSource == text_gatheringEventDescription) {
157 114
			getEntity().setGatheringEventDescription(
158 115
					text_gatheringEventDescription.getText());

Also available in: Unified diff