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