Remove identifier and taxon associations from bulk editor details view
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / dna / AmplificationGelPhotoCollectionDetailSection.java
1 // $Id$
2 /**
3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
11
12 import java.util.Collection;
13 import java.util.Collections;
14
15 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 import eu.etaxonomy.cdm.model.media.Media;
17 import eu.etaxonomy.cdm.model.molecular.AmplificationResult;
18 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
21
22 /**
23 * @author pplitzner
24 * @date 26.02.2014
25 *
26 */
27 public class AmplificationGelPhotoCollectionDetailSection extends AbstractEntityCollectionSection<AmplificationResult, Media> {
28
29 /**
30 * @param formFactory
31 * @param conversation
32 * @param parentElement
33 * @param title
34 * @param style
35 */
36 public AmplificationGelPhotoCollectionDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
37 ICdmFormElement parentElement, int style) {
38 super(formFactory, conversation, parentElement, "Gel Photo", style);
39 }
40
41
42
43 /* (non-Javadoc)
44 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
45 */
46 @Override
47 public Collection<Media> getCollection(AmplificationResult entity) {
48 if(entity.getGelPhoto()!=null){
49 return Collections.singleton(entity.getGelPhoto());
50 }
51 return Collections.EMPTY_LIST;
52 }
53
54 /* (non-Javadoc)
55 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
56 */
57 @Override
58 public Media createNewElement() {
59 if(getEntity().getGelPhoto()==null){
60 return Media.NewInstance();
61 }
62 return null;
63 }
64
65 /* (non-Javadoc)
66 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
67 */
68 @Override
69 public void addElement(Media element) {
70 if(getEntity().getGelPhoto()==null){
71 getEntity().setGelPhoto(element);
72 }
73
74 }
75
76 /* (non-Javadoc)
77 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
78 */
79 @Override
80 public void removeElement(Media element) {
81 getEntity().setGelPhoto(null);
82 }
83
84 /* (non-Javadoc)
85 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
86 */
87 @Override
88 public String getEmptyString() {
89 return "No gel photo yet";
90 }
91
92 /* (non-Javadoc)
93 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
94 */
95 @Override
96 protected String getTooltipString() {
97 return "Add a gel photo";
98 }
99
100 }