(no commit message)
[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.apache.log4j.Logger;
14 import org.eclipse.jface.viewers.ISelectionProvider;
15
16 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
17 import eu.etaxonomy.cdm.model.agent.Person;
18 import eu.etaxonomy.cdm.model.agent.Team;
19 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
20 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
21 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
22 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
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 private static final Logger logger = Logger
35 .getLogger(TeamOrPersonBaseDetailSection.class);
36
37 /**
38 * <p>Constructor for TeamOrPersonBaseDetailSection.</p>
39 *
40 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
41 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
42 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
43 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
44 * @param style a int.
45 */
46 public TeamOrPersonBaseDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
47 ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
48 super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
49 }
50
51 /** {@inheritDoc} */
52 @Override
53 protected DetailType getDetailType() {
54 return DetailType.TEAMORPERSONBASE;
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 public String getHeading() {
60 if (getEntity() != null){
61 if(getEntity() instanceof Team){
62 return "Team";
63 }else if (getEntity().getClass().isAssignableFrom(Person.class)){
64 return "Person";
65 }
66 }
67 return "Team or Person";
68 }
69 }