- created GatheringEventDetails element completely uncoupled to any controlling...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / GatheringEventDetailElementComposite.java
index b75155b75cfafbea161d7d4ed530b5a985ebe4cb..ba38be2889b49797493477cecc6c6f13a6c27a93 100644 (file)
@@ -9,20 +9,17 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.occurrence;
 
-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 eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.preference.Resources;
-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.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElementComposite;
+import eu.etaxonomy.taxeditor.ui.section.campanula.GatheringEventDetailsElement;
+import eu.etaxonomy.taxeditor.ui.section.campanula.NumberFieldController;
+import eu.etaxonomy.taxeditor.ui.section.campanula.TextFieldController;
 
 /**
  * @author pplitzner
@@ -33,15 +30,18 @@ public class GatheringEventDetailElementComposite extends AbstractCdmDetailEleme
 
 
 
-    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 final NumberFieldController absoluteElevationError;
+    private final  NumberFieldController number_absoluteElevationMinimum;
+    private final  NumberFieldController number_absoluteElevationMaximum;
+    private final TextFieldController collectingMethod;
+    private final NumberFieldController number_distanceToGround;
+    private final NumberFieldController number_distanceToWaterSurface;
+    private final TextFieldController gatheringEventDescription;
     private CollectingAreasDetailSection section_collectingAreas;
 
+    public GatheringEventDetailElementComposite(Composite parent, CdmFormFactory formFactory, ICdmFormElement parentFormElement, int style) {
+        this(parent, null, formFactory, parentFormElement, style);
+    }
     /**
      * <p>
      * Constructor for GatheringEventDetailElement.
@@ -54,89 +54,16 @@ public class GatheringEventDetailElementComposite extends AbstractCdmDetailEleme
      *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
      *            object.
      */
-    public GatheringEventDetailElementComposite(Composite parent, FormToolkit formFactory, ICdmFormElement parentFormElement, int style) {
+    public GatheringEventDetailElementComposite(Composite parent, GatheringEventDetailsElement controlledComposite, CdmFormFactory formFactory, ICdmFormElement parentFormElement, int style) {
         super(parent, formFactory, parentFormElement, style);
 
-        Label lblNewLabel_4 = new Label(this, SWT.NONE);
-        formFactory.adapt(lblNewLabel_4, true, true);
-        lblNewLabel_4.setText("Elevation Error");
-
-        absoluteElevationError = CdmElementFactory.createCdmNumberField(getLayoutComposite(), 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(getLayoutComposite(), 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);
-
-        Label lblNewLabel_2 = new Label(this, SWT.NONE);
-        formFactory.adapt(lblNewLabel_2, true, true);
-        lblNewLabel_2.setText("Elevation Maximum (m)");
-
-        number_absoluteElevationMaximum = CdmElementFactory.createCdmNumberField(getLayoutComposite(), 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);
-
-        Label lblTestLabel = new Label(this, SWT.NONE);
-        formFactory.adapt(lblTestLabel, true, true);
-        lblTestLabel.setText("Collecting Method");
-
-        collectingMethod = CdmElementFactory.createCdmTextField(getLayoutComposite(), 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(getLayoutComposite(), 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);
-
-        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(getLayoutComposite(), 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);
-
-        Label lblNewLabel = new Label(this, SWT.NONE);
-        formFactory.adapt(lblNewLabel, true, true);
-        lblNewLabel.setText("Gathering Event Description");
-
-        gatheringEventDescription = CdmElementFactory.createCdmTextField(getLayoutComposite(), 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);
-
+        absoluteElevationError = new NumberFieldController(getLayoutComposite(), controlledComposite.getTextElevationError(), formFactory, this, (Integer)null, 0);
+        number_absoluteElevationMinimum = new NumberFieldController(getLayoutComposite(), controlledComposite.getText_ElevationMinimum(), formFactory, this, (Integer)null, 0);
+        number_absoluteElevationMaximum = new NumberFieldController(getLayoutComposite(), controlledComposite.getText_ElevationMaximum(), formFactory, this, (Integer)null, 0);
+        collectingMethod = new TextFieldController(getLayoutComposite(), controlledComposite.getText_CollectingMethod(), formFactory, this, null, null, 0);
+        number_distanceToGround = new NumberFieldController(getLayoutComposite(), controlledComposite.getText_DistanceToGround(), formFactory, this, (Integer)null, 0);
+        number_distanceToWaterSurface = new NumberFieldController(getLayoutComposite(), controlledComposite.getText_DistanceToWaterSurface(), formFactory, this, (Integer)null, 0);
+        gatheringEventDescription = new TextFieldController(getLayoutComposite(), controlledComposite.getText_GatheringEventDescription(), formFactory, this, null, null, 0);
     }
 
     /** {@inheritDoc} */
@@ -146,7 +73,9 @@ public class GatheringEventDetailElementComposite extends AbstractCdmDetailEleme
         absoluteElevationError.setText(String.valueOf(entity.getAbsoluteElevation()));
         number_absoluteElevationMinimum.setText(String.valueOf(entity.getAbsoluteElevationMinimum()));
         number_absoluteElevationMaximum.setText(String.valueOf(entity.getAbsoluteElevationMaximum()));
+
         collectingMethod.setText(entity.getCollectingMethod());
+
         number_distanceToGround.setText(String.valueOf(entity.getDistanceToGround()));
         number_distanceToWaterSurface.setText(String.valueOf(entity.getDistanceToWaterSurface()));
         gatheringEventDescription.setText(entity.getGatheringEventDescription());