77808b23d48950f7a7534cdbee30827db98923b7
[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.ui.element.CdmFormFactory;
20 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
21 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
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 protected DetailType getDetailType() {
50 return DetailType.TEAMORPERSONBASE;
51 }
52
53 /** {@inheritDoc} */
54 @Override
55 public String getHeading() {
56 if (getEntity() != null){
57 if(getEntity() instanceof Team){
58 return "Team";
59 }else if (getEntity().getClass().isAssignableFrom(Person.class)){
60 return "Person";
61 }
62 }
63 return "Team or Person";
64 }
65 }