revert ZOnedDateTime to joda.DateTime
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / reference / NomenclaturalReferenceDetailSection.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor.ui.section.reference;
11
12 import org.eclipse.jface.viewers.ISelectionProvider;
13
14 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
16 import eu.etaxonomy.cdm.model.name.TaxonName;
17 import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
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>NomenclaturalReferenceDetailSection class.</p>
27 *
28 * @author n.hoffmann
29 * @created Mar 12, 2010
30 */
31 public class NomenclaturalReferenceDetailSection extends
32 AbstractCdmDetailSection<TaxonName> implements ITaxonBaseDetailSection{
33
34 private TaxonBase taxonBase;
35
36 /**
37 * <p>Constructor for NomenclaturalReferenceDetailSection.</p>
38 *
39 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
40 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
41 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
42 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
43 * @param style a int.
44 */
45 public NomenclaturalReferenceDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
46 ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
47 super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
48 }
49
50 /** {@inheritDoc} */
51 @Override
52 public String getHeading() {
53 return "Nomenclatural Reference";
54 }
55
56 /** {@inheritDoc} */
57 @Override
58 public void setTaxonBase(TaxonBase entity) {
59 this.taxonBase = entity;
60 TaxonName name = (TaxonName) HibernateProxyHelper.deproxy(entity.getName());
61 setEntity(name);
62 }
63
64 /** {@inheritDoc} */
65 @Override
66 protected void setSectionTitle() {
67 String title = "";
68 if(getEntity() != null && getEntity().getNomenclaturalReference() != null){
69 INomenclaturalReference reference = getEntity().getNomenclaturalReference();
70 String nomenclaturalCitation = reference.getNomenclaturalCitation(getEntity().getNomenclaturalMicroReference());
71 title = ": " + nomenclaturalCitation;
72 }
73 this.setText(getHeading() + title);
74 }
75
76 @Override
77 public TaxonBase getTaxonBase() {
78 return taxonBase;
79 }
80
81 @Override
82 protected AbstractCdmDetailElement<TaxonName> createCdmDetailElement(
83 AbstractCdmDetailSection<TaxonName> parentElement, int style) {
84 return formFactory.createNomenclaturalReferenceDetailElement(parentElement, style);
85 }
86 }