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.reference;
|
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.TaxonNameBase;
|
18
|
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
|
19
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
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
|
import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.ICdmFormElement;
|
25
|
|
26
|
/**
|
27
|
* <p>NomenclaturalReferenceDetailSection class.</p>
|
28
|
*
|
29
|
* @author n.hoffmann
|
30
|
* @created Mar 12, 2010
|
31
|
* @version 1.0
|
32
|
*/
|
33
|
public class NomenclaturalReferenceDetailSection extends
|
34
|
AbstractCdmDetailSection<TaxonNameBase> implements ITaxonBaseDetailSection{
|
35
|
|
36
|
private TaxonBase taxonBase;
|
37
|
|
38
|
/**
|
39
|
* <p>Constructor for NomenclaturalReferenceDetailSection.</p>
|
40
|
*
|
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 parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
44
|
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
|
45
|
* @param style a int.
|
46
|
*/
|
47
|
public NomenclaturalReferenceDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
|
48
|
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
|
49
|
super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
|
50
|
}
|
51
|
|
52
|
/** {@inheritDoc} */
|
53
|
@Override
|
54
|
public String getHeading() {
|
55
|
return "Nomenclatural Reference";
|
56
|
}
|
57
|
|
58
|
/** {@inheritDoc} */
|
59
|
@Override
|
60
|
public void setTaxonBase(TaxonBase entity) {
|
61
|
this.taxonBase = entity;
|
62
|
TaxonNameBase name = (TaxonNameBase) HibernateProxyHelper.deproxy(entity.getName());
|
63
|
setEntity(name);
|
64
|
}
|
65
|
|
66
|
/** {@inheritDoc} */
|
67
|
@Override
|
68
|
protected void setSectionTitle() {
|
69
|
String title = "";
|
70
|
if(getEntity() != null && getEntity().getNomenclaturalReference() != null){
|
71
|
INomenclaturalReference reference = getEntity().getNomenclaturalReference();
|
72
|
String nomenclaturalCitation = reference.getNomenclaturalCitation(getEntity().getNomenclaturalMicroReference());
|
73
|
title = ": " + nomenclaturalCitation;
|
74
|
}
|
75
|
this.setText(getHeading() + title);
|
76
|
}
|
77
|
|
78
|
/* (non-Javadoc)
|
79
|
* @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
|
80
|
*/
|
81
|
@Override
|
82
|
public TaxonBase getTaxonBase() {
|
83
|
return taxonBase;
|
84
|
}
|
85
|
|
86
|
/* (non-Javadoc)
|
87
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
|
88
|
*/
|
89
|
@Override
|
90
|
protected AbstractCdmDetailElement<TaxonNameBase> createCdmDetailElement(AbstractCdmDetailSection<TaxonNameBase> parentElement, int style) {
|
91
|
return formFactory.createNomenclaturalReferenceDetailElement(parentElement, style);
|
92
|
}
|
93
|
}
|