Project

General

Profile

Download (1.84 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.propertysheet.description;
12

    
13
import org.apache.log4j.Logger;
14
import org.eclipse.ui.views.properties.PropertyDescriptor;
15

    
16
import eu.etaxonomy.cdm.model.description.Distribution;
17

    
18
/**
19
 * @author p.ciardelli
20
 * @created 02.04.2009
21
 * @version 1.0
22
 */
23
public class DistributionPropertySource extends DescriptionElementPropertySource {
24
	private static final Logger logger = Logger
25
			.getLogger(DistributionPropertySource.class);
26

    
27
	public static final String P_ID_NAMED_AREA = "named area";
28
	public static final String P_NAMED_AREA = "Named Area";
29
	
30
	public static final String P_ID_STATUS = "status";
31
	public static final String P_STATUS = "Status";
32

    
33
	private Distribution distribution;
34
	
35
	/**
36
	 * @param element
37
	 */
38
	public DistributionPropertySource(Distribution distribution) {
39
		super(distribution);
40
		
41
		this.distribution = distribution;
42
		addDescriptor(P_ID_NAMED_AREA);
43
		addDescriptor(P_ID_STATUS);
44
	}
45
	
46
	protected void addDescriptor(String id) {
47
		super.addDescriptor(id);
48
		
49
		if (id.equals(P_ID_NAMED_AREA)) {
50
			descriptors.addElement(
51
					new PropertyDescriptor(P_ID_NAMED_AREA, P_NAMED_AREA)
52
			);
53
		}
54
		
55
		if (id.equals(P_ID_STATUS)) {
56
			descriptors.addElement(
57
					new PropertyDescriptor(P_ID_STATUS, P_STATUS)
58
			);
59
		}
60
	}
61
	
62

    
63

    
64
	public Object getPropertyValue(Object id) {
65
		
66
		if (id.equals(P_ID_NAMED_AREA)) {
67
			return distribution.getArea().getLabel();
68
		}
69
		
70
		if (id.equals(P_ID_STATUS)) {
71
			return distribution.getStatus().getLabel();
72
		}
73
		
74
		return super.getPropertyValue(id);
75
	}
76
}
(3-3/4)