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

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