Project

General

Profile

Download (1.82 KB) Statistics
| Branch: | Tag: | Revision:
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<CdmBase> input;
24
        private BulkEditorE4Composite bulkEditorComposite;
25

    
26
        public BulkEditorPropertyAccessor(BulkEditorE4Composite bulkEditorComposite, AbstractBulkEditorInput<CdmBase> input) {
27
            super();
28
            this.input = input;
29
            this.bulkEditorComposite = bulkEditorComposite;
30
        }
31

    
32
        @Override
33
        public Object getDataValue(CdmBase cdmBase, int columnIndex) {
34
            String property = bulkEditorComposite.getColumnList().get(columnIndex);
35
            return input.getPropertyValue(cdmBase, property);
36
        }
37

    
38
        @Override
39
        public void setDataValue(CdmBase rowObject, int columnIndex, Object newValue) {
40
            //no editing allowed
41
        }
42

    
43
        @Override
44
        public int getColumnCount() {
45
            return bulkEditorComposite.getColumnList().size();
46
        }
47

    
48
        @Override
49
        public String getColumnProperty(int columnIndex) {
50
            return bulkEditorComposite.getColumnList().get(columnIndex);
51
        }
52

    
53
        @Override
54
        public int getColumnIndex(String propertyName) {
55
            return bulkEditorComposite.getColumnList().indexOf(propertyName);
56
        }
57
    }
(6-6/9)