1
|
/**
|
2
|
* Copyright (C) 2009 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.taxon;
|
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.Taxon;
|
17
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
18
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
|
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
|
* @author n.hoffmann
|
27
|
* @date Dec 1, 2011
|
28
|
*
|
29
|
*/
|
30
|
public class TaxonRelationshipDetailSection extends AbstractCdmDetailSection<TaxonRelationship> implements ITaxonBaseDetailSection {
|
31
|
Taxon taxon;
|
32
|
TaxonName name;
|
33
|
|
34
|
public TaxonRelationshipDetailSection(CdmFormFactory formFactory,
|
35
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
36
|
ISelectionProvider selectionProvider, int style) {
|
37
|
super(formFactory, conversation, parentElement, selectionProvider, style);
|
38
|
}
|
39
|
|
40
|
@Override
|
41
|
public String getHeading() {
|
42
|
return getEntity() != null ? getEntity().getType().getLabel(): "Taxon Relation";
|
43
|
}
|
44
|
|
45
|
/* (non-Javadoc)
|
46
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
|
47
|
*/
|
48
|
@Override
|
49
|
protected AbstractCdmDetailElement<TaxonRelationship> createCdmDetailElement(AbstractCdmDetailSection<TaxonRelationship> parentElement, int style) {
|
50
|
return formFactory.createTaxonRelationshipDetailElement(parentElement);
|
51
|
}
|
52
|
|
53
|
/** {@inheritDoc} */
|
54
|
@Override
|
55
|
public void setTaxonBase(TaxonBase taxon) {
|
56
|
this.taxon = (Taxon)taxon;
|
57
|
TaxonName name = HibernateProxyHelper.deproxy(taxon.getName());
|
58
|
setName(name);
|
59
|
}
|
60
|
|
61
|
@Override
|
62
|
public TaxonBase getTaxonBase() {
|
63
|
return taxon;
|
64
|
}
|
65
|
|
66
|
private void setName(TaxonName name){
|
67
|
this.name = name;
|
68
|
}
|
69
|
|
70
|
}
|