3 * Copyright (C) 2014 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.
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
.media
.Media
;
17 import eu
.etaxonomy
.cdm
.model
.molecular
.SingleRead
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
27 public class SingleReadPherogramCollectionDetailSection
extends AbstractEntityCollectionSection
<SingleRead
, Media
> {
32 * @param parentElement
36 public SingleReadPherogramCollectionDetailSection(CdmFormFactory formFactory
, ConversationHolder conversation
,
37 ICdmFormElement parentElement
, int style
) {
38 super(formFactory
, conversation
, parentElement
, "Read Chromatogram", style
);
44 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
47 public Collection
<Media
> getCollection(SingleRead entity
) {
48 if(entity
.getPherogram()!=null){
49 return Collections
.singleton(entity
.getPherogram());
51 return Collections
.EMPTY_LIST
;
55 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
58 public Media
createNewElement() {
59 if(getEntity().getPherogram()==null){
60 return Media
.NewInstance();
66 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
69 public void addElement(Media element
) {
70 if(getEntity().getPherogram()==null){
71 getEntity().setPherogram(element
);
76 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
79 public void removeElement(Media element
) {
80 getEntity().setPherogram(null);
84 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
87 public String
getEmptyString() {
88 return "No read chromatogram yet";
92 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
95 protected String
getTooltipString() {
96 return "Add a read chromatogram";