1
|
/**
|
2
|
* Copyright (C) 2018 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
|
package eu.etaxonomy.taxeditor.bulkeditor.e4;
|
10
|
|
11
|
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
14
|
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
|
15
|
|
16
|
/**
|
17
|
* @author pplitzner
|
18
|
* @since May 29, 2018
|
19
|
*
|
20
|
*/
|
21
|
public class BulkEditorPropertyAccessor implements IColumnPropertyAccessor<CdmBase> {
|
22
|
|
23
|
private AbstractBulkEditorInput input;
|
24
|
|
25
|
public BulkEditorPropertyAccessor(AbstractBulkEditorInput<CdmBase> input) {
|
26
|
super();
|
27
|
this.input = input;
|
28
|
}
|
29
|
|
30
|
@Override
|
31
|
public Object getDataValue(CdmBase rowObject, int columnIndex) {
|
32
|
String property = BulkEditorE4Composite.columnList.get(columnIndex);
|
33
|
if(property.equals(input.getName())){
|
34
|
return input.getText(rowObject);
|
35
|
}if(property.equals(BulkEditorE4Composite.TYPE_PROPERTY)){
|
36
|
return input.getTypeText(rowObject);
|
37
|
}if(property.equals(BulkEditorE4Composite.UUID_PROPERTY)){
|
38
|
return rowObject.getUuid();
|
39
|
}if(property.equals(BulkEditorE4Composite.ID_PROPERTY)){
|
40
|
return rowObject.getId();
|
41
|
}
|
42
|
return null;
|
43
|
}
|
44
|
|
45
|
@Override
|
46
|
public void setDataValue(CdmBase rowObject, int columnIndex, Object newValue) {
|
47
|
//no editing allowed
|
48
|
}
|
49
|
|
50
|
@Override
|
51
|
public int getColumnCount() {
|
52
|
return BulkEditorE4Composite.columnList.size();
|
53
|
}
|
54
|
|
55
|
@Override
|
56
|
public String getColumnProperty(int columnIndex) {
|
57
|
return BulkEditorE4Composite.columnList.get(columnIndex);
|
58
|
}
|
59
|
|
60
|
@Override
|
61
|
public int getColumnIndex(String propertyName) {
|
62
|
return BulkEditorE4Composite.columnList.indexOf(propertyName);
|
63
|
}
|
64
|
}
|