Project

General

Profile

Download (2.27 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
 * @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
	public String getNameRelationTypeLabel(NameRelationshipType type) {
27
		List<NameRelationshipType> vocab = 
28
			TermStore.getTerms(NameRelationshipType.class);
29
	
30
		for (NameRelationshipType type1 : vocab) {
31
			if (type1.equals(type)) {
32
				return type1.getLabel();
33
			}
34
		}
35
		return "";
36
	}
37
		
38
	/* (non-Javadoc)
39
	 * @see eu.etaxonomy.taxeditor.editor.labels.IEditorLabelStrategy#getNameRelationInverseTypeLabel(eu.etaxonomy.cdm.model.name.NameRelationshipType)
40
	 */
41
	/** {@inheritDoc} */
42
	public String getNameRelationTypeInverseLabel(NameRelationshipType type) {
43
		
44
		List<NameRelationshipType> vocab = 
45
			TermStore.getTerms(NameRelationshipType.class);
46

    
47
		for (NameRelationshipType type1 : vocab) {
48
			if (type1.equals(type)) {
49
				return type1.getInverseLabel();
50
			}
51
		}
52
		return "";
53
	}
54

    
55
	/* (non-Javadoc)
56
	 * @see eu.etaxonomy.taxeditor.editor.labels.ILabelImageStrategy#getNameRelationImage(eu.etaxonomy.cdm.model.name.NameRelationship)
57
	 */
58
	/** {@inheritDoc} */
59
	public Image getNameRelationTypeImage(NameRelationshipType type) {
60
		if (NameRelationshipType.BASIONYM().equals(type)) {
61
			return ImageResources.getImage(
62
					ImageResources.BASIONYM_ICON);
63
		}
64
		if (NameRelationshipType.ORTHOGRAPHIC_VARIANT().equals(type)) {
65
			return ImageResources.getImage(
66
					ImageResources.ORTHOGRAPHIC_VARIANT_ICON);
67
		}
68
		return null;
69
	}
70

    
71
	/* (non-Javadoc)
72
	 * @see eu.etaxonomy.taxeditor.labels.ILabelImageStrategy#getNameRelationDescription(eu.etaxonomy.cdm.model.name.NameRelationshipType)
73
	 */
74
	/** {@inheritDoc} */
75
	public String getNameRelationTypeDescription(NameRelationshipType type) {
76
		if (NameRelationshipType.BASIONYM().equals(type)) {
77
			return "Basionym";
78
		}
79
		return type.getDescription();
80
	}
81
}
(1-1/4)