Project

General

Profile

Download (1.7 KB) Statistics
| Branch: | Tag: | Revision:
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.propertysheet.name;
11

    
12
import org.apache.log4j.Logger;
13
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
14

    
15
import eu.etaxonomy.cdm.common.CdmUtils;
16
import eu.etaxonomy.cdm.model.name.BotanicalName;
17

    
18
/**
19
 * Property source for BotanicalName entries.
20
 *  
21
 * @author p.ciardelli
22
 * @created 21.05.2008
23
 * @version 1.0
24
 */
25
public class BotanicalNamePropertySource extends NonViralNamePropertySource {
26
	private static final Logger logger = Logger
27
			.getLogger(BotanicalNamePropertySource.class);
28
	
29
    // Property unique keys
30
	public static final String P_ID_REFERENCEYEAR = "referenceyear";	
31
    // Property display keys
32
//	public static final String P_REFERENCEYEAR = "099:Reference Year";
33
	public static final String P_REFERENCEYEAR = "Reference Year";
34
		
35
	public BotanicalNamePropertySource(BotanicalName name) {
36
		super(name);
37
//		addDescriptor(P_ID_REFERENCEYEAR);
38
	}
39
		
40
	protected void addDescriptor(String id) {
41
		if (id.equals(P_ID_REFERENCEYEAR)) {
42
			descriptors.addElement(
43
					new TextPropertyDescriptor(P_ID_REFERENCEYEAR, P_REFERENCEYEAR));
44
		}
45
		super.addDescriptor(id);
46
	}
47
	
48
	@Override
49
	public Object getPropertyValue(Object id) {
50
        if (id.equals(P_ID_NOMENCLATURAL_CODE)) {
51
        	return "ICBN";
52
        }
53
        if (id.equals(P_ID_REFERENCEYEAR)) {
54
        	return CdmUtils.Nz(name.getReferenceYear());
55
        }
56
		return super.getPropertyValue(id);
57
	}
58
}
(2-2/14)