- created specimen general element
authorPatric Plitzner <p.plitzner@bgbm.org>
Fri, 16 Aug 2013 13:53:35 +0000 (13:53 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Fri, 16 Aug 2013 13:53:35 +0000 (13:53 +0000)
 - copied&adapted field observation and specimen section to campanula package

.gitattributes
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElementController.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index fbabd11477e173eff9c490067716723eb4d2be40..8d0bf27ad6d3af8684fb0b47358d0dfc50b78aa3 100644 (file)
@@ -1247,8 +1247,12 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/d
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationDetailsView.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationGeneralElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationGeneralElementController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/GatheringEventDetailsElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/GatheringEventDetailsElementController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElementController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java -text
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/fieldObservation/FieldObservationSection.java
new file mode 100644 (file)
index 0000000..544fa2b
--- /dev/null
@@ -0,0 +1,57 @@
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 16.08.2013
+ *
+ */
+public class FieldObservationSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+    /**
+     * <p>Constructor for FieldObservationDetailSection.</p>
+     *
+     * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+     * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+     * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
+     * @param style a int.
+     */
+    public FieldObservationSection(CdmFormFactory formFactory, ConversationHolder conversation,
+            ICdmFormElement parentElement,
+            ISelectionProvider selectionProvider, int style) {
+        super(formFactory, conversation, parentElement, selectionProvider, style);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getHeading() {
+        return "Field Observation";
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+     */
+    @Override
+    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+        return formFactory.createFieldObservationGeneralElement(parentElement);
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElement.java
new file mode 100644 (file)
index 0000000..eec44ca
--- /dev/null
@@ -0,0 +1,263 @@
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionField;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.PointField;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ToggleableTextField;
+
+
+/**
+ * @author pplitzner
+ * @date 16.08.2013
+ *
+ */
+public class SpecimenGeneralElement extends Composite{
+    private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+    private final Text textLocality;
+    private final Text textElevation;
+    private final Text textCollectingNumber;
+    private EntitySelectionField countrySelectionField;
+    private EntitySelectionField collectorSelectionField;
+    private ToggleableTextField toggleableTextField;
+    private PointField pointField;
+    private Label lblTitleCache;
+    private Label lblCountry;
+    private Label lblLocality;
+    private Label lblLatitude;
+    private Label lblLongitude;
+    private Label lblErrorRadiusm;
+    private Label lblReferenceSystem;
+    private Label lblAbsoluteElevationm;
+    private Label lblDate;
+    private Label lblCollector;
+    private Label lblCollectingNumber;
+    private Label lblCollection;
+    private Label lblAccessionNumber;
+    private Text textAccessionNumber;
+    private EntitySelectionField collectionSelectionField;
+
+    /**
+     * @param parent
+     * @param style
+     */
+    public SpecimenGeneralElement(Composite parent, int style) {
+        super(parent, style);
+        setEnabled(false);
+        setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
+        {
+            TableWrapLayout tableWrapLayout = new TableWrapLayout();
+            tableWrapLayout.numColumns = 2;
+            setLayout(tableWrapLayout);
+        }
+
+        lblTitleCache = formToolkit.createLabel(this, "Title Cache", SWT.NONE);
+        lblTitleCache.setEnabled(false);
+
+        toggleableTextField = new ToggleableTextField(this, SWT.NONE);
+        toggleableTextField.getText().setEnabled(false);
+        toggleableTextField.getEditButton().setEnabled(false);
+        toggleableTextField.setEnabled(false);
+        TableWrapData twd_toggleableTextField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+        twd_toggleableTextField.grabHorizontal = true;
+        toggleableTextField.setLayoutData(twd_toggleableTextField);
+        formToolkit.adapt(toggleableTextField);
+        formToolkit.paintBordersFor(toggleableTextField);
+
+        lblCountry = new Label(this, SWT.NONE);
+        lblCountry.setEnabled(false);
+        formToolkit.adapt(lblCountry, true, true);
+        lblCountry.setText("Country");
+
+        countrySelectionField = new EntitySelectionField(this, SWT.NONE);
+        countrySelectionField.getText().setEnabled(false);
+        countrySelectionField.getButton_selection().setEnabled(false);
+        countrySelectionField.getButton_edit().setEnabled(false);
+        countrySelectionField.getButton_remove().setEnabled(false);
+        countrySelectionField.setEnabled(false);
+        countrySelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        formToolkit.adapt(countrySelectionField);
+        formToolkit.paintBordersFor(countrySelectionField);
+
+        lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
+        lblLocality.setEnabled(false);
+
+        textLocality = formToolkit.createText(this, "New Text", SWT.NONE);
+        textLocality.setEnabled(false);
+        textLocality.setEditable(false);
+        textLocality.setText("");
+        textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+        lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
+        lblLatitude.setEnabled(false);
+
+        pointField = new PointField(this, SWT.NONE);
+        pointField.getCombo_referenceSystem().setEnabled(false);
+        pointField.getNumber_errorRadius().setEnabled(false);
+        pointField.getNumber_errorRadius().setEditable(false);
+        pointField.getText_longitudeParsed().setEditable(false);
+        pointField.getText_longitude().setEnabled(false);
+        pointField.getText_longitude().setEditable(false);
+        pointField.getText_latitudeParsed().setEditable(false);
+        pointField.getText_latitude().setEditable(false);
+        pointField.getText_latitude().setEnabled(false);
+        pointField.setEnabled(false);
+        TableWrapLayout twl_pointField = (TableWrapLayout) pointField.getLayout();
+        twl_pointField.verticalSpacing = 0;
+        twl_pointField.topMargin = 0;
+        twl_pointField.rightMargin = 0;
+        twl_pointField.leftMargin = 0;
+        twl_pointField.horizontalSpacing = 0;
+        twl_pointField.bottomMargin = 0;
+        pointField.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 6, 1));
+        formToolkit.adapt(pointField);
+        formToolkit.paintBordersFor(pointField);
+        new Label(this, SWT.NONE);
+
+        lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
+        lblLongitude.setEnabled(false);
+        new Label(this, SWT.NONE);
+
+        lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
+        lblErrorRadiusm.setEnabled(false);
+
+        lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
+        lblReferenceSystem.setEnabled(false);
+
+        lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
+        lblAbsoluteElevationm.setEnabled(false);
+
+        textElevation = formToolkit.createText(this, "New Text", SWT.NONE);
+        textElevation.setEditable(false);
+        textElevation.setEnabled(false);
+        textElevation.setText("");
+        textElevation.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+        lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
+        lblDate.setEnabled(false);
+        new Label(this, SWT.NONE);
+
+        lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
+        lblCollector.setEnabled(false);
+
+        collectorSelectionField = new EntitySelectionField(this, SWT.NONE);
+        collectorSelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        collectorSelectionField.getButton_selection().setEnabled(false);
+        collectorSelectionField.getButton_edit().setEnabled(false);
+        collectorSelectionField.getButton_remove().setEnabled(false);
+        collectorSelectionField.getText().setEnabled(false);
+        formToolkit.adapt(collectorSelectionField);
+        formToolkit.paintBordersFor(collectorSelectionField);
+
+        lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
+        lblCollectingNumber.setEnabled(false);
+
+        textCollectingNumber = formToolkit.createText(this, "New Text", SWT.NONE);
+        textCollectingNumber.setEditable(false);
+        textCollectingNumber.setEnabled(false);
+        textCollectingNumber.setText("");
+        textCollectingNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+        lblCollection = formToolkit.createLabel(this, "Collection", SWT.NONE);
+
+        collectionSelectionField = new EntitySelectionField(this, SWT.NONE);
+        formToolkit.adapt(collectionSelectionField);
+        formToolkit.paintBordersFor(collectionSelectionField);
+
+        lblAccessionNumber = formToolkit.createLabel(this, "Accession Number", SWT.NONE);
+
+        textAccessionNumber = formToolkit.createText(this, "New Text", SWT.NONE);
+        textAccessionNumber.setText("");
+        textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+    }
+
+    @Override
+    protected void checkSubclass() {
+        // Disable the check that prevents subclassing of SWT components
+    }
+
+    public EntitySelectionField getCountrySelectionField() {
+        return countrySelectionField;
+    }
+
+    public EntitySelectionField getCollectorSelectionField() {
+        return collectorSelectionField;
+    }
+
+    public Text getTextElevation() {
+        return textElevation;
+    }
+
+    public Text getTextLocality() {
+        return textLocality;
+    }
+
+    public Text getTextCollectingNumber() {
+        return textCollectingNumber;
+    }
+
+    public ToggleableTextField getToggleableTextField() {
+        return toggleableTextField;
+    }
+
+    public PointField getPointField() {
+        return pointField;
+    }
+    public Label getLblTitleCache() {
+        return lblTitleCache;
+    }
+    public Label getLblCountry() {
+        return lblCountry;
+    }
+    public Label getLblLocality() {
+        return lblLocality;
+    }
+    public Label getLblLatitude() {
+        return lblLatitude;
+    }
+    public Label getLblLongitude() {
+        return lblLongitude;
+    }
+    public Label getLblErrorRadiusm() {
+        return lblErrorRadiusm;
+    }
+    public Label getLblReferenceSystem() {
+        return lblReferenceSystem;
+    }
+    public Label getLblAbsoluteElevationm() {
+        return lblAbsoluteElevationm;
+    }
+    public Label getLblDate() {
+        return lblDate;
+    }
+    public Label getLblCollector() {
+        return lblCollector;
+    }
+    public Label getLblCollectingNumber() {
+        return lblCollectingNumber;
+    }
+    public Text getTextAccessionNumber() {
+        return textAccessionNumber;
+    }
+    public EntitySelectionField getCollectionSelectionField() {
+        return collectionSelectionField;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElementController.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenGeneralElementController.java
new file mode 100644 (file)
index 0000000..c5126e8
--- /dev/null
@@ -0,0 +1,107 @@
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.cdm.model.occurrence.Collection;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.LanguageTextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NumberFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.PointFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ToggleableTextFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author pplitzner
+ * @date 16.08.2013
+ *
+ */
+public class SpecimenGeneralElementController extends AbstractCdmDetailElement<DerivedUnitFacade>  {
+
+    private SpecimenGeneralElement specimenGeneralElement;
+
+    private ToggleableTextFieldController toggleableText_titleCache;
+    private EntitySelectionFieldController<NamedArea> selection_country;
+    private LanguageTextFieldController languageText_locality;
+    private PointFieldController element_point;
+    private NumberFieldController number_elevation;
+    private TimePeriodElement element_date;//TODO convert
+    private EntitySelectionFieldController<AgentBase> selection_collector;
+    private TextFieldController text_collectingNumber;
+    private EntitySelectionFieldController<Collection> selectionCollection;
+    private TextFieldController textAccessionNumber;
+
+    /**
+     * @param fieldObservationGeneralElement
+     * @param formFactory
+     * @param formElement
+     */
+    public SpecimenGeneralElementController(SpecimenGeneralElement specimenGeneralElement, CdmFormFactory formFactory, ICdmFormElement formElement) {
+        super(formFactory, formElement);
+        this.specimenGeneralElement = specimenGeneralElement;
+        setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
+        formFactory.addPropertyChangeListener(this);
+    }
+
+
+    @Override
+    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+        toggleableText_titleCache = new ToggleableTextFieldController(specimenGeneralElement.getToggleableTextField(), getFormFactory(), formElement, entity.getTitleCache(), entity.isProtectedTitleCache(), style);
+
+        selection_country = new EntitySelectionFieldController<NamedArea>(specimenGeneralElement.getCountrySelectionField(), getFormFactory(), getConversationHolder(), formElement, NamedArea.class, entity.getCountry(), EntitySelectionElement.NOTHING);
+        languageText_locality = new LanguageTextFieldController(specimenGeneralElement.getTextLocality(), getFormFactory(), formElement, entity.getLocality());
+        element_point = new PointFieldController(specimenGeneralElement.getPointField(),getFormFactory(), formElement, entity.getExactLocation(), style);
+        number_elevation = new NumberFieldController(specimenGeneralElement.getTextElevation(), getFormFactory(), formElement, entity.getAbsoluteElevation());
+//        element_date = formFactory.createTimePeriodElement(formElement, "Date", entity.getGatheringPeriod(), style);
+        selection_collector = new EntitySelectionFieldController<AgentBase>(specimenGeneralElement.getCollectorSelectionField(), getFormFactory(), getConversationHolder(), formElement, AgentBase.class, entity.getCollector(), EntitySelectionElement.ALL);
+        text_collectingNumber = new TextFieldController(specimenGeneralElement.getTextCollectingNumber(), getFormFactory(), formElement, entity.getFieldNumber(), null);
+        selectionCollection = new EntitySelectionFieldController<Collection>(specimenGeneralElement.getCollectionSelectionField(), getFormFactory(), getConversationHolder(), formElement, Collection.class, entity.getCollection(), EntitySelectionElement.ALL);
+        textAccessionNumber = new TextFieldController(specimenGeneralElement.getTextAccessionNumber(), getFormFactory(), formElement, entity.getAccessionNumber(), null);
+    }
+
+    @Override
+    public void handleEvent(Object eventSource) {
+        if (eventSource == toggleableText_titleCache) {
+            getEntity().setTitleCache(toggleableText_titleCache.getText(), toggleableText_titleCache.getState());
+        } else if (eventSource == selection_country) {
+            getEntity().setCountry(selection_country.getSelection());
+        } else if (eventSource == languageText_locality) {
+            LanguageString locality = languageText_locality.getLanguageString();
+            getEntity().setLocality(locality);
+        } else if (eventSource == element_point) {
+            getEntity().setExactLocation(element_point.getPoint());
+        } else if (eventSource == number_elevation) {
+            getEntity().setAbsoluteElevation(number_elevation.getInteger());
+        } else if (eventSource == element_date) {
+            getEntity().setGatheringPeriod(element_date.getTimePeriod());
+        } else if (eventSource == selection_collector) {
+            getEntity().setCollector(selection_collector.getSelection());
+        } else if (eventSource == text_collectingNumber) {
+            getEntity().setFieldNumber(text_collectingNumber.getText());
+        }
+        else if (eventSource == selectionCollection) {
+            getEntity().setCollection(selectionCollection.getSelection());
+        } else if (eventSource == textAccessionNumber) {
+            getEntity().setAccessionNumber(textAccessionNumber.getText());
+        }
+        if (eventSource != toggleableText_titleCache) {
+            toggleableText_titleCache.setText(getEntity().getTitleCache());
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/detailViews/specimen/SpecimenSection.java
new file mode 100644 (file)
index 0000000..91174ec
--- /dev/null
@@ -0,0 +1,57 @@
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 16.08.2013
+ *
+ */
+public class SpecimenSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+    /**
+     * <p>Constructor for FieldObservationDetailSection.</p>
+     *
+     * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+     * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+     * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
+     * @param style a int.
+     */
+    public SpecimenSection(CdmFormFactory formFactory, ConversationHolder conversation,
+            ICdmFormElement parentElement,
+            ISelectionProvider selectionProvider, int style) {
+        super(formFactory, conversation, parentElement, selectionProvider, style);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getHeading() {
+        return "Specimen";
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+     */
+    @Override
+    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+        return formFactory.createSpecimenGeneralElementController(parentElement);
+    }
+}
index 4c0325e848f3a504c56bdc2e2c2e351d9be73eec..741d99e2139e81917734c4cb0196f0e6f1a037dc 100644 (file)
@@ -101,8 +101,12 @@ import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObs
 import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElementController;
 import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElement;
 import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationSection;
 import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElement;
 import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenSection;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
@@ -1755,13 +1759,6 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
-    public FieldObservationGeneralElementController createFieldObservationGeneralElement(ICdmFormElement parentElement){
-        FieldObservationGeneralElement fieldObservationGeneralElement = new FieldObservationGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
-        fieldObservationGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
-        FieldObservationGeneralElementController element = new FieldObservationGeneralElementController(fieldObservationGeneralElement, this, parentElement);
-        addAndAdaptElement(parentElement, element);
-        return element;
-    }
 
     public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
         GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
@@ -1769,28 +1766,12 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
-    public GatheringEventDetailsElementController createGatheringEventDetailsElementController(ICdmFormElement parentElement) {
-        GatheringEventDetailsElement gatheringEventDetailsElement = new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
-        gatheringEventDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
-        GatheringEventDetailsElementController element = new GatheringEventDetailsElementController(gatheringEventDetailsElement, this, parentElement);
-        adapt(element);
-        parentElement.addElement(element);
-        return element;
-    }
-
     public FieldObservationDetailElement createFieldObservationDetailElement(ICdmFormElement parentElement) {
         FieldObservationDetailElement element = new FieldObservationDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
         return element;
     }
 
-    public FieldObservationDetailsElementController createFieldObservationDetailsElementController(ICdmFormElement parentElement) {
-        FieldObservationDetailsElement fieldObservationDetailsElement = new FieldObservationDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
-        fieldObservationDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
-        FieldObservationDetailsElementController element = new FieldObservationDetailsElementController(fieldObservationDetailsElement, this, parentElement);
-        addAndAdaptElement(parentElement, element);
-        return element;
-    }
 
     public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
         DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
@@ -2292,4 +2273,65 @@ public class CdmFormFactory extends FormToolkit {
         return text;
     }
 
+
+
+    /**
+     * @param conversationHolder
+     * @param parent
+     * @param detailsViewer
+     * @param i
+     * @return
+     */
+    public FieldObservationSection createFieldObservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+        FieldObservationSection section = new FieldObservationSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    /**
+     * @param conversationHolder
+     * @param parent
+     * @param detailsViewer
+     * @param i
+     * @return
+     */
+    public SpecimenSection createSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+        SpecimenSection section = new SpecimenSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public SpecimenGeneralElementController createSpecimenGeneralElementController(ICdmFormElement parentElement){
+        SpecimenGeneralElement specimenGeneralElement = new SpecimenGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
+        specimenGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+        SpecimenGeneralElementController element = new SpecimenGeneralElementController(specimenGeneralElement, this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public FieldObservationGeneralElementController createFieldObservationGeneralElement(ICdmFormElement parentElement){
+        FieldObservationGeneralElement fieldObservationGeneralElement = new FieldObservationGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
+        fieldObservationGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+        FieldObservationGeneralElementController element = new FieldObservationGeneralElementController(fieldObservationGeneralElement, this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public GatheringEventDetailsElementController createGatheringEventDetailsElementController(ICdmFormElement parentElement) {
+        GatheringEventDetailsElement gatheringEventDetailsElement = new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
+        gatheringEventDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+        GatheringEventDetailsElementController element = new GatheringEventDetailsElementController(gatheringEventDetailsElement, this, parentElement);
+        adapt(element);
+        parentElement.addElement(element);
+        return element;
+    }
+
+    public FieldObservationDetailsElementController createFieldObservationDetailsElementController(ICdmFormElement parentElement) {
+        FieldObservationDetailsElement fieldObservationDetailsElement = new FieldObservationDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
+        fieldObservationDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+        FieldObservationDetailsElementController element = new FieldObservationDetailsElementController(fieldObservationDetailsElement, this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
 }
index f245f0e0a3333b00c8a06a869403c25653a8de0f..925b77f0428e8aa9f6b926f8b93425fec6231a79 100644 (file)
@@ -54,6 +54,6 @@ public class FieldObservationDetailSection extends AbstractCdmDetailSection<Deri
         */
        @Override
        protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
-           return formFactory.createFieldObservationDetailsElementController(parentElement);
+           return formFactory.createFieldObservationDetailElement(parentElement);
        }
 }
index be8f7a5bddbe503c250977d1178e3238f233e179..90c3e3551b7f6eab3bfc29156d19ca5b550f1d5b 100644 (file)
@@ -47,6 +47,8 @@ import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenSection;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.RootElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
@@ -76,7 +78,6 @@ import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
@@ -539,7 +540,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
     private void createDerivedUnitBaseElementSection(RootElement parent) {
         destroySections();
 
-        GeneralDetailSection generalDetailSection = formFactory.createGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        FieldObservationSection fieldObservationSection = formFactory.createFieldObservationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
@@ -551,15 +552,21 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
+        SpecimenSection specimenSection = formFactory.createSpecimenSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+
 //        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
 //
 //        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 //
 //        DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
 
-        addPart(generalDetailSection);
+        addPart(fieldObservationSection);
         addPart(gatheringEventDetailSection);
         addPart(fieldObservationDetailSection);
+        addPart(specimenSection);
 //        addPart(derivedUnitBaseDetailSection);
 //        addPart(determinationDetailSection);
     }