Project

General

Profile

Download (1.01 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.taxeditor.propertysheet;
2

    
3
import eu.etaxonomy.cdm.model.common.Extension;
4
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
5

    
6
public class ExtensionPropertySource extends CollectionPropertySource {
7

    
8
	private IdentifiableEntity entity;
9

    
10
	public ExtensionPropertySource(IdentifiableEntity entity) {
11
		super(entity.getExtensions());
12
		
13
		this.entity = entity;
14
	}
15
	
16
	@Override
17
	protected String getItemDisplayName(Object item) {
18
		if (item instanceof Extension) {
19
			Extension extension = (Extension) item;
20
			return extension.getType().getLabel();			
21
		}
22
		return "";
23
	}
24

    
25
	@Override
26
	public Object getPropertyValue(Object id) {
27
		if (id instanceof Extension) {
28
			Extension extension = (Extension) id;
29
			return extension.getValue();
30
		}
31
		return null;
32
	}
33

    
34
	@Override
35
	public void setPropertyValue(Object id, Object value) {
36
		// Fields not editable in property sheet view
37
	}
38

    
39
	@Override
40
	public String toString() {
41
		// "Extensions" header has no value
42
		return "";
43
	}
44
}
(12-12/24)