Project

General

Profile

Download (2.45 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.agent;
11

    
12
import org.eclipse.jface.viewers.ISelectionProvider;
13

    
14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.model.agent.Person;
16
import eu.etaxonomy.cdm.model.agent.Team;
17
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
18
import eu.etaxonomy.taxeditor.model.MessagingUtils;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
22
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
23

    
24
/**
25
 * <p>TeamOrPersonBaseDetailSection class.</p>
26
 *
27
 * @author n.hoffmann
28
 * @created Apr 26, 2010
29
 * @version 1.0
30
 */
31
public class TeamOrPersonBaseDetailSection extends AbstractCdmDetailSection<TeamOrPersonBase> {
32

    
33
	/**
34
	 * <p>Constructor for TeamOrPersonBaseDetailSection.</p>
35
	 *
36
	 * @param cdmFormFactory 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 selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
40
	 * @param style a int.
41
	 */
42
	public TeamOrPersonBaseDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
43
			ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
44
		super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
45
	}
46

    
47
	/** {@inheritDoc} */
48
	@Override
49
	public String getHeading() {
50
		if (getEntity() != null){
51
			if(getEntity().getClass().isAssignableFrom(Team.class)){
52
				return "Team";
53
			}else if (getEntity().getClass().isAssignableFrom(Person.class)){
54
				return "Person";
55
			}
56
		}
57
		return "Team or Person";
58
	}
59

    
60
	@Override
61
	protected AbstractCdmDetailElement<TeamOrPersonBase> createCdmDetailElement(AbstractCdmDetailSection<TeamOrPersonBase> parentElement, int style) {
62
	    MessagingUtils.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for TeamOrPersonBaseDetailSection", null);
63
	    //TODO DetailElement missing??
64
	    return null;
65
	}
66
}
(11-11/12)