1
|
package eu.etaxonomy.taxeditor.propertysheet;
|
2
|
|
3
|
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
|
4
|
import eu.etaxonomy.cdm.model.common.Annotation;
|
5
|
import eu.etaxonomy.cdm.model.common.Marker;
|
6
|
|
7
|
public class MarkerPropertySource extends CollectionPropertySource {
|
8
|
|
9
|
private AnnotatableEntity annotatableEntity;
|
10
|
|
11
|
public MarkerPropertySource(AnnotatableEntity annotatableEntity) {
|
12
|
super(annotatableEntity.getMarkers());
|
13
|
|
14
|
this.annotatableEntity = annotatableEntity;
|
15
|
}
|
16
|
|
17
|
@Override
|
18
|
protected String getItemDisplayName(Object item) {
|
19
|
// No display names on individual annotations
|
20
|
return "";
|
21
|
}
|
22
|
|
23
|
@Override
|
24
|
public Object getPropertyValue(Object id) {
|
25
|
if (id instanceof Marker) {
|
26
|
Marker marker = (Marker) id;
|
27
|
String text = marker.getMarkerType().getLabel();
|
28
|
text += " (" + marker.getFlag() + ")";
|
29
|
return text;
|
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
|
// "Annotations" header has no value
|
42
|
return "";
|
43
|
}
|
44
|
}
|