Project

General

Profile

Download (2.85 KB) Statistics
| Branch: | Tag: | Revision:
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

    
14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.model.molecular.Sequence;
16
import eu.etaxonomy.cdm.model.reference.Reference;
17
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20

    
21
/**
22
 * This section visualizes {@link Reference}s belonging to a {@link Sequence} and alllows adding/removing them.
23
 * @author pplitzner
24
 * @date 07.01.2014
25
 *
26
 */
27
public class SequenceReferenceCollectionDetailSection extends AbstractUnboundEntityCollectionSection<Sequence, Reference> {
28

    
29
    public SequenceReferenceCollectionDetailSection(CdmFormFactory formFactory,
30
            ConversationHolder conversation, ICdmFormElement parentElement, int style) {
31
        super(formFactory, conversation, parentElement, "References", style);
32
    }
33

    
34
    /* (non-Javadoc)
35
     * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
36
     */
37
    /** {@inheritDoc} */
38
    @Override
39
    protected Collection<Reference> getEntityCollection(Sequence entity) {
40
        return entity.getCitations();
41
    }
42

    
43
    /* (non-Javadoc)
44
     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
45
     */
46
    /** {@inheritDoc} */
47
    @Override
48
    public Reference createNewElement() {
49
        return ReferenceFactory.newGeneric();
50
    }
51

    
52
    /* (non-Javadoc)
53
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
54
     */
55
    /** {@inheritDoc} */
56
    @Override
57
    public void addElement(Reference element) {
58
        //never gets called
59
    }
60

    
61
    /* (non-Javadoc)
62
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
63
     */
64
    /** {@inheritDoc} */
65
    @Override
66
    public void removeElement(Reference element) {
67
        getEntity().removeCitation(element);
68
    }
69

    
70
    /* (non-Javadoc)
71
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
72
     */
73
    /** {@inheritDoc} */
74
    @Override
75
    public String getEmptyString() {
76
        return "No references yet.";
77
    }
78

    
79
    /* (non-Javadoc)
80
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
81
     */
82
    /** {@inheritDoc} */
83
    @Override
84
    protected String getTooltipString() {
85
        return "Add a reference";
86
    }
87

    
88

    
89
}
(27-27/32)