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.hibernate.HibernateProxyHelper;
|
14
|
import eu.etaxonomy.cdm.model.name.INonViralName;
|
15
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
|
21
|
|
22
|
/**
|
23
|
* @author n.hoffmann
|
24
|
* @created 05.06.2009
|
25
|
*/
|
26
|
public class NameDetailSection
|
27
|
extends AbstractCdmDetailSection<INonViralName>
|
28
|
implements ITaxonBaseDetailSection{
|
29
|
|
30
|
private TaxonBase<?> taxonBase;
|
31
|
|
32
|
public NameDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
|
33
|
ISelectionProvider selectionProvider, int style) {
|
34
|
super(cdmFormFactory, parentElement, selectionProvider, style);
|
35
|
}
|
36
|
|
37
|
@Override
|
38
|
public void setTaxonBase(TaxonBase entity) {
|
39
|
this.taxonBase = entity;
|
40
|
INonViralName name = HibernateProxyHelper.deproxy(entity.getName());
|
41
|
setEntity(name);
|
42
|
}
|
43
|
|
44
|
@Override
|
45
|
public String getHeading() {
|
46
|
return "Scientific Name";
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
protected void setSectionTitle() {
|
51
|
if(!isDisposed()){
|
52
|
String title = "";
|
53
|
if(getEntity() != null){
|
54
|
title = ": " + getEntity().getNameCache();
|
55
|
}
|
56
|
this.setText(getHeading() + title);
|
57
|
}
|
58
|
}
|
59
|
|
60
|
@Override
|
61
|
public TaxonBase<?> getTaxonBase() {
|
62
|
return taxonBase;
|
63
|
}
|
64
|
|
65
|
@Override
|
66
|
protected AbstractCdmDetailElement<INonViralName> createCdmDetailElement(
|
67
|
AbstractCdmDetailSection<INonViralName> parentElement, int style) {
|
68
|
return formFactory.createNameDetailElement(parentElement, style);
|
69
|
|
70
|
}
|
71
|
|
72
|
public void updateContent(){
|
73
|
((NameDetailElement)this.detailElement).updateContent();
|
74
|
}
|
75
|
}
|