Project

General

Profile

Download (1.97 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.NatTable;
12
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
13
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
14
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
15

    
16
import eu.etaxonomy.cdm.model.common.CdmBase;
17
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
18

    
19
/**
20
 * @author pplitzner
21
 * @since Jul 6, 2018
22
 *
23
 */
24
public class BulkEditorConfigLabelAccumulator implements IConfigLabelAccumulator {
25
    private ListDataProvider<CdmBase> dataProvider;
26
    private AbstractBulkEditorInput input;
27
    private NatTable natTable;
28

    
29
    public BulkEditorConfigLabelAccumulator(NatTable natTable, ListDataProvider<CdmBase> dataProvider,
30
            AbstractBulkEditorInput input) {
31
        super();
32
        this.dataProvider = dataProvider;
33
        this.input = input;
34
        this.natTable = natTable;
35
    }
36

    
37

    
38
    @Override
39
    public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
40
        if(rowPosition<0){
41
            return;
42
        }
43
        CdmBase rowObject = dataProvider.getRowObject(rowPosition);
44
        if(input.getMergeCandidates().contains(rowObject)){
45
            configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE);
46
            if(columnPosition==0){
47
                configLabels.addLabel(BulkEditorE4Composite.LABEL_CANDIDATE_ICON);
48
            }
49
        }
50
        else if(input.getMergeTarget()==rowObject){
51
            configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET);
52
            if(columnPosition==0){
53
                configLabels.addLabel(BulkEditorE4Composite.LABEL_TARGET_ICON);
54
            }
55
        }
56
    }
57
}
(1-1/7)