Project

General

Profile

Download (2.18 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.editor.descriptiveDataSet.matrix;
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.model.description.Feature;
15
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
16

    
17
/**
18
 * @author pplitzner
19
 * @since Jul 6, 2018
20
 *
21
 */
22
public class CharacterMatrixConfigLabelAccumulator implements IConfigLabelAccumulator {
23

    
24
    public static final String QUANTITATIVE = "QUANTITATIVE";
25
    public static final String CATEGORICAL = "CATEGORICAL";
26

    
27
    private CharacterMatrix matrix;
28

    
29
    public CharacterMatrixConfigLabelAccumulator(CharacterMatrix matrix) {
30
        super();
31
        this.matrix = matrix;
32
    }
33

    
34
    @Override
35
    public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
36
        Object rowObject = matrix.getBodyDataProvider().getRowObject(rowPosition);
37
        if(rowObject instanceof TaxonNode){
38
            configLabels.addLabel(CharacterMatrix.LABEL_TAXON_ROW);
39
        }
40
        if(columnPosition==0){
41
            configLabels.addLabel(CharacterMatrix.TAXON_COLUMN);
42
        }
43
        else if(columnPosition==1){
44
            configLabels.addLabel(CharacterMatrix.COLLECTOR_COLUMN);
45
        }
46
        else if(columnPosition==2){
47
            configLabels.addLabel(CharacterMatrix.IDENTIFIER_COLUMN);
48
        }
49
        else if(columnPosition==3){
50
            configLabels.addLabel(CharacterMatrix.COUNTRY_COLUMN);
51
        }
52
        else{
53
            Feature feature = matrix.getFeatures().get(columnPosition-CharacterMatrix.LEADING_COLUMN_COUNT);
54
            configLabels.addLabel(MatrixUtility.getProperty(feature));
55
            if(feature.isSupportsCategoricalData()){
56
                configLabels.addLabel(CATEGORICAL);
57
            }
58
            else if(feature.isSupportsQuantitativeData()){
59
                configLabels.addLabel(QUANTITATIVE);
60
            }
61
        }
62
    }
63
}
(8-8/20)