Project

General

Profile

Download (2.64 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
import java.util.Comparator;
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
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
21

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

    
29

    
30

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

    
35
    }
36

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

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

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

    
54
    @Override
55
    public Comparator<TaxonNodeAgentRelation> getComparator() {
56
        return new DefaultCdmBaseComparator<>();
57
    }
58

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

    
62

    
63
    }
64

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

    
71

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

    
78
    public boolean isComplete(){
79

    
80
        return false;
81
    }
82

    
83
    /**
84
     * {@inheritDoc}
85
     */
86
    @Override
87
    public TaxonNodeAgentRelation addExisting() {
88
        return null;
89
    }
90

    
91
    /**
92
     * {@inheritDoc}
93
     */
94
    @Override
95
    public boolean allowAddExisting() {
96
        return false;
97
    }
98

    
99
}
(9-9/12)