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.editor.view.checklist.e4;
|
10
|
|
11
|
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
|
12
|
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
|
13
|
|
14
|
import eu.etaxonomy.cdm.api.service.dto.TaxonDistributionDTO;
|
15
|
|
16
|
/**
|
17
|
* @author k.luther
|
18
|
* @since 05.12.2018
|
19
|
*
|
20
|
*/
|
21
|
public class DistributionEditorConfigLabelAccumulator implements IConfigLabelAccumulator{
|
22
|
|
23
|
public static final String STATUS = "STATUS";
|
24
|
public static final String STATUS_EDITABLE = STATUS+"_EDITABLE";
|
25
|
public static final String FILTER_EDITABLE = "FILTER_EDITABLE";
|
26
|
|
27
|
|
28
|
private DistributionEditor editor;
|
29
|
|
30
|
public DistributionEditorConfigLabelAccumulator(DistributionEditor editor) {
|
31
|
super();
|
32
|
this.editor = editor;
|
33
|
}
|
34
|
|
35
|
@Override
|
36
|
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
|
37
|
boolean isEditable = true;
|
38
|
|
39
|
Object rowObject = editor.getBodyDataProvider().getRowObject(rowPosition);
|
40
|
TaxonDistributionDTO taxonRowWrapper = null;
|
41
|
if(rowObject instanceof TaxonDistributionDTO){
|
42
|
taxonRowWrapper = (TaxonDistributionDTO) rowObject;
|
43
|
}
|
44
|
|
45
|
if(columnPosition==0){
|
46
|
configLabels.addLabel(DistributionEditor.TAXON_COLUMN);
|
47
|
configLabels.addLabel(FILTER_EDITABLE);
|
48
|
} else if(columnPosition==1 && editor.isShowRank()){
|
49
|
configLabels.addLabel(DistributionEditor.RANK_COLUMN);
|
50
|
} else{
|
51
|
|
52
|
configLabels.addLabel(STATUS);
|
53
|
if(isEditable){
|
54
|
configLabels.addLabel(STATUS_EDITABLE);
|
55
|
}
|
56
|
|
57
|
|
58
|
|
59
|
}
|
60
|
}
|
61
|
}
|