Project

General

Profile

Download (1.58 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
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
 */
19
public class DefaultLabelStrategy implements ILabelImageStrategy {
20

    
21
	@Override
22
    public String getNameRelationTypeLabel(NameRelationshipType type) {
23
		List<NameRelationshipType> vocab =
24
			TermStore.getTerms(NameRelationshipType.class);
25

    
26
		for (NameRelationshipType type1 : vocab) {
27
			if (type1.equals(type)) {
28
				return type1.getLabel();
29
			}
30
		}
31
		return "";
32
	}
33

    
34
	@Override
35
    public String getNameRelationTypeInverseLabel(NameRelationshipType type) {
36

    
37
		List<NameRelationshipType> vocab =
38
			TermStore.getTerms(NameRelationshipType.class);
39

    
40
		for (NameRelationshipType type1 : vocab) {
41
			if (type1.equals(type)) {
42
				return type1.getInverseLabel();
43
			}
44
		}
45
		return "";
46
	}
47

    
48
	@Override
49
    public Image getNameRelationTypeImage(NameRelationshipType type) {
50
		if (NameRelationshipType.BASIONYM().equals(type)) {
51
			return ImageResources.getImage(
52
					ImageResources.BASIONYM_ICON);
53
		}
54
		if (NameRelationshipType.ORTHOGRAPHIC_VARIANT().equals(type)) {
55
			return ImageResources.getImage(
56
					ImageResources.ORTHOGRAPHIC_VARIANT_ICON);
57
		}
58
		return null;
59
	}
60

    
61
	@Override
62
    public String getNameRelationTypeDescription(NameRelationshipType type) {
63
		if (NameRelationshipType.BASIONYM().equals(type)) {
64
			return "Basionym";
65
		}
66
		return type.getDescription();
67
	}
68
}
(1-1/4)