3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.ui
.section
.description
;
13 import java
.util
.ArrayList
;
14 import java
.util
.Collection
;
15 import java
.util
.List
;
17 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
18 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
19 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
20 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
21 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.compatibility
.ICdmFormElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.DerivedUnitSelectionDialog
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
27 * <p>DescribedSpecimenSection class.</p>
30 * @created Sep 16, 2010
33 public class DescribedSpecimenSection
extends AbstractEntityCollectionSection
<TaxonDescription
, SpecimenOrObservationBase
> {
36 * <p>Constructor for DescribedSpecimenSection.</p>
38 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
39 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
40 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
43 public DescribedSpecimenSection(CdmFormFactory formFactory
,
44 ConversationHolder conversation
, ICdmFormElement parentElement
,
46 super(formFactory
, conversation
, parentElement
, "Described Specimen", style
);
51 public Collection
<SpecimenOrObservationBase
> getCollection(
52 TaxonDescription entity
) {
53 //FIXME:This class is not really an entity collection section, and should be moved
54 // to a single entity section, but one with the possibility of launching a wizard
55 List
<SpecimenOrObservationBase
> collection
= new ArrayList
<SpecimenOrObservationBase
>();
56 if(entity
.getDescribedSpecimenOrObservation() != null) {
57 collection
.add(entity
.getDescribedSpecimenOrObservation());
64 public SpecimenOrObservationBase
createNewElement() {
65 DerivedUnit selection
= DerivedUnitSelectionDialog
.select(getShell(), getConversationHolder(), null);
71 public void addElement(SpecimenOrObservationBase element
) {
72 getEntity().setDescribedSpecimenOrObservation(element
);
77 public void removeElement(SpecimenOrObservationBase element
) {
78 getEntity().setDescribedSpecimenOrObservation(null);
83 public String
getEmptyString() {
84 return "No described specimen yet.";
89 protected String
getTooltipString() {
90 return "Add a described specimen.";