1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.taxeditor.ui.section.occurrence;
|
11
|
|
12
|
import java.util.Collection;
|
13
|
|
14
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
15
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
16
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
17
|
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
21
|
|
22
|
/**
|
23
|
* <p>
|
24
|
* CollectingAreasDetailSection class.
|
25
|
* </p>
|
26
|
*
|
27
|
* @author n.hoffmann
|
28
|
* @created Oct 14, 2010
|
29
|
* @version 1.0
|
30
|
*/
|
31
|
public class GeoScopeDetailSection extends AbstractEntityCollectionSection<Classification, NamedArea> {
|
32
|
|
33
|
/**
|
34
|
* <p>Constructor for CollectingAreasDetailSection.</p>
|
35
|
*
|
36
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
37
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
38
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
39
|
* @param style a int.
|
40
|
*/
|
41
|
public GeoScopeDetailSection(CdmFormFactory formFactory,
|
42
|
ConversationHolder conversation, ICdmFormElement parentElement, int style) {
|
43
|
super(formFactory, conversation, parentElement, "Geo Scopes", style);
|
44
|
}
|
45
|
|
46
|
/* (non-Javadoc)
|
47
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
|
48
|
*/
|
49
|
/** {@inheritDoc} */
|
50
|
@Override
|
51
|
public Collection<NamedArea> getCollection(Classification entity) {
|
52
|
return entity.getGeoScopes();
|
53
|
}
|
54
|
|
55
|
/* (non-Javadoc)
|
56
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
|
57
|
*/
|
58
|
/** {@inheritDoc} */
|
59
|
@Override
|
60
|
public NamedArea createNewElement() {
|
61
|
NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null, Classification.class.getCanonicalName());
|
62
|
|
63
|
return selection;
|
64
|
}
|
65
|
|
66
|
/* (non-Javadoc)
|
67
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
68
|
*/
|
69
|
/** {@inheritDoc} */
|
70
|
@Override
|
71
|
public void addElement(NamedArea element) {
|
72
|
getEntity().addGeoScope(element);
|
73
|
}
|
74
|
|
75
|
/* (non-Javadoc)
|
76
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
77
|
*/
|
78
|
/** {@inheritDoc} */
|
79
|
@Override
|
80
|
public void removeElement(NamedArea element) {
|
81
|
getEntity().removeGeoScope(element);
|
82
|
}
|
83
|
|
84
|
/* (non-Javadoc)
|
85
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
|
86
|
*/
|
87
|
/** {@inheritDoc} */
|
88
|
@Override
|
89
|
public String getEmptyString() {
|
90
|
return "No geo scopes yet.";
|
91
|
}
|
92
|
|
93
|
/* (non-Javadoc)
|
94
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
|
95
|
*/
|
96
|
/** {@inheritDoc} */
|
97
|
@Override
|
98
|
protected String getTooltipString() {
|
99
|
return "Add a geo scope";
|
100
|
}
|
101
|
|
102
|
/**
|
103
|
* {@inheritDoc}
|
104
|
*/
|
105
|
@Override
|
106
|
public NamedArea addExisting() {
|
107
|
return null;
|
108
|
}
|
109
|
|
110
|
/**
|
111
|
* {@inheritDoc}
|
112
|
*/
|
113
|
@Override
|
114
|
public boolean allowAddExisting() {
|
115
|
// TODO Auto-generated method stub
|
116
|
return false;
|
117
|
}
|
118
|
|
119
|
}
|