add the possibility to add taxonnode agent relations to a taxonnode and to edit a...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / classification / TaxonNodeAgentRelationCollectionSection.java
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, "TaxonNode Agent Relation", style);
40
41 }
42
43
44 /* (non-Javadoc)
45 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
46 */
47 @Override
48 public String getEmptyString() {
49 return "No taxon node agent relations yet.";
50 }
51
52 /* (non-Javadoc)
53 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
54 */
55 @Override
56 protected String getTooltipString() {
57 return "Add a new agent relation to this taxon node.";
58 }
59
60 /* (non-Javadoc)
61 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
62 */
63 @Override
64 public Collection<TaxonNodeAgentRelation> getCollection(TaxonNode entity) {
65 //why Do I have to give the method an entity???
66 Collection<TaxonNodeAgentRelation> allAgentRelationships = getEntity().getAgentRelations();
67 return allAgentRelationships;
68 }
69
70 /* (non-Javadoc)
71 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
72 */
73 @Override
74 public void addElement(TaxonNodeAgentRelation element) {
75
76
77 }
78
79 /* (non-Javadoc)
80 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
81 */
82 @Override
83 public void removeElement(TaxonNodeAgentRelation element) {
84 getEntity().removeNodeAgent(element);
85 // CdmStore.getService(ITaxonNodeService.class).deleteAgentrelation(element);
86 }
87
88
89 /* (non-Javadoc)
90 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
91 */
92 @Override
93 public TaxonNodeAgentRelation createNewElement() {
94 TaxonNodeAgentRelation rel = getEntity().addAgentRelation(null, null);
95 return rel;
96 }
97
98 public boolean isComplete(){
99
100 return false;
101 }
102
103 }