Project

General

Profile

Download (2.41 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
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.name.TaxonName;
17
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
22
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
23

    
24
/**
25
 * @author n.hoffmann
26
 * @created 05.06.2009
27
 */
28
public class AuthorshipDetailSection extends AbstractCdmDetailSection<INonViralName> implements ITaxonBaseDetailSection {
29

    
30
	private TaxonBase<?> taxonBase;
31

    
32
	public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
33
			ISelectionProvider selectionProvider, int style) {
34
		super(cdmFormFactory, conversation, 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 "Authorship";
47
	}
48

    
49
	@Override
50
	public TaxonBase getTaxonBase() {
51
		return taxonBase;
52
	}
53

    
54
	@Override
55
	protected void setSectionTitle() {
56
        String title = "";
57
        String label = "";
58
        if (getEntity() != null && (getEntity() instanceof TaxonName) ) {
59
            label =((TaxonName) getEntity()).getAuthorshipCache();
60
            title = ": " + label;
61
        }
62
        this.setText(String.format("%s%s", getHeading(), title));
63
        setTextClient(createToolbar());
64
    }
65

    
66
	@Override
67
	protected AbstractCdmDetailElement<INonViralName> createCdmDetailElement(
68
			AbstractCdmDetailSection<INonViralName> parentElement, int style) {
69
	    return formFactory.createAuthorshipDetailElement(parentElement, style);
70
	}
71

    
72
	public void updateContent(){
73
		((AuthorshipDetailElement)this.detailElement).updateContent();
74
	}
75
}
(3-3/21)