6329af4b4c1364a60f302ca94cbbdbc4caafc31b
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / taxon / TaxonBaseDetailSection.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.taxon;
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.taxon.TaxonBase;
18 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
19 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
20 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
21 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
22 import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
23
24 /**
25 * <p>TaxonBaseDetailSection class.</p>
26 *
27 * @author n.hoffmann
28 * @created Nov 4, 2009
29 * @version 1.0
30 */
31 public class TaxonBaseDetailSection extends AbstractCdmDetailSection<TaxonBase> implements ITaxonBaseDetailSection{
32
33 private TaxonBase taxonBase;
34
35 /**
36 * <p>Constructor for TaxonBaseDetailSection.</p>
37 *
38 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
39 * @param style a int.
40 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
41 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
42 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
43 */
44 public TaxonBaseDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
45 super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
46 }
47
48 /*
49 * (non-Javadoc)
50 * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#setTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
51 */
52 /** {@inheritDoc} */
53 public void setTaxonBase(TaxonBase entity) {
54 this.taxonBase = entity;
55 TaxonBase taxonBase = (TaxonBase) HibernateProxyHelper.deproxy(entity);
56 setEntity(taxonBase);
57 }
58
59 /** {@inheritDoc} */
60 @Override
61 public String getHeading() {
62 return getEntity() != null ? getEntity().getClass().getSimpleName() : "TaxonBase";
63 }
64
65 /** {@inheritDoc} */
66 @Override
67 protected DetailType getDetailType() {
68 return DetailType.TAXONBASE;
69 }
70
71 /* (non-Javadoc)
72 * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
73 */
74 @Override
75 public TaxonBase getTaxonBase() {
76 return taxonBase;
77 }
78
79 }