Project

General

Profile

Download (2.42 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2016 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.ui.section.classification;
10

    
11
import java.util.Collection;
12

    
13
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
14
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
15
import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
19

    
20
/**
21
 * @author k.luther
22
 * @date 22.03.2016
23
 *
24
 */
25
public class TaxonNodeAgentRelationCollectionSection extends AbstractEntityCollectionSection<TaxonNode, TaxonNodeAgentRelation> {
26

    
27

    
28

    
29
    public TaxonNodeAgentRelationCollectionSection (CdmFormFactory formFactory, ConversationHolder conversation,
30
            ICdmFormElement parentElement, int style) {
31
        super(formFactory, conversation, parentElement,  "Related persons or teams", style);
32

    
33
    }
34

    
35
    @Override
36
    public String getEmptyString() {
37
        return "No related persons or teams yet.";
38
    }
39

    
40
    @Override
41
    protected String getTooltipString() {
42
        return "Add a new person/team to this taxon node.";
43
    }
44

    
45
    @Override
46
    public Collection<TaxonNodeAgentRelation> getCollection(TaxonNode entity) {
47
        //why Do I have to give the method an entity???
48
       Collection<TaxonNodeAgentRelation> allAgentRelationships = getEntity().getAgentRelations();
49
       return allAgentRelationships;
50
    }
51

    
52
    @Override
53
    public void addElement(TaxonNodeAgentRelation element) {
54

    
55

    
56
    }
57

    
58
    @Override
59
    public void removeElement(TaxonNodeAgentRelation element) {
60
        getEntity().removeNodeAgent(element);
61
      //  CdmStore.getService(ITaxonNodeService.class).deleteAgentrelation(element);
62
    }
63

    
64

    
65
    @Override
66
    public TaxonNodeAgentRelation createNewElement() {
67
        TaxonNodeAgentRelation rel = getEntity().addAgentRelation(null, null);
68
        return rel;
69
    }
70

    
71
    public boolean isComplete(){
72

    
73
        return false;
74
    }
75

    
76
    /**
77
     * {@inheritDoc}
78
     */
79
    @Override
80
    public TaxonNodeAgentRelation addExisting() {
81
        return null;
82
    }
83

    
84
    /**
85
     * {@inheritDoc}
86
     */
87
    @Override
88
    public boolean allowAddExisting() {
89
        return false;
90
    }
91

    
92
}
(9-9/12)