Project

General

Profile

Download (3.64 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
import java.util.Comparator;
14

    
15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16
import eu.etaxonomy.cdm.model.location.NamedArea;
17
import eu.etaxonomy.cdm.model.taxon.Classification;
18
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
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;
23

    
24
/**
25
 * <p>
26
 * CollectingAreasDetailSection class.
27
 * </p>
28
 *
29
 * @author n.hoffmann
30
 * @created Oct 14, 2010
31
 * @version 1.0
32
 */
33
public class GeoScopeDetailSection extends AbstractEntityCollectionSection<Classification, NamedArea> {
34

    
35
	/**
36
	 * <p>Constructor for CollectingAreasDetailSection.</p>
37
	 *
38
	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
39
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
40
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
41
	 * @param style a int.
42
	 */
43
	public GeoScopeDetailSection(CdmFormFactory formFactory,
44
			ConversationHolder conversation, ICdmFormElement parentElement, int style) {
45
		super(formFactory, conversation, parentElement, "Geo Scopes", style);
46
	}
47

    
48
	/* (non-Javadoc)
49
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
50
	 */
51
	/** {@inheritDoc} */
52
	@Override
53
	public Collection<NamedArea> getCollection(Classification entity) {
54
		return entity.getGeoScopes();
55
	}
56

    
57
	@Override
58
	public Comparator<NamedArea> getComparator() {
59
        return new DefaultCdmBaseComparator<>();
60
	}
61

    
62
	/* (non-Javadoc)
63
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
64
	 */
65
	/** {@inheritDoc} */
66
	@Override
67
	public NamedArea createNewElement() {
68
		NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), //getConversationHolder(),
69
		        null, Classification.class.getCanonicalName());
70

    
71
		return selection;
72
	}
73

    
74
	/* (non-Javadoc)
75
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
76
	 */
77
	/** {@inheritDoc} */
78
	@Override
79
	public void addElement(NamedArea element) {
80
		getEntity().addGeoScope(element);
81
	}
82

    
83
	/* (non-Javadoc)
84
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
85
	 */
86
	/** {@inheritDoc} */
87
	@Override
88
	public void removeElement(NamedArea element) {
89
		getEntity().removeGeoScope(element);
90
	}
91

    
92
	/* (non-Javadoc)
93
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
94
	 */
95
	/** {@inheritDoc} */
96
	@Override
97
	public String getEmptyString() {
98
		return "No geo scopes yet.";
99
	}
100

    
101
	/* (non-Javadoc)
102
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
103
	 */
104
	/** {@inheritDoc} */
105
	@Override
106
	protected String getTooltipString() {
107
		return "Add a geo scope";
108
	}
109

    
110
    /**
111
     * {@inheritDoc}
112
     */
113
    @Override
114
    public NamedArea addExisting() {
115
        return null;
116
    }
117

    
118
    /**
119
     * {@inheritDoc}
120
     */
121
    @Override
122
    public boolean allowAddExisting() {
123
        // TODO Auto-generated method stub
124
        return false;
125
    }
126

    
127
}
(30-30/36)