Project

General

Profile

Download (2.48 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.editor.name.container;
11

    
12
import org.eclipse.swt.graphics.Font;
13

    
14
import eu.etaxonomy.cdm.model.taxon.Taxon;
15
import eu.etaxonomy.taxeditor.editor.EditorUtil;
16
import eu.etaxonomy.taxeditor.preference.Resources;
17

    
18
/**
19
 * <p>MisapplicationContainer class.</p>
20
 *
21
 * @author p.ciardelli
22
 * @created 13.01.2009
23
 * @version 1.0
24
 */
25
public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
26
	
27
	/**
28
	 * <p>Constructor for MisapplicationContainer.</p>
29
	 *
30
	 * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
31
	 * @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} object.
32
	 * @param misappliedName a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
33
	 */
34
	public MisapplicationContainer(AbstractGroup group, Taxon misappliedName) {
35
		super(misappliedName);
36
	}
37
	
38

    
39
	/* (non-Javadoc)
40
	 * @see eu.etaxonomy.taxeditor.editor.name.NameComposite#initializeComposite()
41
	 */
42
	/** {@inheritDoc} */
43
	@Override
44
	protected void initializeComposite() {
45
		setIsDraggable(true);
46
		setFont(getViewerFont());
47
		
48
		showSec();		
49
		
50
		initTextViewer();
51
	}
52

    
53
	@Override
54
	protected void updateIcon() {
55
		setIcon(MISAPPLIEDNAME_ICON);
56
	}
57
	
58
	private void showSec() {
59
		if (getMisappliedName() == null) {
60
			return;
61
		}
62
		
63
		if (getMisappliedName().getSec() == null) {
64
			setNonEditableInfo("sec. ???", false);
65
		} else {
66
			String title = getMisappliedName().getSec().getTitleCache();
67
			setNonEditableInfo("sec. " + title, false);
68
		}
69
	}
70
	
71
	/**
72
	 * <p>getMisappliedName</p>
73
	 *
74
	 * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
75
	 */
76
	public Taxon getMisappliedName() {
77
		return getTaxonBase();
78
	}
79

    
80
	/** {@inheritDoc} */
81
	@Override
82
	protected Font getViewerFont() {
83
		return EditorUtil.getFont(Resources.MISAPPLIEDNAME_FONT);
84
	}
85
	
86
	/**
87
	 * <p>calculateErrors</p>
88
	 */
89
	protected void calculateErrors() {
90
		super.calculateErrors();
91
		
92
		nameViewer.setShowSecError(getMisappliedName());
93
	}
94
	
95

    
96
	/** {@inheritDoc} */
97
	@Override
98
	protected void updateNonEditableInfo() {
99
		showSec();
100
	}
101

    
102

    
103
	/* (non-Javadoc)
104
	 * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
105
	 */
106
	@Override
107
	protected void updateIndent() {
108
		setIndent(MISAPPLIEDNAME_INDENT);
109
	}
110

    
111
}
(15-15/19)