Project

General

Profile

Download (3.26 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 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

    
11
package eu.etaxonomy.taxeditor.ui.section.occurrence;
12

    
13
import java.util.Collection;
14

    
15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
17
import eu.etaxonomy.cdm.model.location.NamedArea;
18
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
19
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
20
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
21
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
22
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
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 CollectingAreasDetailSection extends AbstractEntityCollectionSection<DerivedUnitFacade, 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 CollectingAreasDetailSection(CdmFormFactory formFactory,
44
			ConversationHolder conversation, ICdmFormElement parentElement, int style) {
45
		super(formFactory, conversation, parentElement, "Collecting Areas", 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(DerivedUnitFacade entity) {
54
		return entity.getCollectingAreas();
55
	}
56

    
57
	/* (non-Javadoc)
58
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
59
	 */
60
	/** {@inheritDoc} */
61
	@Override
62
	public NamedArea createNewElement() {
63
		NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null, FieldUnit.class.getCanonicalName());
64

    
65
		return selection;
66
	}
67

    
68
	/* (non-Javadoc)
69
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
70
	 */
71
	/** {@inheritDoc} */
72
	@Override
73
	public void addElement(NamedArea element) {
74
		getEntity().addCollectingArea(element);
75
	}
76

    
77
	/* (non-Javadoc)
78
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
79
	 */
80
	/** {@inheritDoc} */
81
	@Override
82
	public void removeElement(NamedArea element) {
83
		getEntity().removeCollectingArea(element);
84
	}
85

    
86
	/* (non-Javadoc)
87
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
88
	 */
89
	/** {@inheritDoc} */
90
	@Override
91
	public String getEmptyString() {
92
		return "No collecting areas yet.";
93
	}
94

    
95
	/* (non-Javadoc)
96
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
97
	 */
98
	/** {@inheritDoc} */
99
	@Override
100
	protected String getTooltipString() {
101
		return "Add a collecting area";
102
	}
103

    
104
}
(3-3/36)