Project

General

Profile

Download (2.71 KB) Statistics
| Branch: | Tag: | Revision:
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.name;
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.name.NonViralName;
18
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
19
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
22
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
23
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
24

    
25
/**
26
 * <p>NameDetailSection class.</p>
27
 *
28
 * @author n.hoffmann
29
 * @created 05.06.2009
30
 * @version 1.0
31
 */
32
public class NameDetailSection extends AbstractCdmDetailSection<NonViralName> implements ITaxonBaseDetailSection{
33

    
34
	private TaxonBase taxonBase;
35

    
36
	/**
37
	 * <p>Constructor for NameDetailSection.</p>
38
	 *
39
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
40
	 * @param style a int.
41
	 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
42
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
43
	 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
44
	 */
45
	public NameDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
46
			ISelectionProvider selectionProvider, int style) {
47
		super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
48
	}
49

    
50
	/** {@inheritDoc} */
51
	public void setTaxonBase(TaxonBase entity) {
52
		this.taxonBase = entity;
53
		NonViralName name = (NonViralName) HibernateProxyHelper.deproxy(entity.getName());
54
		setEntity(name);
55
	}
56

    
57
	/** {@inheritDoc} */
58
	@Override
59
	public String getHeading() {
60
		return "Scientific Name";
61
	}
62

    
63
	/** {@inheritDoc} */
64
	@Override
65
	protected DetailType getDetailType() {
66
		return DetailType.SCIENTIFICNAME;
67
	}
68

    
69
	/** {@inheritDoc} */
70
	@Override
71
	protected void setSectionTitle() {
72
		if(!isDisposed()){
73
			String title = "";
74
			if(getEntity() != null && (getEntity() instanceof NonViralName)){
75
				 title = ": " + ((NonViralName) getEntity()).getNameCache();
76
			}
77
			this.setText(getHeading() + title);
78
		}
79
	}
80

    
81
	/* (non-Javadoc)
82
	 * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
83
	 */
84
	@Override
85
	public TaxonBase getTaxonBase() {
86
		return taxonBase;
87
	}
88
	
89
}
(7-7/21)