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