Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / classification / TaxonNodeAgentRelationCollectionSection.java
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 /**
30 * @param formFactory
31 * @param conversation
32 * @param parentElement
33
34 * @param style
35 */
36 public TaxonNodeAgentRelationCollectionSection (CdmFormFactory formFactory, ConversationHolder conversation,
37 ICdmFormElement parentElement, int style) {
38 super(formFactory, conversation, parentElement, "Related persons or teams", style);
39
40 }
41
42 @Override
43 public String getEmptyString() {
44 return "No related persons or teams yet.";
45 }
46
47 @Override
48 protected String getTooltipString() {
49 return "Add a new person/team to this taxon node.";
50 }
51
52 @Override
53 public Collection<TaxonNodeAgentRelation> getCollection(TaxonNode entity) {
54 //why Do I have to give the method an entity???
55 Collection<TaxonNodeAgentRelation> allAgentRelationships = getEntity().getAgentRelations();
56 return allAgentRelationships;
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 }