1 |
3be6ef3e
|
n.hoffmann
|
/**
|
2 |
ff27466a
|
Patric Plitzner
|
*
|
3 |
3be6ef3e
|
n.hoffmann
|
*/
|
4 |
|
|
package eu.etaxonomy.taxeditor.labels;
|
5 |
|
|
|
6 |
|
|
import java.util.List;
|
7 |
|
|
|
8 |
|
|
import org.eclipse.swt.graphics.Image;
|
9 |
|
|
|
10 |
|
|
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
|
11 |
|
|
import eu.etaxonomy.taxeditor.model.ImageResources;
|
12 |
|
|
import eu.etaxonomy.taxeditor.store.TermStore;
|
13 |
|
|
|
14 |
|
|
/**
|
15 |
|
|
* <p>DefaultLabelStrategy class.</p>
|
16 |
|
|
*
|
17 |
|
|
* @author p.ciardelli
|
18 |
|
|
* @version $Id: $
|
19 |
|
|
*/
|
20 |
|
|
public class DefaultLabelStrategy implements ILabelImageStrategy {
|
21 |
|
|
|
22 |
|
|
/* (non-Javadoc)
|
23 |
|
|
* @see eu.etaxonomy.taxeditor.editor.labels.IEditorLabelStrategy#getNameRelationTypeLabel(eu.etaxonomy.cdm.model.name.NameRelationshipType)
|
24 |
|
|
*/
|
25 |
|
|
/** {@inheritDoc} */
|
26 |
ff27466a
|
Patric Plitzner
|
@Override
|
27 |
|
|
public String getNameRelationTypeLabel(NameRelationshipType type) {
|
28 |
|
|
List<NameRelationshipType> vocab =
|
29 |
b9a0d300
|
l.morris
|
TermStore.getTerms(NameRelationshipType.class);
|
30 |
ff27466a
|
Patric Plitzner
|
|
31 |
3be6ef3e
|
n.hoffmann
|
for (NameRelationshipType type1 : vocab) {
|
32 |
|
|
if (type1.equals(type)) {
|
33 |
|
|
return type1.getLabel();
|
34 |
|
|
}
|
35 |
|
|
}
|
36 |
|
|
return "";
|
37 |
|
|
}
|
38 |
ff27466a
|
Patric Plitzner
|
|
39 |
3be6ef3e
|
n.hoffmann
|
/* (non-Javadoc)
|
40 |
|
|
* @see eu.etaxonomy.taxeditor.editor.labels.IEditorLabelStrategy#getNameRelationInverseTypeLabel(eu.etaxonomy.cdm.model.name.NameRelationshipType)
|
41 |
|
|
*/
|
42 |
|
|
/** {@inheritDoc} */
|
43 |
ff27466a
|
Patric Plitzner
|
@Override
|
44 |
|
|
public String getNameRelationTypeInverseLabel(NameRelationshipType type) {
|
45 |
|
|
|
46 |
|
|
List<NameRelationshipType> vocab =
|
47 |
b9a0d300
|
l.morris
|
TermStore.getTerms(NameRelationshipType.class);
|
48 |
3be6ef3e
|
n.hoffmann
|
|
49 |
|
|
for (NameRelationshipType type1 : vocab) {
|
50 |
|
|
if (type1.equals(type)) {
|
51 |
|
|
return type1.getInverseLabel();
|
52 |
|
|
}
|
53 |
|
|
}
|
54 |
|
|
return "";
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
/* (non-Javadoc)
|
58 |
|
|
* @see eu.etaxonomy.taxeditor.editor.labels.ILabelImageStrategy#getNameRelationImage(eu.etaxonomy.cdm.model.name.NameRelationship)
|
59 |
|
|
*/
|
60 |
|
|
/** {@inheritDoc} */
|
61 |
ff27466a
|
Patric Plitzner
|
@Override
|
62 |
|
|
public Image getNameRelationTypeImage(NameRelationshipType type) {
|
63 |
3be6ef3e
|
n.hoffmann
|
if (NameRelationshipType.BASIONYM().equals(type)) {
|
64 |
|
|
return ImageResources.getImage(
|
65 |
|
|
ImageResources.BASIONYM_ICON);
|
66 |
|
|
}
|
67 |
|
|
if (NameRelationshipType.ORTHOGRAPHIC_VARIANT().equals(type)) {
|
68 |
|
|
return ImageResources.getImage(
|
69 |
|
|
ImageResources.ORTHOGRAPHIC_VARIANT_ICON);
|
70 |
|
|
}
|
71 |
|
|
return null;
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
/* (non-Javadoc)
|
75 |
|
|
* @see eu.etaxonomy.taxeditor.labels.ILabelImageStrategy#getNameRelationDescription(eu.etaxonomy.cdm.model.name.NameRelationshipType)
|
76 |
|
|
*/
|
77 |
|
|
/** {@inheritDoc} */
|
78 |
ff27466a
|
Patric Plitzner
|
@Override
|
79 |
|
|
public String getNameRelationTypeDescription(NameRelationshipType type) {
|
80 |
3be6ef3e
|
n.hoffmann
|
if (NameRelationshipType.BASIONYM().equals(type)) {
|
81 |
|
|
return "Basionym";
|
82 |
|
|
}
|
83 |
|
|
return type.getDescription();
|
84 |
|
|
}
|
85 |
|
|
}
|