- completely removed DetailType enum and all its uses
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / name / AuthorshipDetailSection.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.name;
12
13 import org.eclipse.jface.viewers.ISelectionProvider;
14
15 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
17 import eu.etaxonomy.cdm.model.name.NonViralName;
18 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
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 import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
24
25 /**
26 * <p>AuthorshipDetailSection class.</p>
27 *
28 * @author n.hoffmann
29 * @created 05.06.2009
30 * @version 1.0
31 */
32 public class AuthorshipDetailSection extends AbstractCdmDetailSection<NonViralName> implements ITaxonBaseDetailSection {
33
34 private TaxonBase taxonBase;
35
36 /**
37 * <p>Constructor for AuthorshipDetailSection.</p>
38 *
39 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
40 * @param style a int.
41 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
42 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
43 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
44 */
45 public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
46 ISelectionProvider selectionProvider, int style) {
47 super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
48 }
49
50 /**
51 * {@inheritDoc}
52 *
53 * Author title is not in titleCache field
54 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#setSectionTitle()
55 */
56 @Override
57 protected void setSectionTitle() {
58 if(getEntity() != null){
59 this.setText(getHeading() + ": " + getEntity().getAuthorshipCache());
60 }
61 }
62
63 /** {@inheritDoc} */
64 @Override
65 public void setTaxonBase(TaxonBase entity) {
66 this.taxonBase = entity;
67 NonViralName name = (NonViralName) HibernateProxyHelper.deproxy(entity.getName());
68 setEntity(name);
69 }
70
71 /*
72 * (non-Javadoc)
73 * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractCdmDetailSection#getHeading()
74 */
75 /** {@inheritDoc} */
76 @Override
77 public String getHeading() {
78 return "Authorship";
79 }
80
81 /* (non-Javadoc)
82 * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
83 */
84 @Override
85 public TaxonBase getTaxonBase() {
86 return taxonBase;
87 }
88
89 /* (non-Javadoc)
90 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
91 */
92 @Override
93 protected AbstractCdmDetailElement<NonViralName> createCdmDetailElement(AbstractCdmDetailSection<NonViralName> parentElement, int style) {
94 return formFactory.createAuthorshipDetailElement(parentElement, style);
95 }
96
97 }