merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / agent / TeamOrPersonBaseDetailSection.java
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.agent;
12
13 import org.eclipse.jface.viewers.ISelectionProvider;
14
15 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 import eu.etaxonomy.cdm.model.agent.Person;
17 import eu.etaxonomy.cdm.model.agent.Team;
18 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
19 import eu.etaxonomy.taxeditor.model.AbstractUtility;
20 import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
21 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
22 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
23 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
24
25 /**
26 * <p>TeamOrPersonBaseDetailSection class.</p>
27 *
28 * @author n.hoffmann
29 * @created Apr 26, 2010
30 * @version 1.0
31 */
32 public class TeamOrPersonBaseDetailSection extends AbstractCdmDetailSection<TeamOrPersonBase> {
33
34 /**
35 * <p>Constructor for TeamOrPersonBaseDetailSection.</p>
36 *
37 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
38 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
39 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
40 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
41 * @param style a int.
42 */
43 public TeamOrPersonBaseDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
44 ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
45 super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
46 }
47
48 /** {@inheritDoc} */
49 @Override
50 public String getHeading() {
51 if (getEntity() != null){
52 if(getEntity() instanceof Team){
53 return "Team";
54 }else if (getEntity().getClass().isAssignableFrom(Person.class)){
55 return "Person";
56 }
57 }
58 return "Team or Person";
59 }
60
61 /* (non-Javadoc)
62 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
63 */
64 @Override
65 protected AbstractCdmDetailElement<TeamOrPersonBase> createCdmDetailElement(AbstractCdmDetailSection<TeamOrPersonBase> parentElement, int style) {
66 AbstractUtility.error(this.getClass(), "Detail element was not created. Seems like the case was not implemented for TeamOrPersonBaseDetailSection", null);
67 //TODO DetailElement missing??
68 return null;
69 }
70 }