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
|
/* (non-Javadoc)
|
87
|
* @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer#showAnnotations()
|
88
|
*/
|
89
|
@Override
|
90
|
public void showAnnotations() {
|
91
|
if(getData().getSec() == null){
|
92
|
getNameViewer().addAnnotation(
|
93
|
new EditorAnnotation(0, "This misapplication requires a sec. reference."));
|
94
|
}
|
95
|
super.showAnnotations();
|
96
|
}
|
97
|
|
98
|
|
99
|
/** {@inheritDoc} */
|
100
|
@Override
|
101
|
protected void updateNonEditableInfo() {
|
102
|
showSec();
|
103
|
}
|
104
|
|
105
|
|
106
|
/* (non-Javadoc)
|
107
|
* @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
|
108
|
*/
|
109
|
@Override
|
110
|
protected void updateIndent() {
|
111
|
setIndent(MISAPPLIEDNAME_INDENT);
|
112
|
}
|
113
|
|
114
|
}
|