4 package eu
.etaxonomy
.taxeditor
.labels
;
6 import org
.eclipse
.swt
.graphics
.Image
;
8 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
9 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
10 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
11 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
14 * Returns labels and images that are dependent on a nomenclatural
15 * code using a code-specific ILabelImageStrategy.
19 public class LabelImageProvider
implements ILabelImageStrategy
{
21 private ILabelImageStrategy strategy
;
24 * <p>getLabelStrategy</p>
26 * @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
27 * @return a {@link eu.etaxonomy.taxeditor.labels.ILabelImageStrategy} object.
29 public static ILabelImageStrategy
getLabelStrategy(TaxonName name
) {
31 if (PreferencesUtil
.getPreferredNomenclaturalCode().
32 equals(NomenclaturalCode
.ICZN
)) {
33 return new ZoologicalNameLabelStrategy();
35 } else if (name
.getNameType() != null &&
36 name
.getNameType().equals(NomenclaturalCode
.ICZN
)) {
37 return new ZoologicalNameLabelStrategy();
39 return new DefaultLabelStrategy();
43 * <p>Constructor for LabelImageProvider.</p>
45 * @param strategy a {@link eu.etaxonomy.taxeditor.labels.ILabelImageStrategy} object.
47 public LabelImageProvider(ILabelImageStrategy strategy
) {
48 this.strategy
= strategy
;
52 * @see eu.etaxonomy.taxeditor.editor.labels.IEditorLabelStrategy#getNameRelationTypeLabel(eu.etaxonomy.cdm.model.name.NameRelationshipType)
56 public String
getNameRelationTypeLabel(NameRelationshipType type
) {
57 return strategy
.getNameRelationTypeLabel(type
);
61 * @see eu.etaxonomy.taxeditor.editor.labels.IEditorLabelStrategy#getNameRelationInverseTypeLabel(eu.etaxonomy.cdm.model.name.NameRelationshipType)
65 public String
getNameRelationTypeInverseLabel(NameRelationshipType type
) {
66 return strategy
.getNameRelationTypeInverseLabel(type
);
70 * @see eu.etaxonomy.taxeditor.editor.labels.ILabelImageStrategy#getNameRelationImage(eu.etaxonomy.cdm.model.name.NameRelationship)
74 public Image
getNameRelationTypeImage(NameRelationshipType type
) {
75 return strategy
.getNameRelationTypeImage(type
);
79 * @see eu.etaxonomy.taxeditor.labels.ILabelImageStrategy#getNameRelationDescription(eu.etaxonomy.cdm.model.name.NameRelationshipType)
83 public String
getNameRelationTypeDescription(NameRelationshipType type
) {
84 return strategy
.getNameRelationTypeDescription(type
);