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
.occurrence
.dna
;
12 import java
.util
.Collection
;
13 import java
.util
.Collections
;
15 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
16 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
17 import eu
.etaxonomy
.cdm
.model
.common
.Identifier
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.view
.derivateSearch
.DerivateLabelProvider
;
28 public class CurrentSampleDesignationDetailSection
extends AbstractSampleDesignationDetailSection
{
30 public CurrentSampleDesignationDetailSection(CdmFormFactory formFactory
,
31 ConversationHolder conversation
, ICdmFormElement parentElement
,
33 super(formFactory
, conversation
, parentElement
, "Current Sample Designation", style
);
37 public void refresh() {
38 internalUpdateSection(false);
42 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
45 public Collection
<Identifier
> getCollection(IdentifiableEntity
<?
> entity
) {
46 Identifier currentSampleDesignation
= DerivateLabelProvider
.getCurrentSampleDesignation(entity
);
47 if(currentSampleDesignation
!=null){
48 return Collections
.singleton(currentSampleDesignation
);
51 return Collections
.emptyList();
56 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
60 protected String
getTooltipString() {
61 return "Create new current sample designation";
65 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
69 public void addElement(Identifier sampleDesignation
) {
70 //The current sample designation is always the first one found.
71 //The following are recent sample designations with the most recent being
72 //the second one found and so on
73 getEntity().addIdentifier(0, sampleDesignation
);