Project

General

Profile

Download (2.23 KB) Statistics
| Branch: | Tag: | Revision:
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.description.PolytomousKey;
16
import eu.etaxonomy.cdm.model.location.NamedArea;
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
 *
24
 * @author pplitzner
25
 * @date Sep 21, 2015
26
 *
27
 */
28
public class GeoScopePolyKeyDetailSection extends AbstractEntityCollectionSection<PolytomousKey, NamedArea> {
29

    
30
    public GeoScopePolyKeyDetailSection(CdmFormFactory formFactory,
31
			ConversationHolder conversation, ICdmFormElement parentElement, int style) {
32
		super(formFactory, conversation, parentElement, "Geo Scopes", style);
33
	}
34

    
35
	/** {@inheritDoc} */
36
	@Override
37
	public Collection<NamedArea> getCollection(PolytomousKey entity) {
38
		return entity.getGeographicalScope();
39
	}
40

    
41
	/** {@inheritDoc} */
42
	@Override
43
	public NamedArea createNewElement() {
44
		NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null, PolytomousKey.class.getCanonicalName());
45

    
46
		return selection;
47
	}
48

    
49
	/** {@inheritDoc} */
50
	@Override
51
	public void addElement(NamedArea element) {
52
		getEntity().addGeographicalScope(element);
53
	}
54

    
55
	/** {@inheritDoc} */
56
	@Override
57
	public void removeElement(NamedArea element) {
58
		getEntity().removeGeographicalScope(element);
59
	}
60

    
61
	/** {@inheritDoc} */
62
	@Override
63
	public String getEmptyString() {
64
		return "No geo scopes yet.";
65
	}
66

    
67
	/** {@inheritDoc} */
68
	@Override
69
	protected String getTooltipString() {
70
		return "Add a geo scope";
71
	}
72

    
73
    /**
74
     * {@inheritDoc}
75
     */
76
    @Override
77
    public NamedArea addExisting() {
78
        return null;
79
    }
80

    
81
    /**
82
     * {@inheritDoc}
83
     */
84
    @Override
85
    public boolean allowAddExisting() {
86
        return false;
87
    }
88

    
89
}
(28-28/36)