import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmElementFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmNumberField;
+import eu.etaxonomy.taxeditor.ui.element.CdmTextField;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElementComposite;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelComposite;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElementComposite;
/**
+ private final CdmNumberField absoluteElevationError;
+ private final CdmNumberField number_absoluteElevationMinimum;
+ private final CdmNumberField number_absoluteElevationMaximum;
+ private final CdmTextField collectingMethod;
+ private final CdmNumberField number_distanceToGround;
+ private final CdmNumberField number_distanceToWaterSurface;
+ private final CdmTextField gatheringEventDescription;
// private CollectingAreasDetailSection section_collectingAreas;
- private final NumberWithLabelElementComposite absoluteElevationError;
- private final NumberWithLabelElementComposite number_absoluteElevationMinimum;
- private final NumberWithLabelElementComposite number_absoluteElevationMaximum;
- private final TextWithLabelComposite collectingMethod;
- private final NumberWithLabelElementComposite number_distanceToGround;
- private final NumberWithLabelElementComposite number_distanceToWaterSurface;
- private final TextWithLabelComposite gatheringEventDescription;
/**
* <p>
*/
public GatheringEventDetailElementComposite(Composite parent, FormToolkit formFactory, ICdmFormElement parentFormElement, int style) {
super(parent, formFactory, parentFormElement, style);
- TableWrapLayout tableWrapLayout = (TableWrapLayout) getLayout();
- tableWrapLayout.numColumns = 1;
-
- absoluteElevationError = CdmFormFactory.createNumberWithLabelElementComposite(this, getFormFactory(), this, "Elevation Error", new Float(0), SWT.NONE);
- TableWrapData twd_absoluteElevationError = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_absoluteElevationError.grabHorizontal = true;
- absoluteElevationError.setLayoutData(twd_absoluteElevationError);
- getFormFactory().adapt(absoluteElevationError);
- getFormFactory().paintBordersFor(absoluteElevationError);
-
- number_absoluteElevationMinimum = CdmFormFactory.createNumberWithLabelElementComposite(this, getFormFactory(), this, "Elevation Minimum (m)", new Float(0), SWT.NONE);
- TableWrapData twd_number_absoluteElevationMinimum = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_number_absoluteElevationMinimum.grabHorizontal = true;
- number_absoluteElevationMinimum.setLayoutData(twd_number_absoluteElevationMinimum);
+
+ Label lblNewLabel_4 = new Label(this, SWT.NONE);
+ formFactory.adapt(lblNewLabel_4, true, true);
+ lblNewLabel_4.setText("Elevation Error");
+
+ absoluteElevationError = CdmElementFactory.createCdmNumberField(this, formFactory, this, (Integer) null, 0);
+ ((TableWrapData) absoluteElevationError.getMainControl().getLayoutData()).grabVertical = false;
+ TableWrapData twd_cdmNumberField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_cdmNumberField.grabHorizontal = true;
+ absoluteElevationError.setLayoutData(twd_cdmNumberField);
+ formFactory.adapt(absoluteElevationError);
+ formFactory.paintBordersFor(absoluteElevationError);
+
+ Label lblNewLabel_3 = new Label(this, SWT.NONE);
+ formFactory.adapt(lblNewLabel_3, true, true);
+ lblNewLabel_3.setText("Elevation Error Minumum (m)");
+
+ number_absoluteElevationMinimum = CdmElementFactory.createCdmNumberField(this, formFactory, this, (Integer) null, 0);
+ TableWrapData tableWrapData = (TableWrapData) number_absoluteElevationMinimum.getMainControl().getLayoutData();
+ tableWrapData.valign = TableWrapData.TOP;
+ tableWrapData.grabVertical = false;
+ TableWrapData twd_cdmNumberField_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_cdmNumberField_1.grabHorizontal = true;
+ number_absoluteElevationMinimum.setLayoutData(twd_cdmNumberField_1);
formFactory.paintBordersFor(number_absoluteElevationMinimum);
- number_absoluteElevationMaximum = CdmFormFactory.createNumberWithLabelElementComposite(this, getFormFactory(), parentFormElement, "Elevation Maximum (m)", new Float(0), SWT.NONE);
- TableWrapData twd_numberWithLabelElementComposite = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_numberWithLabelElementComposite.grabVertical = true;
- twd_numberWithLabelElementComposite.grabHorizontal = true;
- number_absoluteElevationMaximum.setLayoutData(twd_numberWithLabelElementComposite);
- formFactory.paintBordersFor(number_absoluteElevationMaximum);
+ Label lblNewLabel_2 = new Label(this, SWT.NONE);
+ formFactory.adapt(lblNewLabel_2, true, true);
+ lblNewLabel_2.setText("Elevation Maximum (m)");
- collectingMethod = CdmFormFactory.createTextWithLabelComposite(this, getFormFactory(), this, "Collecting Method", "", (Integer) null, SWT.NONE);
- TableWrapData twd_collectingMethod = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_collectingMethod.grabHorizontal = true;
- collectingMethod.setLayoutData(twd_collectingMethod);
- getFormFactory().adapt(collectingMethod);
- getFormFactory().paintBordersFor(collectingMethod);
+ number_absoluteElevationMaximum = CdmElementFactory.createCdmNumberField(this, formFactory, this, (Integer) null, 0);
+ TableWrapData twd_cdmNumberField_2 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_cdmNumberField_2.grabHorizontal = true;
+ number_absoluteElevationMaximum.setLayoutData(twd_cdmNumberField_2);
+ formFactory.adapt(number_absoluteElevationMaximum);
+ formFactory.paintBordersFor(number_absoluteElevationMaximum);
- number_distanceToGround = CdmFormFactory.createNumberWithLabelElementComposite(this, getFormFactory(), parentFormElement, "Distance To Ground (m)", new Float(0), SWT.NONE);
+ Label lblTestLabel = new Label(this, SWT.NONE);
+ formFactory.adapt(lblTestLabel, true, true);
+ lblTestLabel.setText("Collecting Method");
+
+ collectingMethod = CdmElementFactory.createCdmTextField(this, formFactory, this, (String) null, (Integer) null, 0);
+ TableWrapData twd_cdmTextField_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_cdmTextField_1.grabHorizontal = true;
+ collectingMethod.setLayoutData(twd_cdmTextField_1);
+ formFactory.adapt(collectingMethod);
+ formFactory.paintBordersFor(collectingMethod);
+
+ Label lblNewLabel_5 = new Label(this, SWT.NONE);
+ formFactory.adapt(lblNewLabel_5, true, true);
+ lblNewLabel_5.setText("Distance To Ground (m)");
+
+ number_distanceToGround = CdmElementFactory.createCdmNumberField(this, formFactory, this, (Integer) null, 0);
+ TableWrapData twd_cdmNumberField_3 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_cdmNumberField_3.grabHorizontal = true;
+ number_distanceToGround.setLayoutData(twd_cdmNumberField_3);
+ formFactory.adapt(number_distanceToGround);
formFactory.paintBordersFor(number_distanceToGround);
- number_distanceToWaterSurface = CdmFormFactory.createNumberWithLabelElementComposite(this, getFormFactory(), parentFormElement, "Distance To Water Surface (m)", new Float(0), SWT.NONE);
+ Label lblNewLabel_6 = new Label(this, SWT.NONE);
+ formFactory.adapt(lblNewLabel_6, true, true);
+ lblNewLabel_6.setText("Distance To Water Surface");
+
+ number_distanceToWaterSurface = CdmElementFactory.createCdmNumberField(this, formFactory, this, (Integer) null, 0);
+ TableWrapData twd_cdmNumberField_4 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_cdmNumberField_4.grabHorizontal = true;
+ number_distanceToWaterSurface.setLayoutData(twd_cdmNumberField_4);
+ formFactory.adapt(number_distanceToWaterSurface);
formFactory.paintBordersFor(number_distanceToWaterSurface);
- gatheringEventDescription = CdmFormFactory.createTextWithLabelComposite(this, getFormFactory(), this, "Gathering Event Description", "", (Integer) null, SWT.NONE);
- TableWrapData twd_gatheringEventDescription = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_gatheringEventDescription.grabHorizontal = true;
- gatheringEventDescription.setLayoutData(twd_gatheringEventDescription);
- getFormFactory().adapt(gatheringEventDescription);
- getFormFactory().paintBordersFor(gatheringEventDescription);
+ Label lblNewLabel = new Label(this, SWT.NONE);
+ formFactory.adapt(lblNewLabel, true, true);
+ lblNewLabel.setText("Gathering Event Description");
+
+ gatheringEventDescription = CdmElementFactory.createCdmTextField(this, formFactory, this, (String) null, (Integer) null, 0);
+ TableWrapData twd_cdmTextField_2 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ twd_cdmTextField_2.grabHorizontal = true;
+ gatheringEventDescription.setLayoutData(twd_cdmTextField_2);
+ formFactory.adapt(gatheringEventDescription);
+ formFactory.paintBordersFor(gatheringEventDescription);
}
number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
AbstractUtility.warn(getClass(), e.getLocalizedMessage());
}
- } else if (eventSource == getCollectingMethod()) {
- getEntity().setCollectingMethod(getCollectingMethod().getText());
+ } else if (eventSource == collectingMethod) {
+ getEntity().setCollectingMethod(collectingMethod.getText());
} else if (eventSource == number_distanceToGround) {
getEntity().setDistanceToGround(number_distanceToGround.getInteger());
} else if (eventSource == number_distanceToWaterSurface) {
getEntity().setDistanceToWaterSurface(number_distanceToWaterSurface.getInteger());
- } else if (eventSource == getGatheringEventDescription()) {
- getEntity().setGatheringEventDescription(getGatheringEventDescription().getText());
+ } else if (eventSource == gatheringEventDescription) {
+ getEntity().setGatheringEventDescription(gatheringEventDescription.getText());
}
}
- public TextWithLabelComposite getGatheringEventDescription() {
- return gatheringEventDescription;
- }
- public TextWithLabelComposite getCollectingMethod() {
- return collectingMethod;
- }
}