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.INonViralName;
|
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
|
* <p>NameDetailSection class.</p>
|
25
|
*
|
26
|
* @author n.hoffmann
|
27
|
* @created 05.06.2009
|
28
|
*/
|
29
|
public class NameDetailSection
|
30
|
extends AbstractCdmDetailSection<INonViralName>
|
31
|
implements ITaxonBaseDetailSection{
|
32
|
|
33
|
private TaxonBase<?> taxonBase;
|
34
|
|
35
|
/**
|
36
|
* <p>Constructor for NameDetailSection.</p>
|
37
|
*
|
38
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
39
|
* @param style a int.
|
40
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.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 NameDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
|
45
|
ISelectionProvider selectionProvider, int style) {
|
46
|
super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
public void setTaxonBase(TaxonBase entity) {
|
51
|
this.taxonBase = entity;
|
52
|
INonViralName name = (INonViralName) HibernateProxyHelper.deproxy(entity.getName());
|
53
|
setEntity(name);
|
54
|
}
|
55
|
|
56
|
@Override
|
57
|
public String getHeading() {
|
58
|
return "Scientific Name";
|
59
|
}
|
60
|
|
61
|
@Override
|
62
|
protected void setSectionTitle() {
|
63
|
if(!isDisposed()){
|
64
|
String title = "";
|
65
|
if(getEntity() != null){
|
66
|
title = ": " + getEntity().getNameCache();
|
67
|
}
|
68
|
this.setText(getHeading() + title);
|
69
|
}
|
70
|
}
|
71
|
|
72
|
@Override
|
73
|
public TaxonBase<?> getTaxonBase() {
|
74
|
return taxonBase;
|
75
|
}
|
76
|
|
77
|
@Override
|
78
|
protected AbstractCdmDetailElement<INonViralName> createCdmDetailElement(
|
79
|
AbstractCdmDetailSection<INonViralName> parentElement, int style) {
|
80
|
return formFactory.createNameDetailElement(parentElement, style);
|
81
|
|
82
|
}
|
83
|
|
84
|
public void updateContent(){
|
85
|
((NameDetailElement)this.detailElement).updateContent();
|
86
|
}
|
87
|
}
|