Project

General

Profile

Download (2.45 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.section.description;
12

    
13
import java.util.Collection;
14

    
15
import org.apache.log4j.Logger;
16

    
17
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18
import eu.etaxonomy.cdm.model.description.DescriptionBase;
19
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
20
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
21
import eu.etaxonomy.taxeditor.forms.CdmFormFactory;
22
import eu.etaxonomy.taxeditor.forms.ICdmFormElement;
23
import eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection;
24

    
25
/**
26
 * <p>DescriptionSourceSection class.</p>
27
 *
28
 * @author n.hoffmann
29
 * @created Mar 18, 2010
30
 * @version 1.0
31
 */
32
public class DescriptionSourceSection extends
33
		AbstractEntityCollectionSection<DescriptionBase, ReferenceBase>{
34
	private static final Logger logger = Logger
35
			.getLogger(DescriptionSourceSection.class);
36
	
37
	/**
38
	 * <p>Constructor for DescriptionSourceSection.</p>
39
	 *
40
	 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object.
41
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
42
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
43
	 * @param style a int.
44
	 */
45
	public DescriptionSourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
46
			ICdmFormElement parentElement, int style) {
47
		super(cdmFormFactory, conversation, parentElement, "Description Sources", style);
48
	}
49

    
50
	
51

    
52
	/** {@inheritDoc} */
53
	@Override
54
	public void addElement(ReferenceBase element) {
55
		getEntity().addDescriptionSource(element);
56
	}
57

    
58
	/** {@inheritDoc} */
59
	@Override
60
	public ReferenceBase createNewElement() {
61
		return new ReferenceFactory().newGeneric();
62
	}
63

    
64
	/** {@inheritDoc} */
65
	@Override
66
	public Collection<ReferenceBase> getCollection(DescriptionBase entity) {
67
		return entity.getDescriptionSources();
68
	}
69

    
70
	/** {@inheritDoc} */
71
	@Override
72
	public String getEmptyString() {
73
		return "No description sources yet.";
74
	}
75

    
76
	/** {@inheritDoc} */
77
	@Override
78
	protected String getTooltipString() {
79
		return "Add a reference as source for this description";
80
	}
81

    
82
	/** {@inheritDoc} */
83
	@Override
84
	public void removeElement(ReferenceBase element) {
85
		getEntity().removeDescriptionSource(element);
86
	}
87
}
(11-11/24)