Merge branch 'release/5.19.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / name / HybridDetailSection.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 package eu.etaxonomy.taxeditor.ui.section.name;
10
11 import org.eclipse.jface.viewers.ISelectionProvider;
12
13 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
14 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
15 import eu.etaxonomy.cdm.model.name.TaxonName;
16 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
17 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
20 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
21 import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
22
23 /**
24 * @author n.hoffmann
25 * @created Jan 5, 2011
26 */
27 public class HybridDetailSection
28 extends AbstractCdmDetailSection<TaxonName>
29 implements ITaxonBaseDetailSection {
30
31 private TaxonBase<?> taxonBase;
32
33 public HybridDetailSection(CdmFormFactory formFactory,
34 ConversationHolder conversation, ICdmFormElement parentElement,
35 ISelectionProvider selectionProvider, int style) {
36 super(formFactory, conversation, parentElement, selectionProvider, style);
37 }
38
39 @Override
40 public void setTaxonBase(TaxonBase taxon) {
41 taxonBase = taxon;
42 TaxonName name = HibernateProxyHelper.deproxy(taxon.getName());
43 setEntity(name);
44 }
45
46 @Override
47 public TaxonBase getTaxonBase() {
48 return taxonBase;
49 }
50
51 @Override
52 public String getHeading() {
53 return "Hybrid";
54 }
55
56 @Override
57 protected void setSectionTitle() {
58 setText(getHeading());
59 }
60
61 @Override
62 protected AbstractCdmDetailElement createCdmDetailElement(
63 AbstractCdmDetailSection<TaxonName> parentElement, int style) {
64 //FIXME generic
65 return formFactory.createHybridDetailElement(parentElement);
66 }
67
68 public void updateContent() {
69 ((AbstractCdmDetailElement)this.detailElement).setEntity(getEntity());
70 }
71 }