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
.Amplification
;
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 AmplificationGelPhotoCollectionDetailSection
extends AbstractEntityCollectionSection
<Amplification
, Media
> {
32 * @param parentElement
36 public AmplificationGelPhotoCollectionDetailSection(CdmFormFactory formFactory
, ConversationHolder conversation
,
37 ICdmFormElement parentElement
, int style
) {
38 super(formFactory
, conversation
, parentElement
, "Gel Photo", style
);
44 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
47 public Collection
<Media
> getCollection(Amplification entity
) {
48 if(entity
.getGelPhoto()!=null){
49 return Collections
.singleton(entity
.getGelPhoto());
51 return Collections
.EMPTY_LIST
;
55 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
58 public Media
createNewElement() {
59 if(getEntity().getGelPhoto()==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().getGelPhoto()==null){
71 getEntity().setGelPhoto(element
);
77 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
80 public void removeElement(Media element
) {
81 getEntity().setGelPhoto(null);
85 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
88 public String
getEmptyString() {
89 return "No gel photos yet";
93 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
96 protected String
getTooltipString() {
97 return "Add a gel photo";