Project

General

Profile

Download (2.3 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2016 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.classification;
11

    
12
import java.util.Collection;
13

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

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

    
28

    
29

    
30
    /**
31
     * @param formFactory
32
     * @param conversation
33
     * @param parentElement
34

    
35
     * @param style
36
     */
37
    public TaxonNodeAgentRelationCollectionSection (CdmFormFactory formFactory, ConversationHolder conversation,
38
            ICdmFormElement parentElement, int style) {
39
        super(formFactory, conversation, parentElement,  "Related persons or teams", style);
40

    
41
    }
42

    
43
    @Override
44
    public String getEmptyString() {
45
        return "No related persons or teams yet.";
46
    }
47

    
48
    @Override
49
    protected String getTooltipString() {
50
        return "Add a new person/team to this taxon node.";
51
    }
52

    
53
    @Override
54
    public Collection<TaxonNodeAgentRelation> getCollection(TaxonNode entity) {
55
        //why Do I have to give the method an entity???
56
       Collection<TaxonNodeAgentRelation> allAgentRelationships = getEntity().getAgentRelations();
57
       return allAgentRelationships;
58
    }
59

    
60
    @Override
61
    public void addElement(TaxonNodeAgentRelation element) {
62

    
63

    
64
    }
65

    
66
    @Override
67
    public void removeElement(TaxonNodeAgentRelation element) {
68
        getEntity().removeNodeAgent(element);
69
      //  CdmStore.getService(ITaxonNodeService.class).deleteAgentrelation(element);
70
    }
71

    
72

    
73
    @Override
74
    public TaxonNodeAgentRelation createNewElement() {
75
        TaxonNodeAgentRelation rel = getEntity().addAgentRelation(null, null);
76
        return rel;
77
    }
78

    
79
    public boolean isComplete(){
80

    
81
        return false;
82
    }
83

    
84
}
(9-9/12)