-// $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.description;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
int style) {
super(formFactory, conversation, parentElement, "Described Specimen", style);
}
-
+
/** {@inheritDoc} */
@Override
public Collection<SpecimenOrObservationBase> getCollection(
TaxonDescription entity) {
- return entity.getDescribedSpecimenOrObservations();
+ //FIXME:This class is not really an entity collection section, and should be moved
+ // to a single entity section, but one with the possibility of launching a wizard
+ List<SpecimenOrObservationBase> collection = new ArrayList<SpecimenOrObservationBase>();
+ if(entity.getDescribedSpecimenOrObservation() != null) {
+ collection.add(entity.getDescribedSpecimenOrObservation());
+ }
+ return collection;
}
/** {@inheritDoc} */
/** {@inheritDoc} */
@Override
public void addElement(SpecimenOrObservationBase element) {
- getEntity().addDescribedSpecimenOrObservation(element);
+ getEntity().setDescribedSpecimenOrObservation(element);
}
/** {@inheritDoc} */
@Override
public void removeElement(SpecimenOrObservationBase element) {
- getEntity().removeDescribedSpecimenOrObservation(element);
+ getEntity().setDescribedSpecimenOrObservation(null);
}
/** {@inheritDoc} */
protected String getTooltipString() {
return "Add a described specimen.";
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SpecimenOrObservationBase addExisting() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean allowAddExisting() {
+ return false;
+ }
}