2 * Copyright (C) 2016 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.ui
.section
.classification
;
11 import java
.util
.Collection
;
12 import java
.util
.Comparator
;
14 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
16 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNodeAgentRelation
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionSection
;
22 import eu
.etaxonomy
.taxeditor
.ui
.section
.DefaultCdmBaseComparator
;
29 public class TaxonNodeAgentRelationCollectionSection
extends AbstractEntityCollectionSection
<TaxonNode
, TaxonNodeAgentRelation
> {
33 public TaxonNodeAgentRelationCollectionSection (CdmFormFactory formFactory
, ConversationHolder conversation
,
34 ICdmFormElement parentElement
, int style
) {
35 super(formFactory
, conversation
, parentElement
, "Related persons or teams", style
);
40 public String
getEmptyString() {
41 return "No related persons or teams yet.";
45 protected String
getTooltipString() {
46 return "Add a new person/team to this taxon node.";
50 public Collection
<TaxonNodeAgentRelation
> getCollection(TaxonNode entity
) {
51 //why Do I have to give the method an entity???
52 Collection
<TaxonNodeAgentRelation
> allAgentRelationships
= getEntity().getAgentRelations();
53 return allAgentRelationships
;
57 public Comparator
<TaxonNodeAgentRelation
> getComparator() {
58 return new DefaultCdmBaseComparator
<>();
62 public void addElement(TaxonNodeAgentRelation element
) {
68 public void removeElement(TaxonNodeAgentRelation element
) {
69 getEntity().removeAgentRelation(element
);
70 // CdmStore.getService(ITaxonNodeService.class).deleteAgentrelation(element);
75 public TaxonNodeAgentRelation
createNewElement() {
76 TaxonNodeAgentRelation rel
= getEntity().addAgentRelation(null, null);
80 public boolean isComplete(){
89 public TaxonNodeAgentRelation
addExisting() {
97 public boolean allowAddExisting() {
104 public void setIndent(int i
) {
105 TableWrapData tableWrapData
= (TableWrapData
)getLayoutData();
106 if (tableWrapData
== null){
107 tableWrapData
= new TableWrapData();
109 tableWrapData
.indent
= i
;
110 setLayoutData(tableWrapData
);