Project

General

Profile

Download (2.47 KB) Statistics
| Branch: | Tag: | Revision:
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

    
10
package eu.etaxonomy.taxeditor.ui.section.name;
11

    
12
import org.eclipse.jface.viewers.ISelectionProvider;
13

    
14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
16
import eu.etaxonomy.cdm.model.name.INonViralName;
17
import eu.etaxonomy.cdm.model.name.TaxonName;
18
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
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
 * @created 05.06.2009
28
 * @version 1.0
29
 */
30
public class AuthorshipDetailSection extends AbstractCdmDetailSection<INonViralName> implements ITaxonBaseDetailSection {
31

    
32
	private TaxonBase taxonBase;
33

    
34

    
35
	public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
36
			ISelectionProvider selectionProvider, int style) {
37
		super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
38

    
39
	}
40

    
41
	/** {@inheritDoc} */
42
	@Override
43
    public void setTaxonBase(TaxonBase entity) {
44
		this.taxonBase = entity;
45
		INonViralName name = HibernateProxyHelper.deproxy(entity.getName());
46
		setEntity(name);
47
	}
48

    
49
	/** {@inheritDoc} */
50
	@Override
51
	public String getHeading() {
52
		return "Authorship";
53
	}
54

    
55
	@Override
56
	public TaxonBase getTaxonBase() {
57
		return taxonBase;
58
	}
59

    
60
	@Override
61
	protected void setSectionTitle() {
62
        String title = "";
63
        String label = "";
64
        if (getEntity() != null && (getEntity() instanceof TaxonName) ) {
65
            label =((TaxonName) getEntity()).getAuthorshipCache();
66
            title = ": " + label;
67
        }
68
        this.setText(String.format("%s%s", getHeading(), title));
69
        setTextClient(createToolbar());
70
    }
71

    
72
	@Override
73
	protected AbstractCdmDetailElement<INonViralName> createCdmDetailElement(
74
			AbstractCdmDetailSection<INonViralName> parentElement, int style) {
75
	    return formFactory.createAuthorshipDetailElement(parentElement, style);
76
	}
77

    
78
	public void updateContent(){
79
		((AuthorshipDetailElement)this.detailElement).updateContent();
80
	}
81

    
82
}
(3-3/21)