// $Id$
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * 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.section.occurrence;
-import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.api.facade.MethodNotSupportedByDerivedUnitTypeException;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.SelectionType;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.selection.NameSelectionElement;
+import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
* <p>
* DerivedUnitBaseDetailElement class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Jun 24, 2010
* @version 1.0
private TextWithLabelElement text_derivedUnitDefinitions;
- private TextWithLabelElement text_accessionNumber;
+ private TextWithLabelElement text_barcode;
private TextWithLabelElement text_catalogNumber;
- private NameSelectionElement selection_storedUnder;
+ private EntitySelectionElement<TaxonNameBase> selection_storedUnder;
private TextWithLabelElement text_exsicatum;
private SourceCollectionDetailSection section_source;
- private TextWithLabelElement text_collectorsNumber;
-
/**
* <p>
* Constructor for DerivedUnitBaseDetailElement.
* </p>
- *
+ *
* @param formFactory
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
/** {@inheritDoc} */
@Override
- protected void createControls(ICdmFormElement formElement,
- DerivedUnitFacade entity, int style) {
- // Disable for now
- // text_derivedUnitDefinitions =
- // formFactory.createTextWithLabelElement(formElement,
- // "Specimen Definition",
- // facade.getDerivedUnitDefinition(CdmStore.getDefaultLanguage()),
- // style);
- text_accessionNumber = formFactory.createTextWithLabelElement(
- formElement, "Accession Number", entity.getAccessionNumber(),
- style);
- text_catalogNumber = formFactory
- .createTextWithLabelElement(formElement, "Catalog Number",
- entity.getCatalogNumber(), style);
-
- try {
- combo_preservationMethod = formFactory.createTermComboElement(PreservationMethod.class,
- formElement, "Preservation Method",
- entity.getPreservationMethod(), style);
- } catch (MethodNotSupportedByDerivedUnitTypeException e) {
- // we ignore this
- StoreUtil.info(e.getMessage());
- }
- selection_storedUnder = (NameSelectionElement) formFactory
- .createSelectionElement(SelectionType.NAME,
- getConversationHolder(), formElement, "Stored Under",
- entity.getStoredUnder(), NameSelectionElement.DEFAULT,
- style);
-
- try {
- text_exsicatum = formFactory.createTextWithLabelElement(
- formElement, "Exsiccatum", entity.getExsiccatum(), style);
- } catch (MethodNotSupportedByDerivedUnitTypeException e) {
- // we ignore this
- StoreUtil.info(e.getMessage());
- }
-
- section_duplicates = (SpecimenCollectionDetailSection) formFactory
- .createEntityDetailSection(
- EntityDetailType.SPECIMEN_COLLECTION,
- getConversationHolder(), formElement, Section.TWISTIE);
- section_duplicates
- .setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
- section_duplicates.setEntity(entity);
-
- section_source = (SourceCollectionDetailSection) formFactory
- .createEntityDetailSection(
- EntityDetailType.IDENTIFIABLE_SOURCE_COLLECTION,
- getConversationHolder(), formElement, Section.TWISTIE);
- section_source.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
- section_source.setEntity(entity);
- }
+ protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+ // Disable for now
+ // text_derivedUnitDefinitions =
+ // formFactory.createTextWithLabelElement(formElement,
+ // "Specimen Definition",
+ // facade.getDerivedUnitDefinition(CdmStore.getDefaultLanguage()),
+ // style);
+ text_barcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
+ text_catalogNumber = formFactory.createTextWithLabelElement(formElement, "Catalog Number", entity.getCatalogNumber(), style);
+
+ try {
+ combo_preservationMethod = formFactory.createTermComboElement(PreservationMethod.class, formElement, "Preservation Method", entity.getPreservationMethod(), style);
+ } catch (MethodNotSupportedByDerivedUnitTypeException e) {
+ // we ignore this
+ AbstractUtility.info(e.getMessage());
+ }
+ selection_storedUnder = formFactory.createSelectionElement(TaxonNameBase.class, getConversationHolder(), formElement, "Stored Under", entity.getStoredUnder(), EntitySelectionElement.ALL, style);
+
+ try {
+ text_exsicatum = formFactory.createTextWithLabelElement(formElement, "Exsiccatum", entity.getExsiccatum(), style);
+ } catch (MethodNotSupportedByDerivedUnitTypeException e) {
+ // we ignore this
+ AbstractUtility.info(e.getMessage());
+ }
+
+ section_duplicates = formFactory.createSpecimenCollectionDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+ section_duplicates.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ section_duplicates.setEntity(entity);
+
+ section_source = formFactory.createSourceCollectionDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+ section_source.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ section_source.setEntity(entity);
+ }
/** {@inheritDoc} */
@Override
getEntity().addDerivedUnitDefinition(
text_derivedUnitDefinitions.getText(),
CdmStore.getDefaultLanguage());
- } else if (eventSource == text_accessionNumber) {
- getEntity().setAccessionNumber(text_accessionNumber.getText());
+ } else if (eventSource == text_barcode) {
+ getEntity().setBarcode(text_barcode.getText());
} else if (eventSource == text_catalogNumber) {
getEntity().setCatalogNumber(text_catalogNumber.getText());
} else if (eventSource == combo_preservationMethod) {
getEntity().setPreservationMethod(
combo_preservationMethod.getSelection());
} catch (MethodNotSupportedByDerivedUnitTypeException e) {
- StoreUtil
+ AbstractUtility
.errorDialog(
"MethodNotSupportedByDerivedUnitTypeException",
this,
try {
getEntity().setExsiccatum(text_exsicatum.getText());
} catch (Exception e) {
- StoreUtil.error(this.getClass(), e);
+ AbstractUtility.error(this.getClass(), e);
}
}
}